1 | initial version |
if you look at those lines:
// subtract class means
for (int i = 0; i < N; i++) {
int classIdx = mapped_labels[i];
Mat instance = data.row(i);
subtract(instance, meanClass[classIdx], instance);
}
instance
is a "shallow" copy, it's data pointer points to the "enclosing" matrix, so, in fact, the whole data
matrix gets manipulated, not only instance
(again, it's NOT a deep copy)
2 | No.2 Revision |
if you look at those lines:
// subtract class means
for (int i = 0; i < N; i++) {
int classIdx = mapped_labels[i];
Mat instance = data.row(i);
subtract(instance, meanClass[classIdx], instance);
}
instance
is a "shallow" copy, it's data pointer points to the "enclosing" matrix, so, in fact, the whole data
matrix gets manipulated, not only instance
(again, it's NOT a deep copy) copy).
so, mulTransposed is applied to the "mean corrected" data matrix.