To be clear, I made a total task of all the actions to see what the time
consuming part was. That happened to be (of course) the converting part.
So I made a faster converter.
What exactly do you want as output?
Do you want something like
(#~G )ips
1590633180 365671447 69450821 _1260155495 _867958750 574796455 329735247
....
selecting where G has a one?
So in the meantime reading/converting and verb f are optimized.
On 14-12-11 17:10, Alexander Epifanov wrote:
> How is it possible to output G without inlined array?
> The same question is for boxed view: 5!:2<'F' - it does not possible
> to read, because it looks like ----------------...
> | ||_2147483648 197014786 890854407 1006423136 1685034722 1956788740
> 2040340624
> 2099004718 2108694720 2121608906 2123216303 2123418208 2124269825 2124437712
> 212
> 5836382|+-+-+|+-----------------------------------------------------------------
> ----------------...
>
> Thank you,
>
> On Wed, Dec 14, 2011 at 5:04 PM, Aai<[email protected]> wrote:
>> Using Raul's G total timing becomes
>>
>> ts 'P=.task 0'
>> 5.68436 1.17707e8
>> P-:Q
>> 1
>>
>> FYI
>>
>>
>>
>> On 14-12-11 15:39, I wrote:
>>> Here's a first speedup:
>>>
>>> ( thanks Dan: (OLD&=)`(,:&NEW) } )
>>>
>>> timing of your program:
>>>
>>> ts 'Q=.AE 0'
>>> 30.4894 1.05856e8
>>>
>>>
>>> speedup by converter makeNum
>>>
>>>
>>> ts 'P=.task 0'
>>> 5.79403 1.17706e8
>>>
>>> P-:Q
>>> 1
>>>
>>> makeNum=: 256 #. 128 0 0 0 -"1~ [: ". =&'.'`(,:&' ')}
>>>
>>> task=: 3 :0
>>> IP=. }:;._2 (1!:1<fips)
>>> IPR=. }:;._2 (1!:1< fiprs)
>>> ips=. makeNum IP
>>> 'a b c'=. |: ;:"1 IPR
>>> a =. makeNum a
>>> c =. makeNum c
>>> 'l r'=._1 0+ (/:{."1)&. |:a,:c
>>> m =. (pip'0.0.0.0'),(1+>./ @: {.&r)"0 (1+i.#l)
>>> f =.< m {~ I.~&l
>>> f"1 ips
>>> )
>>>
>>> ===============
>>> Your program
>>> ===============
>>> pip =: (256 #. (-&128 @: {.) , }.) @: (".;._2@:,&'.')
>>>
>>> AE=: 3 :0
>>> ips =. pip"1 (_1&}.;._2 (1!:1<fips))
>>> iprs =. |:pip;._1 "1 (','&,)"1 (_1&}.;._2 (1!:1<fiprs))
>>> i =. /:{.iprs
>>> l =. _1+ i{{.iprs
>>> r =. i{{:iprs
>>> m =. (pip'0.0.0.0'),(1+>./ @: {.&r)"0 (1+i.#l)
>>> NB. m =: __,(1+>./ @: {.&r)"0 (1+i.#l)
>>> f =.< m {~ I.~&l
>>> f"1 ips
>>> )
>>>
>> --
>> Met vriendelijke groet,
>> @@i = Arie Groeneveld
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
--
Met vriendelijke groet,
@@i = Arie Groeneveld
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm