Ask Your Question

Revision history [back]

click to hide/show revision 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)

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.