It seems that IT++ does not provide the calculation of the rank of a given mat/cmat? I would appreciate if anyone can offer some help in this matter. Many thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, I have to admit that I can't really explain this choice of tol. I simply took it from the Matlab-version of rank(). The only difference is that they use eps(max(singular_values)), which is close to eps(1)*max(singular_values), but not equal. I can't tell if this difference is important.
Sorry for not being able to help you here...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It seems that IT++ does not provide the calculation of the rank of a given mat/cmat? I would appreciate if anyone can offer some help in this matter. Many thanks.
You can perform an SVD and count the number of nonzero singular values. I took Matlab's rank function and translated it to IT++:
template <class Num_T>
int rank(const itpp::Mat<Num_T>& m, double tol = -1.0)
{
if (m.cols() == 0 || m.rows() == 0) return 0;
}
Cheers
Martin
Many thanks Martin for your help - this is very much appreciated.
Just one queston: what is the rationale for the calculation of the default tol? Why it is calculated as stated?
tol = itpp::eps * singular_values(0) * (m.rows() > m.cols() ? m.rows() : m.cols());
Thanks again.
Well, I have to admit that I can't really explain this choice of tol. I simply took it from the Matlab-version of rank(). The only difference is that they use eps(max(singular_values)), which is close to eps(1)*max(singular_values), but not equal. I can't tell if this difference is important.
Sorry for not being able to help you here...
thank you very much for your reply. it's already very helpful. thx