Posted by
Kakhkhor Abdijalilov on
URL: http://quantlib.414.s1.nabble.com/Longstaff-Schwartz-method-SVD-and-OLS-tp8855p8862.html
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.
------------------------------------------------------------------------------
Achieve Improved Network Security with IP and DNS Reputation.
Defend against bad network traffic, including botnets, malware,
phishing sites, and compromised hosts - saving your company time,
money, and embarrassment. Learn More!
http://p.sf.net/sfu/hpdev2dev-nov_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev