|
From: Kakhkhor A. <kab...@gm...> - 2010-11-02 23:44:13
|
Hi. Similar problem in SVD::solveFor. It uses all singular values to
compute matrix pseudo-inverse. Insignificant singular values should be
dropped. Quick fix:
Disposable<Array> SVD::solveFor(const Array& b) const{
Matrix W(n_, n_, 0.0);
Size numericalRank = this->rank();
for (Size i=0; i<numericalRank; i++)
W[i][i] = 1./s_[i];
Matrix inverse = V()* W * transpose(U());
Array result = inverse * b;
return result;
}
Also, in SVD::rank implementation we could replace
Real eps = std::pow(2.0,-52.0);
with
Real eps = QL_EPSILON.
Regards,
Kakhkhor Abdijalilov.
|