Great!

While we are at it, the next question could be how to go the other way
around and create a matrix from indices and values?


  s =: $.d=: (?. 3 4$2) * ?. 3 4$100

i =: 4$.s

v =: 5$.s


we can use "scatter amend" since J version 9:


v i } 3 4$0


to create a dense matrix, but not


v i } 1$.3 4;0 1;0 NB. amend an 'empty' sparse matrix
|index error
|   v     i}1$.3 4;0 1;0


to create a sparse one. Is this a bug/not yet implemented? Good old:

v (;/i) } 1$.3 4;0 1;0 NB. with boxed indices


still works.


greetings

Ben




On Mon, 20 Jan 2020 at 16:31, 'Sergey Kamenev' via Programming <
[email protected]> wrote:

> 20.01.2020 7:57, Ben Gorte:
> > Do you mean 4$.s  ?
>
> Thanks. That's what I need.
>
> Sergey
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to