bool ObjectiveFunction::evaluate_with_Hessian_diagonal( EvalType type, PatchData& pd, double& value_out, std::vector<Vector3D>& grad_out, std::vector<SymMatrix3D>& hess_diag_out, MsqError& err ) { MsqHessian hess; hess.initialize( pd, err ); MSQ_ERRZERO(err); bool val = evaluate_with_Hessian( type, pd, value_out, grad_out, hess, err ); MSQ_ERRZERO(err); hess_diag_out.resize( hess.size() ); for (size_t i = 0; i < hess.size(); ++i) hess_diag_out[i] = hess.get_block(i,i)->upper(); return val; }
bool QualityMetric::evaluate_with_Hessian_diagonal( PatchData& pd, size_t handle, double& value, std::vector<size_t>& indices, std::vector<Vector3D>& gradient, std::vector<SymMatrix3D>& Hessian_diagonal, MsqError& err ) { bool rval = evaluate_with_Hessian( pd, handle, value, indices, gradient, tmpHess, err ); if (MSQ_CHKERR(err) || !rval) return rval; size_t s = indices.size(); Hessian_diagonal.resize( s ); std::vector<Matrix3D>::const_iterator h = tmpHess.begin(); for (size_t i = 0; i < indices.size(); ++i) { Hessian_diagonal[i] = h->upper(); h += s--; } return rval; }