Update of /cvsroot/quantlibaddin/QuantLibAddin/qlo
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv17596/qlo
Modified Files:
interpolation.cpp interpolation.hpp
Log Message:
revering back "QuantLib::Interpolation makes a copy of x,y"
Index: interpolation.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/interpolation.hpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** interpolation.hpp 24 Oct 2006 10:13:54 -0000 1.20
--- interpolation.hpp 25 Oct 2006 09:31:16 -0000 1.21
***************
*** 31,41 ****
};
! class Interpolation : public Extrapolator {};
class LinearInterpolation : public Interpolation {
public:
LinearInterpolation(const std::string &linearInterpolationType,
! const std::vector<double>& x,
! const std::vector<double>& y);
};
--- 31,47 ----
};
! class Interpolation : public Extrapolator {
! public:
! Interpolation(const std::vector<QuantLib::Real>& x,
! const std::vector<QuantLib::Real>& y);
! protected:
! std::vector<QuantLib::Real> x_, y_;
! };
class LinearInterpolation : public Interpolation {
public:
LinearInterpolation(const std::string &linearInterpolationType,
! const std::vector<QuantLib::Real>& x,
! const std::vector<QuantLib::Real>& y);
};
***************
*** 43,48 ****
public:
CubicSplineInterpolation(
! const std::vector<double>& x,
! const std::vector<double>& y,
QuantLib::CubicSpline::BoundaryCondition leftCondition,
double leftConditionValue,
--- 49,54 ----
public:
CubicSplineInterpolation(
! const std::vector<QuantLib::Real>& x,
! const std::vector<QuantLib::Real>& y,
QuantLib::CubicSpline::BoundaryCondition leftCondition,
double leftConditionValue,
***************
*** 55,66 ****
public:
SABRInterpolation(
! const std::vector<double>& x,
! const std::vector<double>& y,
! double t,
! double forward,
! double alpha,
! double beta,
! double nu,
! double rho,
bool isAlphaFixed,
bool isBetaFixed,
--- 61,72 ----
public:
SABRInterpolation(
! const std::vector<QuantLib::Real>& x,
! const std::vector<QuantLib::Real>& y,
! QuantLib::Time t,
! QuantLib::Rate forward,
! QuantLib::Real alpha,
! QuantLib::Real beta,
! QuantLib::Real nu,
! QuantLib::Real rho,
bool isAlphaFixed,
bool isBetaFixed,
Index: interpolation.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/interpolation.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** interpolation.cpp 24 Oct 2006 10:13:54 -0000 1.18
--- interpolation.cpp 25 Oct 2006 09:31:16 -0000 1.19
***************
*** 29,46 ****
namespace QuantLibAddin {
! LinearInterpolation::LinearInterpolation(
! const std::string &linearInterpolationType,
! const std::vector<double>& x,
! const std::vector<double>& y)
! {
QL_REQUIRE(x.size()==y.size(), "unmatched x/y");
libraryObject_ = Create<boost::shared_ptr<QuantLib::Interpolation> >()
! (linearInterpolationType, x.begin(), x.end(), y.begin());
}
CubicSplineInterpolation::CubicSplineInterpolation(
! const std::vector<double>& x,
! const std::vector<double>& y,
QuantLib::CubicSpline::BoundaryCondition leftCondition,
double leftConditionValue,
--- 29,51 ----
namespace QuantLibAddin {
! Interpolation::Interpolation(
! const std::vector<QuantLib::Real>& x,
! const std::vector<QuantLib::Real>& y)
! : x_(x), y_(y) {
QL_REQUIRE(x.size()==y.size(), "unmatched x/y");
+ }
+ LinearInterpolation::LinearInterpolation(
+ const std::string &linearInterpolationType,
+ const std::vector<QuantLib::Real>& x,
+ const std::vector<QuantLib::Real>& y)
+ : Interpolation(x,y) {
libraryObject_ = Create<boost::shared_ptr<QuantLib::Interpolation> >()
! (linearInterpolationType, x_.begin(), x_.end(), y_.begin());
}
CubicSplineInterpolation::CubicSplineInterpolation(
! const std::vector<QuantLib::Real>& x,
! const std::vector<QuantLib::Real>& y,
QuantLib::CubicSpline::BoundaryCondition leftCondition,
double leftConditionValue,
***************
*** 48,56 ****
double rightConditionValue,
bool monotonicityConstraint)
! {
! QL_REQUIRE(x.size()==y.size(), "unmatched x/y");
!
libraryObject_ = boost::shared_ptr<QuantLib::Extrapolator>(new
! QuantLib::CubicSpline(x.begin(), x.end(), y.begin(),
leftCondition, leftConditionValue,
rightCondition, rightConditionValue,
--- 53,59 ----
double rightConditionValue,
bool monotonicityConstraint)
! : Interpolation(x,y) {
libraryObject_ = boost::shared_ptr<QuantLib::Extrapolator>(new
! QuantLib::CubicSpline(x_.begin(), x_.end(), y_.begin(),
leftCondition, leftConditionValue,
rightCondition, rightConditionValue,
***************
*** 59,70 ****
SABRInterpolation::SABRInterpolation(
! const std::vector<double>& x,
! const std::vector<double>& y,
! double t,
! double forward,
! double alpha,
! double beta,
! double nu,
! double rho,
bool isAlphaFixed,
bool isBetaFixed,
--- 62,73 ----
SABRInterpolation::SABRInterpolation(
! const std::vector<QuantLib::Real>& x,
! const std::vector<QuantLib::Real>& y,
! QuantLib::Time t,
! QuantLib::Rate forward,
! QuantLib::Real alpha,
! QuantLib::Real beta,
! QuantLib::Real nu,
! QuantLib::Real rho,
bool isAlphaFixed,
bool isBetaFixed,
***************
*** 72,80 ****
bool isRhoFixed,
const boost::shared_ptr<QuantLib::OptimizationMethod>& om)
! {
! QL_REQUIRE(x.size()==y.size(), "unmatched x/y");
!
libraryObject_ = boost::shared_ptr<QuantLib::Extrapolator>(new
! QuantLib::SABRInterpolation(x.begin(), x.end(), y.begin(),
t, forward, alpha, beta, nu, rho,
isAlphaFixed, isBetaFixed,
--- 75,81 ----
bool isRhoFixed,
const boost::shared_ptr<QuantLib::OptimizationMethod>& om)
! : Interpolation(x,y) {
libraryObject_ = boost::shared_ptr<QuantLib::Extrapolator>(new
! QuantLib::SABRInterpolation(x_.begin(), x_.end(), y_.begin(),
t, forward, alpha, beta, nu, rho,
isAlphaFixed, isBetaFixed,
|