Oops, it's obvious why that version was bulkier.

That said, this is much slower, for little advantage:

    timespacex'|. 281474976710656&|@*/&.x:\.1+2*i.-2^12'
8.45755 1.08915e6

I'll stick with my genseries proposal, I think.

Thanks,

-- 
Raul


On Tue, May 16, 2017 at 12:04 PM, Raul Miller <[email protected]> wrote:
> Oops, need x: instead of <.
>
>    |. 281474976710656&|@*/\.x:1+2*i.-2^24
>
> Sorry about that, was using <. earlier to test whether that fixed the
> overflow issue (it does not), and grabbed that instance for this
> variant.
>
> This is bulkier, though, just like your */\ version:
>
>     timespacex'|. 281474976710656&|@*/\.x:1+2*i.-2^12'
> 0.005394 2.72333e6
>     datatype |. 281474976710656&|@*/\.x:1+2*i.-2^12
> extended
>
> And if I could think of an efficient way of demoting the result type
> to integer, I think I could use that reduce some of the bulk.
>
> Sadly, though, the obvious approach doesn't do it:
>
>     timespacex'|. 281474976710656&|@*/\.&.x:1+2*i.-2^12'
> 0.004687 2.65882e6
>
> Still... why not break this into pieces?
>
> Something like (warning, untested code):
>
> genseries=:3 :0
>   r=. ''
>   n=.1
>   for. i.2^6 do.
>     r=. r,|. 281474976710656&|@*/\.&.x:n+2*i.-2^18
>     n=. {:r
>   end.
>   r
> )
>
> Thanks,
>
> --
> Raul
>
> On Tue, May 16, 2017 at 11:38 AM, 'Mike Day' via Programming
> <[email protected]> wrote:
>> It would be nice if it worked.
>>
>> Unfortunately (again!),  for the actual size required,
>>
>>    timer'_10{. |. 281474976710656&|@*/\.<.1+2*i.-2^24'
>> +------+-------------------+
>> |32.001|0 0 0 0 0 0 0 0 0 0|
>> +------+-------------------+
>>
>> whereas the correct values are all > 0
>>
>> This is why I needed special code, either using extended
>> integers and then making the results simple 64-bit integer,
>> or using a mask and shift method and working on 24-bit
>> components.
>>
>> Pity!
>>
>> Thanks,
>>
>> Mike
>>
>> On 16/05/2017 15:42, Raul Miller wrote:
>>>
>>>     timespacex'|. 281474976710656&|@*/\.<.1+2*i.-2^12'
>>> 0.00096 331904
>>>     (281474976710656&|@*/\x:1+2*i.2^5) -: |.
>>> 281474976710656&|@*/\.<.1+2*i.-2^5
>>> 1
>>>
>>> I hope this helps,
>>>
>>
>>
>> ---
>> This email has been checked for viruses by Avast antivirus software.
>> https://www.avast.com/antivirus
>>
>> ----------------------------------------------------------------------
>> 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