Fix non-existent method

This commit is contained in:
D. Berge
2025-08-19 17:20:03 +02:00
parent 2fcfcb4f84
commit a3f1dd490c

View File

@@ -15,9 +15,12 @@ function computePCA(deviations) {
// Compute mean for centering (1 x 2 matrix) // Compute mean for centering (1 x 2 matrix)
const mean = math.mean(D, 0); 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 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 // Center the data
const centered = math.subtract(D, meanRepeated); const centered = math.subtract(D, meanRepeated);