19527: Fix odd # columns to pca.
authorTom Clegg <tom@curii.com>
Fri, 11 Nov 2022 21:04:54 +0000 (16:04 -0500)
committerTom Clegg <tom@curii.com>
Wed, 16 Nov 2022 20:23:49 +0000 (15:23 -0500)
refs #19527

Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

slicenumpy.go

index 8eaec62bb219fc07c6106a7968350f18bd67aa3c..25cd6d1c0cae7029234c6119c7415ac8ae2e5d45 100644 (file)
@@ -1187,6 +1187,10 @@ func (cmd *sliceNumpy) run(prog string, args []string, stdin io.Reader, stdout,
                                cols = (cols + 1) / 2
                                stride = stride * 2
                        }
+                       if cols%2 == 1 {
+                               // we work with pairs of columns
+                               cols++
+                       }
                        log.Printf("creating full matrix (%d rows) and training matrix (%d rows) with %d cols, stride %d", len(cmd.cgnames), cmd.trainingSetSize, cols, stride)
                        mtxFull := mat.NewDense(len(cmd.cgnames), cols, nil)
                        mtxTrain := mat.NewDense(cmd.trainingSetSize, cols, nil)