Fix non-existent method

This commit is contained in:
D. Berge
2025-08-19 17:20:03 +02:00
parent e95aaa7de7
commit 22c9537889

View File

@@ -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);