Newsgroups: comp.lang.apl
Path: watmath!watserv2.uwaterloo.ca!torn!utcsri!torsqnt!jtsv16!itcyyz!yrloc!hui
From: hui@yrloc.ipsa.reuter.COM (Roger Hui)
Subject: Re: Memory usage under J 5.1 /386 (PC)
Message-ID: <1992Sep4.064221.21148@yrloc.ipsa.reuter.COM>
Keywords: j51pc386,memory
Organization: Iverson Software Inc.
References: <695@svcs1.UUCP> <1992Sep1.170534.11574@csi.jpl.nasa.gov> <1992Sep3.035738.17663@yrloc.ipsa.reuter.COM>
Date: Fri, 4 Sep 92 06:42:21 GMT

Sam Sirlin writes:
 
> Well here are some numbers from a sun sparc:
>    7!:2 '10000$1' NB. boolean space
> 10184
>    7!:2 '10000$2' NB. integer
> 40180
>    7!:2 '10000$2.1' NB. real
> 80204
>    7!:2 '10000$_1^0.5' NB. complex
> 160508
>    7!:2 'i.10000'
> 80276
> Looks like the output of i. is real!
 
In general, i.y is (|y)$i.*/|y with axes corresponding to negative
elements in y, reversed.  As indicated in my msg of 1992-09-03 03:57:38,
that i.10000 takes 80 KB is due to the lack of special case code in 
i. for scalar y, and not to the result taking 8 bytes per element.
(This flaw has since been corrected.)
 
3!:0 is a more direct and more reliable indication of the internal type
of an array than the space it consumes.  (For example, floating point
numbers on the Macintosh can take 8, 10, or 12 bytes per element,
depending on the compiler option.)  Thus:
 
   type=.3!:0
   type 10000$1              type 2e9
1                         4
   type ?10000$2             type 3e9
1                         8
   type 2                    type 3j9
4                         16
   type 1 2 _3               type 'Opposable Thumbs'
4                         2
   type i.10000              type ;:'Opposable Thumbs'
4                         32

------------------------------------
Roger Hui, Iverson Software Inc., 33 Major Street, Toronto, Ontario  M5S 2K9
Phone: (416) 925 6096;  Fax: (416) 488 7559
