本文整理汇总了C++中MyMatrix::columns方法的典型用法代码示例。如果您正苦于以下问题:C++ MyMatrix::columns方法的具体用法?C++ MyMatrix::columns怎么用?C++ MyMatrix::columns使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyMatrix
的用法示例。
在下文中一共展示了MyMatrix::columns方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BSDeltaWithParamsFD
double BSDeltaWithParamsFD(const MyMatrix& parametersMatrix, double epsilon) {
if (parametersMatrix.columns() != 6 && parametersMatrix.rows() != 1 ) {
throw("Input matrix should be 1 x 5");}
double Spot = parametersMatrix(0,0);
double Strike = parametersMatrix(0,1);
double r = parametersMatrix(0,2);
double d = parametersMatrix(0,3);
double vol = parametersMatrix(0,4);
double expiry = parametersMatrix(0,5);
return BlackScholesDeltaFD(Spot, Strike,r,d,vol,expiry, epsilon);
}
示例2: BSZeroCouponBondWithParams
double BSZeroCouponBondWithParams(const MyMatrix& parametersMatrix){
if (parametersMatrix.columns() != 6 && parametersMatrix.rows() != 1 ) {
throw("Input matrix should be 1 x 5");}
double Spot = parametersMatrix(0,0);
double Strike = parametersMatrix(0,1);
double r = parametersMatrix(0,2);
double d = parametersMatrix(0,3);
double vol = parametersMatrix(0,4);
double expiry = parametersMatrix(0,5);
return BlackScholesZeroCouponBond(Spot, Strike,r,d,vol,expiry);
}
示例3: defaultCellMatrixImpl
CellMatrix::CellMatrix(const MyMatrix& data):pimpl(new defaultCellMatrixImpl(data.rows(),data.columns()))
{
for(size_t i(0); i < data.rows(); ++i)
{
for(size_t j(0); j < data.columns(); ++j)
{
(*pimpl)(i,j) = data(i,j);
}
}
}
示例4: resultMatrix
CellMatrix //
BSGreeksFD(const MyMatrix& parametersMatrix,double epsilon) {
if (parametersMatrix.columns() != 6 && parametersMatrix.rows() != 1 ) {
throw("Input matrix should be 1 x 5");}
double Spot = parametersMatrix(0,0);
double Strike = parametersMatrix(0,1);
double r = parametersMatrix(0,2);
double d = parametersMatrix(0,3);
double vol = parametersMatrix(0,4);
double expiry = parametersMatrix(0,5);
CellMatrix resultMatrix(1,5);
resultMatrix(0,0) = BlackScholesDeltaFD(Spot,Strike,r,d,vol,expiry,epsilon);
resultMatrix(0,1) = BlackScholesGammaFD(Spot,Strike,r,d,vol,expiry,epsilon);
resultMatrix(0,2) = BlackScholesVegaFD(Spot,Strike,r,d,vol,expiry,epsilon);
resultMatrix(0,3) = BlackScholesRhoFD(Spot,Strike,r,d,vol,expiry,epsilon);
resultMatrix(0,4) = BlackScholesThetaFD(Spot,Strike,r,d,vol,expiry,epsilon);
return resultMatrix;
}
示例5: return
bool MyMatrix::operator==(const MyMatrix& a) const
{
if (this->rows() != a.rows()) return false;
if (this->columns() != a.columns()) return false;
return(((EigenMatrix)(*this)-(EigenMatrix)a).isApproxToConstant(0.0));
}