{1:1:-1}
1
-matrix.sps:12: error: MATRIX: The increment operand to : must be nonzero.
+matrix.sps:15: error: MATRIX: The increment operand to : must be nonzero.
-matrix.sps:13: error: MATRIX: The increment operand to : must be nonzero.
+matrix.sps:16: error: MATRIX: The increment operand to : must be nonzero.
-matrix.sps:15: error: MATRIX: All rows in a matrix must have the same number of
+matrix.sps:18: error: MATRIX: All rows in a matrix must have the same number of
columns, but this tries to stack matrices with 2 and 1 columns.
-matrix.sps:16: error: MATRIX: All columns in a matrix must have the same number
+matrix.sps:19: error: MATRIX: All columns in a matrix must have the same number
of rows, but this tries to paste matrices with 2 and 1 rows.
])
AT_CLEANUP
1.00 3.00
matrix.sps:22: error: MATRIX: GSCH requires its argument to have at least as
-many columns as rows, but it has dimensions (2,1).
+many columns as rows, but it has dimensions 2×1.
matrix.sps:23: error: MATRIX: 2×3 argument to GSCH contains only 0 linearly
independent columns.
LN({1, 2; 3, 4})
.00 .69
1.10 1.39
+
+LN(0)
+ -In
])
AT_CLEANUP
-1.00
matrix.sps:10: error: MATRIX: SOLVE requires its arguments to have the same
-number of rows, but the first argument has dimensions (2,2) and the second
-(1,2).
+number of rows, but the first argument has dimensions 2×2 and the second 1×2.
SQRT({0, 1, 2, 3, 4, 9, 81})
.00 1.00 1.41 1.73 2.00 3.00 9.00
0 0 6 2
12 0 2 28
+SWEEP(s2, 1)
+ 0 0 0
+ 0 4 5
+ 0 7 8
+
+SWEEP(s2, 2)
+ -.7500000000 -.2500000000 .7500000000
+ .7500000000 .2500000000 1.2500000000
+ .7500000000 -1.7500000000 -.7500000000
+
+SWEEP(s2, 3)
+ -1.5000000000 -.7500000000 -.2500000000
+ -.7500000000 -.3750000000 -.6250000000
+ .7500000000 .8750000000 .1250000000
+
TRACE(s0)
68
AT_SETUP([MATRIX - READ])
AT_DATA([matrix.txt], [dnl
+9
+8
+7
+6
1 2 3
4 5 6
7 8 9
5 6
78 89
10 11
+$1 $2 3
+4 $5 6
+$1 $2 $3 4
+ $5$6 $78
+1% 2% 3% 4
+ 56% 7%8
+abcdefghijkl
+ABCDEFGHIJKL
])
AT_DATA([matrix2.txt], [dnl
2, 3, 5, 7
23, 29, 31, 37
41, 43, 47, 53
])
+AT_DATA([matrix3.txt], [dnl
+1 5
+3 1 2 3
+5 6 -1 2 5 1
+2 8 9
+3 1 3 2
+])
AT_DATA([matrix.sps], [dnl
MATRIX.
+READ x/FILE='matrix.txt'/SIZE=4/FIELD=1 TO 1.
+PRINT x.
READ x/FILE='matrix.txt'/SIZE={3,3}/FIELD=1 TO 80.
PRINT x.
READ x/SIZE={2,4}/FIELD=1 TO 80.
READ x/SIZE={2,6}/FIELD=1 TO 20 BY 5.
PRINT x.
+READ x/SIZE={2,3}/FIELD=1 TO 20/FORMAT=DOLLAR.
+PRINT x.
+READ x/SIZE={2,4}/FIELD=1 TO 20/FORMAT=DOLLAR5.1.
+PRINT x.
+READ x/SIZE={2,4}/FIELD=1 TO 12/FORMAT='4PCT'.
+PRINT x.
+READ x/SIZE={2,4}/FIELD=1 TO 12/FORMAT='4A'.
+PRINT x/FORMAT=A3.
COMPUTE y={}.
LOOP IF NOT EOF('matrix2.txt').
COMPUTE y={y; x}.
END LOOP.
PRINT y.
+
+COMPUTE m = MAKE(5, 5, 0).
+LOOP i = 1 TO 5.
+READ count /FILE='matrix3.txt' /FIELD=1 TO 1 /SIZE=1.
+READ m(i, 1:count) /FIELD=3 TO 100 /REREAD.
+END LOOP.
+PRINT m.
END MATRIX.
])
AT_CHECK([pspp matrix.sps], [0], [dnl
+x
+ 9
+ 8
+ 7
+ 6
+
x
1 2 3
4 5 6
1 2 3 4 5 6
7 8 8 9 10 11
+x
+ 1 2 3
+ 4 5 6
+
+x
+ 1 2 3 4
+ 5 6 7 8
+
+x
+ 1 2 3 4
+ 5 6 7 8
+
+x
+ abc def ghi jkl
+ ABC DEF GHI JKL
+
y
2 3 5 7
11 13 17 19
23 29 31 37
41 43 47 53
+
+m
+ 5 0 0 0 0
+ 1 2 3 0 0
+ 6 -1 2 5 1
+ 8 9 0 0 0
+ 1 3 2 0 0
+])
+AT_CLEANUP
+
+AT_SETUP([MATRIX - READ - negative])
+AT_DATA([matrix.sps], [dnl
+MATRIX.
+READ !.
+READ x/FILE=!.
+READ x/ENCODING=!.
+READ x/FIELD=!.
+READ x/FIELD=1 !.
+READ x/FIELD=1 TO !.
+READ x/FIELD=1 TO 0.
+READ x/FIELD=1 TO 10 BY !.
+READ x/FIELD=1 TO 10 BY 6.
+READ x/SIZE=!.
+READ x/MODE=!.
+READ x/FORMAT=!.
+READ x/FORMAT=F8.2/FORMAT=F8.2.
+READ x/FORMAT='5XYZZY'.
+READ x/FORMAT=XYZZY.
+READ x/!.
+READ x.
+READ x/FIELD=1 TO 10.
+READ x/FIELD=1 TO 10/SIZE={1,2}.
+READ x/FIELD=1 TO 10/SIZE={1,2}/FILE='xyzzy.txt'/FORMAT='15F'.
+READ x/FIELD=1 TO 10 BY 2/SIZE={1,2}/FILE='xyzzy.txt'/FORMAT=F5.
+READ x/FIELD=1 TO 10 BY 2/SIZE={1,2}/FILE='xyzzy.txt'/FORMAT='2F'.
+READ x/FIELD=1 TO 10/SIZE={1,2;3,4}/FILE='matrix.txt'.
+READ x/FIELD=1 TO 10/SIZE={1,2,3}/FILE='matrix.txt'.
+READ x/FIELD=1 TO 10/SIZE={-1}/FILE='matrix.txt'.
+COMPUTE x={1,2,3}.
+READ x(:,:)/FIELD=1 TO 10/SIZE={2,2}/FILE='matrix.txt'.
+READ x/FIELD=1 TO 10/SIZE={1,3}/FILE='matrix.txt'/MODE=SYMMETRIC.
+READ x/FIELD=1 TO 10/SIZE=2/FILE='matrix.txt'.
+END MATRIX.
+])
+AT_DATA([matrix.txt], [dnl
+xyzzy
+.
+])
+AT_CHECK([pspp matrix.sps], [1], [dnl
+matrix.sps:2.6: error: READ: Syntax error at `!': expecting identifier.
+
+matrix.sps:3.13: error: READ: Syntax error at `!': expecting a file name or
+handle name.
+
+matrix.sps:4.17: error: READ: Syntax error at `!': expecting string.
+
+matrix.sps:5.14: error: READ: Syntax error at `!': Expected positive integer
+for FIELD.
+
+matrix.sps:6.16: error: READ: Syntax error at `!': expecting `TO'.
+
+matrix.sps:7.19: error: READ: Syntax error at `!': Expected positive integer
+for TO.
+
+matrix.sps:8.19: error: READ: Syntax error at `0': Expected positive integer
+for TO.
+
+matrix.sps:9.25: error: READ: Syntax error at `!': Expected integer between 1
+and 10 for BY.
+
+matrix.sps:10: error: READ: BY 6 does not evenly divide record width 10.
+
+matrix.sps:11.13: error: READ: Syntax error at `!'.
+
+matrix.sps:12.13: error: READ: Syntax error at `!': expecting RECTANGULAR or
+SYMMETRIC.
+
+matrix.sps:13.15: error: READ: Syntax error at `!': expecting identifier.
+
+matrix.sps:14: error: READ: Subcommand FORMAT may only be specified once.
+
+matrix.sps:15.15-15.22: error: READ: Syntax error at `'5XYZZY'': Unknown format
+XYZZY.
+
+matrix.sps:16: error: READ: Unknown format type `XYZZY'.
+
+matrix.sps:17.8: error: READ: Syntax error at `!': expecting FILE, FIELD, MODE,
+REREAD, or FORMAT.
+
+matrix.sps:18: error: READ: Required subcommand FIELD was not specified.
+
+matrix.sps:19: error: READ: SIZE is required for reading data into a full
+matrix (as opposed to a submatrix).
+
+matrix.sps:20: error: READ: Required subcommand FILE was not specified.
+
+matrix.sps:21: error: READ: 15 repetitions cannot fit in record width 10.
+
+matrix.sps:22: error: READ: FORMAT specifies field width 5 but BY specifies 2.
+
+matrix.sps:23: error: READ: FORMAT specifies 2 repetitions with record width
+10, which implies field width 5, but BY specifies field width 2.
+
+matrix.sps:24: error: MATRIX: SIZE must evaluate to a scalar or a 2-element
+vector, not a 2×2 matrix.
+
+matrix.sps:25: error: MATRIX: SIZE must evaluate to a scalar or a 2-element
+vector, not a 1×3 matrix.
+
+matrix.sps:26: error: MATRIX: Matrix dimensions -1×1 specified on SIZE are
+outside valid range.
+
+matrix.sps:28: error: MATRIX: Matrix dimensions 2×2 specified on SIZE differ
+from submatrix dimensions 1×3.
+
+matrix.sps:29: error: MATRIX: Cannot read non-square 1×3 matrix using READ with
+MODE=SYMMETRIC.
+
+matrix.txt:1.1-1.4: warning: Error reading "xyzzy" as format F for matrix row
+1, column 1: Field contents are not numeric.
+
+matrix.txt:2.1: warning: Error reading "." as format F for matrix row 2, column
+1: Matrix data may not contain missing value.
+])
+AT_CLEANUP
+
+AT_SETUP([MATRIX - WRITE])
+AT_DATA([matrix.sps], [dnl
+MATRIX.
+WRITE {1.5, 2; 3, 4.12345}/OUTFILE='matrix.txt'/FIELD=1 TO 80.
+WRITE {1.5, 2; 3, 4.12345}/OUTFILE='matrix.txt'/FIELD=1 TO 5.
+WRITE {1, 2; 3, 4}/OUTFILE='matrix.txt'/FIELD=1 TO 80 BY 5.
+WRITE {1, 2; 3, 4}/OUTFILE='matrix.txt'/FIELD=1 TO 80/FORMAT=F8.2.
+WRITE {1, 2; 3, 4}/OUTFILE='matrix.txt'/FIELD=1 TO 80/FORMAT=E.
+WRITE {1, 2; 3, 4}/OUTFILE='matrix.txt'/FIELD=1 TO 10 BY 10/FORMAT=E.
+WRITE "abcdefhi"/OUTFILE='matrix.txt'/FIELD=1 TO 80/FORMAT=A8.
+WRITE "abcdefhi"/OUTFILE='matrix.txt'/FIELD=1 TO 80/FORMAT=A4.
+WRITE "abcdefhi"/OUTFILE='matrix.txt'/FIELD=1 TO 80/FORMAT=AHEX12.
+END MATRIX.
+])
+AT_CHECK([pspp matrix.sps])
+AT_CHECK([cat matrix.txt], [0], [dnl
+ 1.5 2
+ 3 4.12345
+ 1.5 2
+ 3
+ 4.12345
+ 1 2
+ 3 4
+ 1.00 2.00
+ 3.00 4.00
+ 1 2
+ 3 4
+ 1.E+000
+ 2.E+000
+ 3.E+000
+ 4.E+000
+ abcdefhi
+ abcd
+ 616263646566
+])
+AT_CLEANUP
+
+AT_SETUP([MATRIX - WRITE - negative])
+AT_DATA([matrix.sps], [dnl
+MATRIX.
+WRITE !.
+WRITE 1/OUTFILE=!.
+WRITE 1/ENCODING=!.
+WRITE 1/FIELD=!.
+WRITE 1/FIELD=1 !.
+WRITE 1/FIELD=1 TO 0.
+WRITE 1/FIELD=1 TO 10 BY 20.
+WRITE 1/FIELD=1 TO 10 BY 6.
+WRITE 1/MODE=TRAPEZOIDAL.
+WRITE 1/FORMAT=F5/FORMAT=F5.
+WRITE 1/FORMAT='5ASDF'.
+WRITE 1/FORMAT=ASDF5.
+WRITE 1/!.
+WRITE 1.
+WRITE 1/FIELD=1 TO 10.
+WRITE 1/FIELD=1 TO 10/OUTFILE='matrix.txt'/FORMAT='15F'.
+WRITE 1/FIELD=1 TO 10 BY 5/OUTFILE='matrix.txt'/FORMAT='5F'.
+WRITE 1/FIELD=1 TO 10 BY 5/OUTFILE='matrix.txt'/FORMAT=E.
+WRITE 1/FIELD=1 TO 10/OUTFILE='matrix.txt'/FORMAT=A9.
+WRITE {1,2}/FIELD=1 TO 10/OUTFILE='matrix.txt'/MODE=TRIANGULAR.
+END MATRIX.
+])
+AT_CHECK([pspp matrix.sps], [1], [dnl
+matrix.sps:2.7: error: WRITE: Syntax error at `!'.
+
+matrix.sps:3.17: error: WRITE: Syntax error at `!': expecting a file name or
+handle name.
+
+matrix.sps:4.18: error: WRITE: Syntax error at `!': expecting string.
+
+matrix.sps:5.15: error: WRITE: Syntax error at `!': Expected positive integer
+for FIELD.
+
+matrix.sps:6.17: error: WRITE: Syntax error at `!': expecting `TO'.
+
+matrix.sps:7.20: error: WRITE: Syntax error at `0': Expected positive integer
+for TO.
+
+matrix.sps:8.26-8.27: error: WRITE: Syntax error at `20': Expected integer
+between 1 and 10 for BY.
+
+matrix.sps:9: error: WRITE: BY 6 does not evenly divide record width 10.
+
+matrix.sps:10.14-10.24: error: WRITE: Syntax error at `TRAPEZOIDAL': expecting
+RECTANGULAR or TRIANGULAR.
+
+matrix.sps:11: error: WRITE: Subcommand FORMAT may only be specified once.
+
+matrix.sps:12.16-12.22: error: WRITE: Syntax error at `'5ASDF'': Unknown format
+ASDF.
+
+matrix.sps:13: error: WRITE: Unknown format type `ASDF'.
+
+matrix.sps:14.9: error: WRITE: Syntax error at `!': expecting OUTFILE, FIELD,
+MODE, HOLD, or FORMAT.
+
+matrix.sps:15: error: WRITE: Required subcommand FIELD was not specified.
+
+matrix.sps:16: error: WRITE: Required subcommand OUTFILE was not specified.
+
+matrix.sps:17: error: WRITE: 15 repetitions cannot fit in record width 10.
+
+matrix.sps:18: error: WRITE: FORMAT specifies 5 repetitions with record width
+10, which implies field width 2, but BY specifies field width 5.
+
+matrix.sps:19: error: WRITE: Output format E5.0 specifies width 5, but E
+requires a width between 6 and 40.
+
+matrix.sps:20: error: WRITE: Format A9 is too wide for 8-byte matrix eleemnts.
+
+matrix.sps:21: error: MATRIX: WRITE with MODE=TRIANGULAR requires a square
+matrix but the matrix to be written has dimensions 1×2.
+])
+AT_CLEANUP
+
+AT_SETUP([MATRIX - GET])
+AT_DATA([matrix.sps], [dnl
+DATA LIST LIST NOTABLE /a b c.
+MISSING VALUES a(1) b(5).
+BEGIN DATA.
+0 0 0
+1 2 3
+4 5 6
+7 8 .
+END DATA.
+
+MATRIX.
+GET x0 /NAMES=names0.
+PRINT x0.
+PRINT names0/FORMAT=A8.
+END MATRIX.
+
+MATRIX.
+GET x1 /VARIABLES=a b c /NAMES=names1 /MISSING=OMIT.
+PRINT x1.
+PRINT names1/FORMAT=A8.
+END MATRIX.
+
+MATRIX.
+GET x2 /VARIABLES=a b /NAMES=names2 /MISSING=OMIT.
+PRINT x2.
+PRINT names2/FORMAT=A8.
+END MATRIX.
+
+MATRIX.
+GET x3 /FILE=* /VARIABLES=a b c /NAMES=names3 /MISSING=5.
+PRINT x3.
+PRINT names3/FORMAT=A8.
+END MATRIX.
+
+MATRIX.
+GET x4 /FILE=* /VARIABLES=a b /NAMES=names4 /MISSING=5.
+PRINT x4.
+PRINT names4/FORMAT=A8.
+END MATRIX.
+
+SAVE OUTFILE='matrix.sav'.
+NEW FILE.
+
+MATRIX.
+GET x5 /FILE='matrix.sav' /VARIABLES=a b c /NAMES=names5 /MISSING=ACCEPT.
+PRINT x5.
+PRINT names5/FORMAT=A8.
+END MATRIX.
+
+MATRIX.
+GET x6 /FILE='matrix.sav' /VARIABLES=a b c /NAMES=names6 /MISSING=ACCEPT /SYSMIS=9.
+PRINT x6.
+PRINT names6/FORMAT=A8.
+END MATRIX.
+
+MATRIX.
+GET x7 /FILE='matrix.sav' /VARIABLES=a b c /NAMES=names7 /MISSING=ACCEPT /SYSMIS=OMIT.
+PRINT x7.
+PRINT names7/FORMAT=A8.
+END MATRIX.
+])
+AT_CHECK([pspp matrix.sps], [1], [dnl
+matrix.sps:11: error: MATRIX: GET: Variable a in case 2 has user-missing value
+1.
+
+matrix.sps:12: error: MATRIX: Uninitialized variable x0 used in expression.
+
+names0
+ a
+ b
+ c
+
+matrix.sps:17: error: MATRIX: GET: Variable c in case 4 is system-missing.
+
+matrix.sps:18: error: MATRIX: Uninitialized variable x1 used in expression.
+
+names1
+ a
+ b
+ c
+
+x2
+ 0 0
+ 7 8
+
+names2
+ a
+ b
+
+matrix.sps:29: error: MATRIX: GET: Variable c in case 4 is system-missing.
+
+matrix.sps:30: error: MATRIX: Uninitialized variable x3 used in expression.
+
+names3
+ a
+ b
+ c
+
+x4
+ 0 0
+ 5 2
+ 4 5
+ 7 8
+
+names4
+ a
+ b
+
+matrix.sps:44: error: MATRIX: GET: Variable c in case 4 is system-missing.
+
+matrix.sps:45: error: MATRIX: Uninitialized variable x5 used in expression.
+
+names5
+ a
+ b
+ c
+
+x6
+ 0 0 0
+ 1 2 3
+ 4 5 6
+ 7 8 9
+
+names6
+ a
+ b
+ c
+
+x7
+ 0 0 0
+ 1 2 3
+ 4 5 6
+
+names7
+ a
+ b
+ c
])
AT_CLEANUP
+
+AT_SETUP([MATRIX - GET - negative])
+AT_DATA([matrix.sps], [dnl
+DATA LIST LIST NOTABLE /a b c * d(a1).
+MISSING VALUES a(1) b(5).
+BEGIN DATA.
+0 0 0 a
+1 2 3 b
+4 5 6 b
+7 8 . d
+END DATA.
+SAVE OUTFILE='matrix.sav'.
+
+MATRIX.
+GET !.
+GET x/VARIABLES=!.
+GET x/FILE=!.
+GET x/ENCODING=!.
+GET x/NAMES=!.
+GET x/MISSING=!.
+GET x/SYSMIS=!.
+GET x/!.
+GET x/VARIABLES=!.
+GET x/VARIABLES=x TO !.
+GET x/VARIABLES=x.
+GET x/VARIABLES=c TO a.
+GET x/VARIABLES=d.
+GET x.
+END MATRIX.
+
+NEW FILE.
+MATRIX.
+GET x/VARIABLES=a.
+END MATRIX.
+])
+AT_CHECK([pspp matrix.sps], [1], [dnl
+matrix.sps:12.5: error: GET: Syntax error at `!': expecting identifier.
+
+matrix.sps:13.17: error: GET: Syntax error at `!': expecting variable name.
+
+matrix.sps:14.12: error: GET: Syntax error at `!': expecting a file name or
+handle name.
+
+matrix.sps:15.16: error: GET: Syntax error at `!': expecting string.
+
+matrix.sps:16.13: error: GET: Syntax error at `!': expecting identifier.
+
+matrix.sps:17.15: error: GET: Syntax error at `!'.
+
+matrix.sps:18.14: error: GET: Syntax error at `!'.
+
+matrix.sps:19.7: error: GET: Syntax error at `!': expecting FILE, VARIABLES,
+NAMES, MISSING, or SYSMIS.
+
+matrix.sps:20.17: error: GET: Syntax error at `!': expecting variable name.
+
+matrix.sps:21.22: error: GET: Syntax error at `!': expecting variable name.
+
+matrix.sps:22: error: MATRIX: x is not a variable name.
+
+matrix.sps:23: error: MATRIX: c TO a is not valid syntax since c precedes a in
+the dictionary.
+
+matrix.sps:24: warning: MATRIX: d is not a numeric variable.
+
+matrix.sps:25: error: MATRIX: GET: Variable d is not numeric.
+
+error: GET cannot read empty active file.
+])
+AT_CLEANUP
+
+AT_SETUP([MATRIX - SAVE])
+AT_DATA([matrix.sps], [dnl
+MATRIX.
+SAVE {1,2,3; 4,5,6}/OUTFILE='matrix.sav'.
+SAVE {7,8,9}/VARIABLES=a b c d.
+
+SAVE {1,2,3}/OUTFILE='matrix2.sav'/VARIABLES=v01 TO v03.
+SAVE {4,5,6}/NAMES={'x', 'y', 'z', 'w'}.
+
+SAVE {1,'abcd',3}/OUTFILE='matrix3.sav'/NAMES={'a', 'b', 'c'}/STRINGS=b.
+SAVE {4,'xyzw',6}/STRINGS=a, b.
+END MATRIX.
+])
+AT_CHECK([pspp matrix.sps])
+AT_CHECK([pspp-convert matrix.sav matrix.csv && cat matrix.csv], [0], [dnl
+COL1,COL2,COL3
+1,2,3
+4,5,6
+7,8,9
+])
+AT_CHECK([pspp-convert matrix2.sav matrix2.csv && cat matrix2.csv], [0], [dnl
+v01,v02,v03
+1,2,3
+4,5,6
+])
+AT_CHECK([pspp-convert matrix3.sav matrix3.csv && cat matrix3.csv], [0], [dnl
+a,b,c
+1,abcd,3
+4,xyzw,6
+])
+AT_CLEANUP
\ No newline at end of file