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
int maxSingularValues = trainSVD.rank();
for (int i = 0; i < m_s.getRowDimension(); i++) {
m_sumSquaredSingularValues += m_s.get(i, i) * m_s.get(i, i);
}
if (maxSingularValues == 0) { // no nonzero singular values (shouldn't happen)
// reset values from computation