There is an excellent development of sparse arrays in LJ or "Learning J"

help>vocabulary>LJ  gets you to the book.  Scroll down to the "index" and 
select "s" and from all the s's select "sparse arrays"

  
Often this book will help you if you want and explanation of something you know 
in English, but you can't find the name for it in J.

Linda


-----Original Message-----
From: Programming [mailto:[email protected]] On Behalf 
Of robert therriault
Sent: Wednesday, December 20, 2017 6:31 PM
To: [email protected]
Subject: Re: [Jprogramming] sparse negative take

Henry,

With further thought, I suppose that what is happening is that the array 
remains a sparse type and that the indices now reflect the new shape after the 
selection. Which does make sense when I think about it, but I guess I had it in 
my mind that the indices would remain attached to the values and not be 
recalculated. At least this is the way that I view this at the moment and look 
forward to being corrected if I am mistaken.

Cheers, bob

> On Dec 20, 2017, at 3:22 PM, robert therriault <[email protected]> wrote:
> 
> Henry,
> 
> I think Brian may be referring to the indices shown in the sparse 
> representation.
> 
>   t=: $. 0 0 1 0 2.5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 999 _ 0 0 0
>   t  NB. Index values as expected
> 2 │   1
> 4 │ 2.5
> 19 │   2
> 21 │ 999
> 22 │   _
>   _5{. t  NB. I would have expected 21 and 22 to match the values in 
> the original
> 0 │ 999
> 1 │   _
>   5 {. t
> 2 │   1
> 4 │ 2.5
>   19 { t
> 2
>   5 {. 20}.t  NB. It looks like it is reindexing after dropping the 
> first 20 values
> 1 │ 999
> 2 │   _
> 
> Cheers, bob
> 
>> On Dec 20, 2017, at 3:06 PM, Henry Rich <[email protected]> wrote:
>> 
>> No, _5 {. z has shape 5.
>> 
>> Henry Rich
>> 
>> On 12/20/2017 6:04 PM, Brian Schott wrote:
>>> Negative take seems screwy.
>>> 
>>>   $ y=: 0 0 1 0 2.5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 999 _ 0 0 0
>>> 26
>>>   _5{.  z         NB. Should the 0 and 1 be large numbers?
>>> 0 │ 999
>>> 1 │   _
>>>   5{.  z
>>> 2 │   1
>>> 4 │ 2.5
>>> 
>>> 
>>> --
>>> --------------------------------------------------------------------
>>> -- For information about J forums see 
>>> https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww
>>> .jsoftware.com%2Fforums.htm&data=02%7C01%7C%7Cddd8d5bc482d4f24059b08
>>> d54801ce27%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636494094942
>>> 301626&sdata=yXvrjKtDZESDXY9rEvITVvt277SMZFmXgS6MAZPblP0%3D&reserved
>>> =0
>> 
>> 
>> ---
>> This email has been checked for viruses by AVG.
>> https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.
>> avg.com&data=02%7C01%7C%7Cddd8d5bc482d4f24059b08d54801ce27%7C84df9e7f
>> e9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636494094942301626&sdata=AOEHNfocJ
>> aD7y9J4xLPGlsK7QxoW%2BigYL5HRUEK4TTk%3D&reserved=0
>> 
>> ---------------------------------------------------------------------
>> - For information about J forums see 
>> https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.
>> jsoftware.com%2Fforums.htm&data=02%7C01%7C%7Cddd8d5bc482d4f24059b08d5
>> 4801ce27%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636494094942301
>> 626&sdata=yXvrjKtDZESDXY9rEvITVvt277SMZFmXgS6MAZPblP0%3D&reserved=0
> 
> ----------------------------------------------------------------------
> For information about J forums see 
> https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.j
> software.com%2Fforums.htm&data=02%7C01%7C%7Cddd8d5bc482d4f24059b08d548
> 01ce27%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636494094942301626
> &sdata=yXvrjKtDZESDXY9rEvITVvt277SMZFmXgS6MAZPblP0%3D&reserved=0

----------------------------------------------------------------------
For information about J forums see 
https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7Cddd8d5bc482d4f24059b08d54801ce27%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636494094942301626&sdata=yXvrjKtDZESDXY9rEvITVvt277SMZFmXgS6MAZPblP0%3D&reserved=0
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to