本文整理汇总了C++中CellMatrix::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ CellMatrix::Size方法的具体用法?C++ CellMatrix::Size怎么用?C++ CellMatrix::Size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CellMatrix
的用法示例。
在下文中一共展示了CellMatrix::Size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MG_XLObjectPtr
MG_XLObjectPtr
VolatilityCurve_Create ( const MG_Date & aAsOf
, const CellMatrix& aMaturities
, const CellMatrix& aTenors
, const CellMatrix& aVolatilities
, const string& aCcy
, const string& aUnderIndex
, const CellMatrix& aInterpolMeths)
{
if (aVolatilities.Size() != aTenors.Size()*aMaturities.Size())
MG_THROW("Volatilities matrix size and (Maturities,Tenors) size are not consistent");
vector<double> vMaturities = FromCellMatrixToVectorDouble(aMaturities, 0);
vector<double> vTenors = FromCellMatrixToVectorDouble(aTenors, 0);
MG_Matrix vVols = FromCellMatrixToMGMatrix (aVolatilities);
vector<int> vInterpolMeths = vector<int>(2, LINEAR_INTERPOL);
if (!aInterpolMeths(0,0).IsEmpty())
vInterpolMeths = FromCellMatrixToInterpolVector(aInterpolMeths);
if (vInterpolMeths.size() == 1)
vInterpolMeths.push_back(vInterpolMeths[0]);
long vInterpolCode = MG_Interpolator::CreateInterpolCode(vInterpolMeths);
return MG_XLObjectPtr(new MG_IRVolatilityCurve(aAsOf, vMaturities, vTenors, vVols, aCcy, aUnderIndex, vInterpolCode));
}
示例2: vSize
/* converting a CellMatrix of interpolation types to a sid::vector<int> */
vector<int> FromCellMatrixToInterpolVector(const CellMatrix& aCM)
{
if (aCM.Size() > maxInterpoltypesNb)
{
ostringstream vOs;
vOs << "Maximum number of interpolations is " << maxInterpoltypesNb << ", please advise.";
MG_THROW(vOs.str());
}
vector<string> vInterpolTypesStr = FromCellMatrixToVectorStr(aCM);
size_t vSize(vInterpolTypesStr.size());
vector<int> vInterpolTypesInt(vSize);
for(size_t i=0; i<vSize; ++i)
vInterpolTypesInt[i] = InterpolMethodConvertor[vInterpolTypesStr[i]];
return vInterpolTypesInt;
}