|
From: <ori...@we...> - 2015-11-19 14:03:50
|
<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div> <div>Hi Peter,</div> <div> </div> <div>I've just had a quick look ... The proper initialization of "error" seems to be missing and changing L52 to</div> <div> </div> <div><span style="font-family: Verdana; font-size: 12px; line-height: 19.2px;">Real error=norm2(r)/bnorm2;</span></div> <div> </div> <div><span style="font-family: Verdana; font-size: 12px; line-height: 19.2px;">as you suggested would be the correct bugfix.</span></div> <div> </div> <div><span style="font-family: Verdana; font-size: 12px; line-height: 19.2px;">On the other issue, the intermediate results rho == 0.0 or omega == 0.0 are so-called breakdown cases for the algorithm. To cope with that, one would have to combine the BiCG with other methods ... In the BiCGstab algorithm, rTld is not updated indeed.</span></div> <div> </div> <div> </div> <div>Best regards</div> <div> </div> <div>Ralph</div> <div> </div> <div> </div> <div> </div> <div> <div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"> <div style="margin:0 0 10px 0;"><b>Gesendet:</b> Mittwoch, 18. November 2015 um 19:53 Uhr<br/> <b>Von:</b> "Peter Caspers" <pca...@gm...><br/> <b>An:</b> "QuantLib Mailing Lists" <qua...@li...><br/> <b>Betreff:</b> [Quantlib-dev] BiCGstab</div> <div name="quoted-content">Hi Ralph, Klaus,<br/> <br/> I am using your biconjugate gradient stabilized solver and experience<br/> some issues in certain cases. A small test case would be the system<br/> Ax=b with<br/> <br/> A=<br/> | 1 0 0 0 0 0 0 0 0 |<br/> | 0 1 0 0 0 0 0 0 0 |<br/> | 0 0 1 0 0 0 0 0 0 |<br/> | 0 0 0 1 0 0 0 0 0 |<br/> | 0 0 0 0 1 0 0 0 0 |<br/> | 0 0 -0.5 0 0 1 0 0 -0.5 |<br/> | 0 0 0 -0.5 0 0 1 -0.5 0 |<br/> | 0 0 0 0 0 0 0 1 0 |<br/> | 0 0 0 0 0 -0.5 0 -0.5 1 |<br/> <br/> b = [ 5; 5; 5; 5; 5; 0; 0; 5; 0 ]<br/> <br/> With the guess [5,5,...,5], which is the exact solution, the solver<br/> throws an exception "could not converge". This is because "error" is<br/> initialized to Null<Real>() in L52, and the iteration loop is exited<br/> at L58 already (because rho=0.0), so the Null<Real>() value is checked<br/> in L90. I think this can be fixed by simply changing L52 to<br/> <br/> Real error=norm2(r)/bnorm2;<br/> <br/> With the guess [0,0,....,0] on the other hand, the same exception is<br/> thrown. We have<br/> <br/> x = [ 5; 5; 5; 5; 5; 2.77778; 5.55556; 5; 2.77778 ]<br/> r = [ 0; 0; 0; 0; 0; 1.11111; -0.555556; 0; 1.11111 ]<br/> rTld = [ 5; 5; 5; 5; 5; 0; 0; 5; 0 ]<br/> <br/> at L86 after the first iteration, so rho = 0.0 again, but this time<br/> exiting (at L57) with a huge error of course. Is that expected ? While<br/> I have not looked at the code very closely, a quick observation is<br/> that rTld is never updated during the iterations, which doesn't feel<br/> right intuitively.<br/> <br/> Can you help?<br/> <br/> Thanks<br/> Peter<br/> <br/> ------------------------------------------------------------------------------<br/> _______________________________________________<br/> QuantLib-dev mailing list<br/> Qua...@li...<br/> <a href="https://lists.sourceforge.net/lists/listinfo/quantlib-dev" target="_blank">https://lists.sourceforge.net/lists/listinfo/quantlib-dev</a></div> </div> </div> </div></div></body></html> |