Thu, 19 Sep 1996 13:52:32                           comp.lang.apl                                 Thread    1 of    8
Lines 33                                       Performance problem                                No responses
mslamm@pluto.mscc.huji.ac.il                                          Zvi Lamm at Hebrew University, Jeruslem, Israel


Trying to find a good way to solve the problem of Karnaugh Maps I wrote about,
I wanted to produce a list of all infix square shaped arrays of a matrix.
This problem isn't so new, and I quickly found the following way to do what
I wanted.

  upto=.i.@>:
  Squares=. ([;._3)"(1 _)               NB. All infix squares of given size
  side=. 1&$@$                          NB. Argument axis shape
  All=. (upto,.upto)@side Squares [     NB. All squares of all lengths


However this was VEREY slow... For a 4*4 array it took enough time to be
noticed.


I noticed that if I changed Squares like this:
Squares=. (<;._3)"(1 _)               NB. All infix squares of given size

the computation was MUCH quicker.  I realize that the need to conform the
resulting arrays can be time consuming - but this seems to much.

I am using J2. Was this performance problem fixed?

More generally, can we conclude that as a general rule one should try to
use boxed arrays inorder to speed things up??





--
Ehud Lamm     mslamm@pluto.mscc.huji.ac.il
