26 : variances_(cov.diagonal()), stdDevs_(
Array(cov.rows())),
27 correlationMatrix_(
Matrix(cov.rows(), cov.rows()))
31 "input covariance matrix must be square, it is [" <<
32 size <<
"x" << cov.
rows() <<
"]");
34 for (
Size i=0; i<size; ++i)
38 for (
Size j=0; j<i; ++j)
40 QL_REQUIRE(std::fabs(cov[i][j]-cov[j][i]) <= tolerance,
41 "invalid covariance matrix:" <<
42 "\nc[" << i <<
", " << j <<
"] = " <<
43 cov[i][j] <<
"\nc[" << j <<
", " << i <<
1-D array used in linear algebra.
Matrix correlationMatrix_
CovarianceDecomposition(const Matrix &covarianceMatrix, Real tolerance=1.0e-12)
Matrix used in linear algebra.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Covariance matrix calculation.
std::size_t Size
size of a container