Aha! But rather than setting fills with !. , it IS possible to respecify the
sparse element.
Instead of
0$. sdata i."1 (1)
0 2 1 1 0
I can use
0$. (3;3)$. sdata i."1 (1)
3 2 1 1 0
to get the correct result.
Thanks for putting me on that track,
Ben
________________________________________
From: [email protected]
[[email protected]] on behalf of 'Pascal Jasmin' via
Programming [[email protected]]
Sent: Friday, September 26, 2014 15:03
To: [email protected]
Subject: Re: [Jprogramming] dyad i. on sparse array
I'd hope they were the same too, but here is what is happening:
1 i.~"1 $. #: i.5
1 │ 2
2 │ 1
3 │ 1
4 │ 0
Your result happens due to fill.
There could be a !. solution if !. allowed fills to be set for any function
(not defined for = or other purpose) or was defined for $. inv
----- Original Message -----
From: Ben Gorte - CITG <[email protected]>
To: "[email protected]" <[email protected]>
Cc:
Sent: Friday, September 26, 2014 8:30 AM
Subject: [Jprogramming] dyad i. on sparse array
Good afternoon,
I was finding a bug in my program that finally boiled down to this:
]data =: #: i.5 NB. some test data
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
sdata =: $.data NB. now sparse
data i."1 (1)
3 2 1 1 0
0$. sdata i."1 (1)
0 2 1 1 0
Shouldn't these be the same?
Thanks for any advice,
Ben
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm