File: dump.usg

package info (click to toggle)
maxima 5.49.0-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 128,980 kB
  • sloc: lisp: 437,854; fortran: 14,665; tcl: 10,143; sh: 4,598; makefile: 2,204; ansic: 447; java: 374; python: 262; perl: 201; xml: 60; awk: 28; sed: 15; javascript: 2
file content (31 lines) | stat: -rw-r--r-- 942 bytes parent folder | download | duplicates (21)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
To efficiently save and load number arrays do:

LOAD(DUMP);
DUMPARRAYS([<filespec>],<arrays>); to save them
and 
LOADARRAYS(<filespec>); to load them back in.

the arrays must be number arrays. i.e. as produced by 
ARRAY(<arrayname>,INTEGER, .. ); or ARRAY(<arrayname>,FLOAT, .. );

the defaulting of <filepsec> is identical to the SAVE and LOADFILE
commands.  e.g. DUMPARRAYS(<arrays>); dumps them in the default file.

example:
LOAD(DUMP);
ARRAY(FOO,FLOAT,2,3,4);
FOO[1,2,3]:EV(%PI,NUMER);
ARRAY(BAR,INTEGER,20);
FOR I FROM 1 THRU 20 DO BAR[I]:I;
DUMPARRAYS([ARRAYS],FOO,BAR); saves FOO and BAR into the file ARRAYS.

In a fresh MACSYMA,
LOAD(DUMP);
LOADARRAYS(ARRAYS);
BAR[5]; ==> 5
FOO[1,2,3]; ==> 3.14159..

The amount of room occupied by these files is roughly 1/2 of what
is needed when saving the arrays using the SAVE command.  More
importantly it doesn't require chunks of FLONUM or FIXNUM space as
the SAVE command sometimes does.