Hi again,
I am using version 0.8.1 . It works now by modifying the constructor " CubicSplineImpl" in cubicspline.hpp to include the function "update( )". Thanks Amandine ----- Original Message ---- From: amandine vincotte <[hidden email]> To: [hidden email] Sent: Monday, November 12, 2007 11:53:44 AM Subject: [Quantlib-users] Natural Cubic Spline Function Hi , I am trying to get a Cubic Spline Function and I have created the simple function below using "Natural Cubic Spline". But from the output below it looks more like a flat filled curve. Am I missing anything? Thank you for you help. Regards, Amandine void test(const Date& valueDate) { vector<Rate> x; vector<Rate> y; x.push_back(0.05); y.push_back(2); x.push_back(0.1); y.push_back(2.3); x.push_back(0.15); y.push_back(1.5); x.push_back(0.2); y.push_back(1); x.push_back(0.25); y.push_back(3.1); NaturalCubicSpline sp(x.begin(),x.end(),y.begin()); Rate r=0.07; while(r<=0.25) { Rate rr = sp(r,true); cout << r << "," << rr << endl; r+=0.01; } } OUTPUT: 0.07,2 0.08,2 0.09,2 0.1,2 0.11,2.3 0.12,2.3 0.13,2.3 0.14,2.3 0.15,1.5 0.16,1.5 0.17,1.5 0.18,1.5 0.19,1.5 0.2,1 0.21,1 0.22,1 0.23,1 0.24,1 __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |