[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-apl] performance in of ¨

From: Xiao-Yong Jin
Subject: [Bug-apl] performance in of ¨
Date: Thu, 16 Jun 2016 17:46:05 -0500


In my script I was using ⍎¨ on a vector of character vector from each line of a 
file.  After some testing, I guess it is not really the ⍎, that is slow.  The 
time scaling is strange.

In the following, the first row and the third row (using ¨ and ⍣ respectively) 
scales like n*3, while the problem size is only n*2.  My script ends up taking 
more than a minute to read a 1000×1000 numeric matrix from a text file.  On the 
other hand, the naive {⍵+1⊣⍎v}⍣n 1 indeed scales like n*2.

In addition, gnu apl is taking nearly a gigabytes of memory to run the 
following code, while dyalog is on the order of megabytes.

  ⍎¨u 536     ⍎¨u 4129     ⍎¨u 13962  
  ⍎ v   0     ⍎ v    0     ⍎ v     0  
  ⍎u⍣ 518     ⍎u⍣ 4114     ⍎u⍣ 13889  
  ⍎v⍣  15     ⍎v⍣   58     ⍎v⍣   131  
[0]   r←te n;s;u;v;t
[1]   s←1E¯18×?n n⍴1E18
[2]   u←⍕¨⊂[2]s
[3]   v←↑u
[4]   t←⎕AI◊⊣⍎¨u◊r←(⊂'⍎¨u'),2⌷⎕AI-t
[5]   t←⎕AI◊⊣⍎v◊r←r,[.5](⊂'⍎ v'),2⌷⎕AI-t
[6]   t←⎕AI◊⊣{⍵+1⊣⍎⊃u[⍵]}⍣n 1◊r←r,[1](⊂'⍎u⍣'),2⌷⎕AI-t
[7]   t←⎕AI◊⊣{⍵+1⊣⍎v}⍣n 1◊r←r,[1](⊂'⍎v⍣'),2⌷⎕AI-t


reply via email to

[Prev in Thread] Current Thread [Next in Thread]