diff --git a/lib/www/server/lib/comparisons/pca.js b/lib/www/server/lib/comparisons/pca.js index f4303b0..a44de89 100644 --- a/lib/www/server/lib/comparisons/pca.js +++ b/lib/www/server/lib/comparisons/pca.js @@ -15,9 +15,12 @@ function computePCA(deviations) { // Compute mean for centering (1 x 2 matrix) const mean = math.mean(D, 0); - // Explicitly repeat mean to match D's shape (n x 2) + // Manually repeat-mean to match D's shape (n x 2) const n = deviationMatrix.length; - const meanRepeated = math.repmat(mean, n, 1); + const meanArr = mean.toArray(); + const meanRepeated = math.matrix( + Array(n).fill().map(() => [meanArr[0], meanArr[1]]) + ); // Center the data const centered = math.subtract(D, meanRepeated);