Update of /cvsroot/quantlibaddin/QuantLibAddin/qlo
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv30789/qlo
Modified Files:
interpolation.cpp interpolation.hpp
Log Message:
add support for QuantLib::Matrix
Index: interpolation.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/interpolation.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** interpolation.hpp 9 Jun 2006 18:58:47 -0000 1.4
--- interpolation.hpp 13 Jun 2006 11:26:23 -0000 1.5
***************
*** 21,24 ****
--- 21,25 ----
#include <oh/objhandler.hpp>
#include <ql/Math/cubicspline.hpp>
+ #include <ql/Math/matrix.hpp>
namespace QuantLibAddin {
***************
*** 83,86 ****
--- 84,92 ----
};
+ class Matrix : public ObjHandler::LibraryObject<QuantLib::Matrix> {
+ public:
+ Matrix(const std::vector<std::vector<double> >&);
+ };
+
}
Index: interpolation.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/interpolation.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** interpolation.cpp 9 Jun 2006 18:58:47 -0000 1.4
--- interpolation.cpp 13 Jun 2006 11:26:23 -0000 1.5
***************
*** 103,106 ****
--- 103,120 ----
t, forward, beta, nu, alpha, rho));
}
+
+ Matrix::Matrix(const std::vector < std::vector < double > > &input) {
+ int numRows = input.size();
+ int numCols = numRows ? input[0].size() : 0;
+ libraryObject_ = boost::shared_ptr<QuantLib::Matrix>(
+ new QuantLib::Matrix(numRows, numCols));
+ QuantLib::Matrix::iterator matrixIter = libraryObject_->begin();
+ for (std::vector<std::vector<double> >::const_iterator i = input.begin();
+ i != input.end(); i++) {
+ std::vector<double> row = *i;
+ for (std::vector<double>::const_iterator j = row.begin(); j != row.end(); j++)
+ *matrixIter++ = *j;
+ }
+ }
}
|