-1

I have an old APL application that runs on DOS that performs FFT and IFFT. It generates a rank limit error on GNU APL. With a workspace of 55 GB there should be no limit on rank or symbols. The only limit that makes sense is a user settable workspace size limit so we don't max out the memory on a 64-bit machine.

To test this, one can observe that a←(n⍴2)⍴2 fails with n>8 on GNU APL 64 bit whereas a 16 bit APL for DOS runs until out of memory.

Is there a way to change the rank limit?

Adám
  • 6,573
  • 20
  • 37
MLS
  • 41
  • 1

1 Answers1

2

The default the rank limit is indeed 8, but can be configured using the MAX_RANK configuration parameter. You can either use a GNU APL configuration file to do so, or simply use a command line parameter, e.g. MAX_RANK=64.

By the way, all APL implementations I know of have a max rank, and I believe your old DOS APL has such a limit too, only that you happen to run out of memory before you hit it, due to all axes doubling the number of elements (and the elements being at least one byte each) when you do a←(n⍴2)⍴2. Try a←(n⍴1)⍴2 which doesn't add additional elements, and you're likely to find that the maximum rank is 15 or 63 or something like that.

Adám
  • 6,573
  • 20
  • 37
  • I found that the parameter is called MAX_RANK_WANTED. It can be viewed with the command line parameter --cfg but no command line parameter can change it. My DOS version of APL has a rank limit of 63. To change the rank limit may require recompiling because there is no configuration file that I can find. The Windows version of GNU APL I am running was compiled by the author on CYGWIN which I do not have. – MLS Dec 21 '22 at 18:05
  • I downloaded Dyalog APL which has a rank limit of 15. This is still not enough. Is there a way to change the rank limit on Dyalog? – MLS Dec 21 '22 at 18:10
  • @MLS No, Dyalog's MAX_RANK cannot be changed, as it'd require major interpreter changes to increase that. I'm curious what algorithm is hitting the 15 limit. [Here are](https://aplcart.info/?q=fft%20%E2%88%87) implementations of FFT and IFFT that don't hit it and [this library](https://github.com/Dyalog/math) uses FFTW for optimal speed. If you follow the instructions [here](https://aplwiki.com/wiki/APL_Orchard#Access), you can get access to the Stack Exchange APL chat room, so we can discuss. – Adám Dec 22 '22 at 07:24
  • With some help I got GNU APL64 compiled on a linux machine. In the compile process we set the rank limit to 256. This is probably over-kill but it works. The FFT IFFT I have uses a rank that is 2+log-base-2 of the length of the FFT argument. So 63 is probably all anyone would ever use. But a limit of 15 limits me to a 8192 length FFT on Dyalog. The FFT IFFT was written by Professor Paul Penfield at MIT back in the 70's and was optimized for speed at the time. The original APL had all primitives coded in assembly so it was very fast. – MLS Dec 23 '22 at 18:00