//{{XLP_SRC(CalcProducts) // NOTE - the FunctionWizard will add and remove mapping code here. // DO NOT EDIT what you see in these blocks of generated code! IMPLEMENT_XLLFN2(CalcProducts, "RPP", "CalcProducts", "Col,Row", "User Defined", "Calculate the products of the members of" " two series", "Column of X values\000Row of Y values\000", "\0\0", 1) extern "C" __declspec( dllexport ) LPXLOPER CalcProducts(const COper* lpopX, const COper* lpopY) { CXlOper xloResult; //}}XLP_SRC BOOL bOk = TRUE; CString strError; std::vector<double> vecX; if ( bOk && !(bOk = lpopX->ColToVector(vecX, &strError)) ) strError = "Error in X: " + strError; std::vector<double> vecY; if ( bOk && !(bOk = lpopY->RowToVector(vecY, &strError)) ) strError = "Error in Y: " + strError; if ( !bOk ) { xloResult = strError; return xloResult.Ret(); } xlp::matrix<double> mat; mat.resize(vecX.size(), vecY.size()); USHORT i, j; for ( i = 0; i < vecX.size(); i++ ) for ( j = 0; j < vecY.size(); j++ ) mat.at(i, j) = vecX[i] * vecY[j]; xloResult = mat; return xloResult.Ret(); }
COper::ColToVector | COper::RowToVector | matrix<T> | matrix<T>::resize | matrix<T>::at