[Jprogramming] Re: sparse matrix from index/value pairs
June Kim
juneaftn at gmail.com
Sun May 18 10:35:29 HKT 2008
2008/5/18, June Kim <juneaftn at gmail.com>:
> 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?
>
More information about the Programming
mailing list