29 : FunctionBase { size }
32 functionGradient = gsl::vector( size );
33 functionGradient.set_all( 1.0 );
34 functionHessian = gsl::matrix { size, size };
35 functionHessian.set_all( 0.0 );
42 return std::accumulate( vector.begin(), vector.end(), 0.0 );
72 size_t const SIZE { vector.size() };
79 functionValue = std::accumulate( vector.begin(), vector.end(), 0.0 );
Sum(size_t const size=0)
Specify a constructor argument if you want to be able to check the size of the argument in a Model Ob...
double operator()(gsl::vector const &vector)
The function operator: computes the sum of the vector entries.
double functionValue
The function value.
gsl::vector functionGradient
The gradient value.
virtual gsl::matrix hessian() const
virtual gsl::vector gradient() const
gsl::matrix functionHessian
The Hessian value.
Namespace to hold concrete functions.
size_t getSize() const
Get size of vector for function arguments or zero for arbitrary size.
void setVector(gsl::vector const &vector)
Set a vector and compute function value, gradient and Hessian efficiently.