[Jprogramming] sparse ranks

Roger Hui rogerhui.canada at gmail.com
Tue Dec 15 18:47:37 UTC 2020


If I were to re implement sparse (which I won't) only the leading axes can
be sparse, but the current implementation allows any and all axes to be
sparse.  Arrays which differ only in which axes are sparse, are supposed to
match.

On Tue, Dec 15, 2020 at 10:38 AM David Lambert <b49p23tivg at gmail.com> wrote:

> Fine comb reading the (nu)voc sparse pages doesn't indicate.   Is it true
> that only the leading dimensions of an array can be sparse?  For example f
> and g produce different results when the only difference between them is
> the choice of sparse axis.  Thanks, Dave.
>
> f=: 4 : 0
>  i=. #y
>  lc=.(0,.~#\i.i) y} 1$.(x,2);1;0
>  tail=. {: y
>  lu=. tail { lc
>  while. i < x do.
>   tail=. ((0 ~: {:) { (0 , -/)) lu
>   i =. >: i
>   lu=. i , {. tail { lc
>   lc=. lu tail} lc
>  end.
>  tail
> )
>
> g=: 4 : 0
>  i=. #y
>  lc=.(0,.~#\i.i) y} 1$.(x,2);0;0
>  tail=. {: y
>  lu=. tail { lc
>  while. i < x do.
>   tail=. ((0 ~: {:) { (0 , -/)) lu
>   i =. >: i
>   lu=. i , {. tail { lc
>   lc=. lu tail} lc
>  end.
>  tail
> )
>
>
>    10(f,g)1 2 3
> 0 6
>
>    JVERSION
> Engine: j902/j64avx2/windows
> Release-a: commercial/2020-12-05T13:36:01
> Library: 9.02.08
> Platform: Win 64
> Installer: J902 install
> InstallPath: c:/program files/j902
> Contact: www.jsoftware.com
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


More information about the Programming mailing list