// svd requires rows >= columns, so transpose data if necessary
if (m_numAttributes < m_numInstances) {
m_transpose = true;
trainMatrix = trainMatrix.transpose();
}
SingularValueDecomposition trainSVD = trainMatrix.svd();
m_u = trainSVD.getU(); // left singular vectors
m_s = trainSVD.getS(); // singular values
m_v = trainSVD.getV(); // right singular vectors
// find actual rank to use