2008/5/18, June Kim <[EMAIL PROTECTED]>:
> Is there a more efficient way of getting sparse matrix from index/value pairs?
>
>   s
> 0 1 │   1
> 0 2 │  10
> 1 0 │   2
> 1 3 │ 100
>   (4&$.,.5&$.)s
> 0 1   1
> 0 2  10
> 1 0   2
> 1 3 100
>
> I'm thinking about some verb f that might satisfy(or something similar):
>
>   s-:(4&$.,.5&$.)s

Sorry for my typo:

   s-:f (4&$.,.5&$.)s

>
> I can do that using amend, but I have to build up a blank matrix of

I mean, build a blank non-sparse matrix and amend it, and turn it into
a sparse matrix.

> the full shape in the first place. Are there more efficient ways in
> time and space-wise?
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to