7 ModPieceCostFunction::ModPieceCostFunction(std::shared_ptr<ModPiece> cost,
double scaleIn) :
CostFunction(cost->inputSizes(0)), cost(cost), scale(scaleIn) {
9 assert(
cost->outputSizes.size()==1);
10 assert(
cost->outputSizes(0)==1);
11 assert(
cost->inputSizes.size()==1);
21 Eigen::VectorXd sensitivity = Eigen::VectorXd::Ones(1);
22 return scale*
cost->Gradient(0, 0,
x, sensitivity);
27 Eigen::VectorXd sensitivity = Eigen::VectorXd::Ones(1);
The cost function for an optimization routine.
std::shared_ptr< muq::Modeling::ModPiece > cost
virtual double Cost() override
The value of the cost function.
virtual Eigen::VectorXd Gradient() override
Compute the gradient of the cost function.
virtual Eigen::VectorXd ApplyHessian(Eigen::VectorXd const &vec) override
std::vector< std::reference_wrapper< const T > > ref_vector
A vector of references to something ...