/// Set the matrix to be diagonal. /// @param d :: Values on the diagonal. void GSLMatrix::diag(const GSLVector &d) { const auto n = d.size(); resize(n, n); zero(); for (size_t i = 0; i < n; ++i) { set(i, i, d.get(i)); } }
/** * Copy the parameter values from a GSLVector. * @param params :: A vector to copy the parameters from */ void CostFuncLeastSquares::setParameters(const GSLVector ¶ms) { if (nParams() != params.size()) { throw std::runtime_error( "Parameter vector has wrong size in CostFuncLeastSquares."); } for (size_t i = 0; i < nParams(); ++i) { setParameter(i, params.get(i)); } m_function->applyTies(); }