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 http://www.jsoftware.com/forums.htm
>> 
>> 
>> ---
>> This email has been checked for viruses by AVG.
>> http://www.avg.com
>> 
>> ----------------------------------------------------------------------
>> 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

Reply via email to