Make tests pass again.
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 6 Nov 2021 18:30:15 +0000 (11:30 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 6 Nov 2021 18:30:15 +0000 (11:30 -0700)
src/language/stats/matrix.c
tests/language/stats/matrix.at

index 3cdd0372073b7ddf31a3fc87de6f12ecfa71686d..ab58a51104955e97f5fe04aa1b26a071a9b2b072 100644 (file)
@@ -2443,7 +2443,7 @@ matrix_expr_evaluate_seq (gsl_matrix *start_, gsl_matrix *end_,
     }
 
   long int n = (end >= start && by > 0 ? (end - start + by) / by
-                : end < start && by < 0 ? (start - end - by) / -by
+                : end <= start && by < 0 ? (start - end - by) / -by
                 : 0);
   gsl_matrix *m = gsl_matrix_alloc (1, n);
   for (long int i = 0; i < n; i++)
index 71e8d280dc5a0d1ea7ba4605ab54becbc665ec52..154231ed3b863b3332044fc44c18dfebf5fdd74f 100644 (file)
@@ -1161,14 +1161,14 @@ AT_CHECK([pspp matrix.sps], [1], [dnl
 {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
@@ -1407,7 +1407,7 @@ dsort
   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.
@@ -1479,6 +1479,9 @@ LG10({1, 10, 100, 1000})
 LN({1, 2; 3, 4})
    .00   .69
   1.10  1.39
+
+LN(0)
+ -In
 ])
 AT_CLEANUP
 
@@ -1833,8 +1836,7 @@ SOLVE({2, 1, -1; -3, -1, 2; -2, 1, 2}, {8; -11; -3})
   -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
@@ -1935,6 +1937,21 @@ SWEEP(s1, 2)
    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
 
@@ -2502,6 +2519,10 @@ AT_CLEANUP
 
 AT_SETUP([MATRIX - READ])
 AT_DATA([matrix.txt], [dnl
+9
+8
+7
+6
 1 2 3
 4 5 6
 7 8 9
@@ -2523,6 +2544,8 @@ AT_DATA([matrix2.txt], [dnl
 ])
 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.
@@ -2544,6 +2567,12 @@ PRINT y.
 END MATRIX.
 ])
 AT_CHECK([pspp matrix.sps], [0], [dnl
+x
+  9
+  8
+  7
+  6
+
 x
   1  2  3
   4  5  6