Difference between revisions of "APA"

From NARS2000
Jump to navigationJump to search
(New page: <p>So as to more efficiently represent this commonly occurring array, a new datatype — '''Arithmetic Progression Arrays''' ('''APAs''') — are created by the Index Generator...)
 
Line 1: Line 1:
 
<p>So as to more efficiently represent this commonly occurring array, a new datatype &mdash; '''Arithmetic Progression Arrays''' ('''APAs''') &mdash; are created by the [[Index Generator]] function and may be reshaped arbitrarily (as long as no replication occurs) and still retain the datatype.</p>
 
<p>So as to more efficiently represent this commonly occurring array, a new datatype &mdash; '''Arithmetic Progression Arrays''' ('''APAs''') &mdash; are created by the [[Index Generator]] function and may be reshaped arbitrarily (as long as no replication occurs) and still retain the datatype.</p>
  
<p>For example, <apll>2 3 4⍴⍳24</apll> has a very compact storage consisting of the array shape (<apll>2 3 4</apll>), the starting offset (<apll>⎕IO</apll>) and multiplier (<apll>1</apll>), plus the normal array overhead (which includes the number of elements (<apll>24</apll>)), for a total of <apll>96</apll> bytes.  This datatype is also used to store reshaped Boolean or integer scalars, as in <apll>1e6⍴12</apll> which uses <apll>80</apll> bytes (<apll>16</apll> bytes less than the preceding example because it has two fewer shape elements at eight bytes per).</p>
+
<p>For example, <apll>2 3 4⍴⍳24</apll> has a very compact storage consisting of the array shape (<apll>2 3 4</apll>), the starting offset (<apll>⎕IO</apll>) and multiplier (<apll>1</apll>), plus the normal array overhead (which includes the number of elements (<apll>24</apll>)), for a total of <apll>96</apll> bytes.  This datatype is also used to store reshaped Boolean or integer scalars, as in <apll>1e6⍴12</apll> or <apll>1e6/12</apll> both of which use <apll>80</apll> bytes (<apll>16</apll> bytes less than the preceding example because it has two fewer shape elements at eight bytes per).</p>

Revision as of 18:56, 7 May 2015

So as to more efficiently represent this commonly occurring array, a new datatype — Arithmetic Progression Arrays (APAs) — are created by the Index Generator function and may be reshaped arbitrarily (as long as no replication occurs) and still retain the datatype.

For example, 2 3 4⍴⍳24 has a very compact storage consisting of the array shape (2 3 4), the starting offset (⎕IO) and multiplier (1), plus the normal array overhead (which includes the number of elements (24)), for a total of 96 bytes. This datatype is also used to store reshaped Boolean or integer scalars, as in 1e6⍴12 or 1e6/12 both of which use 80 bytes (16 bytes less than the preceding example because it has two fewer shape elements at eight bytes per).