/** * Calculates covariance matrix for fitting function's active parameters. * @param covar :: Output cavariance matrix. * @param epsrel :: Tolerance. */ void CostFuncLeastSquares::calActiveCovarianceMatrix(GSLMatrix& covar, double epsrel) { UNUSED_ARG(epsrel); if (m_hessian.isEmpty()) { valDerivHessian(); } covar = m_hessian; covar.invert(); }
/** * Calculates covariance matrix for fitting function's active parameters. * @param covar :: Output cavariance matrix. * @param epsrel :: Tolerance. */ void CostFuncLeastSquares::calActiveCovarianceMatrix(GSLMatrix &covar, double epsrel) { UNUSED_ARG(epsrel); if (m_hessian.isEmpty()) { valDerivHessian(); } if (g_log.is(Kernel::Logger::Priority::PRIO_DEBUG)) { std::ostringstream osHess; osHess << "== Hessian (H) ==\n"; osHess << std::left << std::fixed; for (size_t i = 0; i < m_hessian.size1(); ++i) { for (size_t j = 0; j < m_hessian.size2(); ++j) { osHess << std::setw(10); osHess << m_hessian.get(i, j) << " "; } osHess << "\n"; } g_log.debug() << osHess.str(); } covar = m_hessian; covar.invert(); if (g_log.is(Kernel::Logger::Priority::PRIO_DEBUG)) { std::ostringstream osCovar; osCovar << "== Covariance matrix (H^-1) ==\n"; osCovar << std::left << std::fixed; for (size_t i = 0; i < covar.size1(); ++i) { for (size_t j = 0; j < covar.size2(); ++j) { osCovar << std::setw(10); osCovar << covar.get(i, j) << " "; } osCovar << "\n"; } g_log.debug() << osCovar.str(); } }