30 : function( function ), h { h }{}
37 const size_t SIZE { vector.size() };
39 auto diffVector = gsl::vector( SIZE );
41 for(
size_t i { 0 }; i < SIZE; ++i ){
42 double tmp { vector.get( i ) };
43 const_cast<gsl::vector&
>( vector ).set( i, tmp +
h );
44 diffVector.set( i,
function( vector ) );
45 const_cast<gsl::vector&
>( vector ).set( i, tmp );
52 for(
size_t i { 0 }; i < SIZE; ++i ){
double const h
The qotient size.
virtual void setVector(gsl::vector const &vector)
Set the vector to a new value.
double functionValue
The function value.
ForwardDifferenceGradientEstimate(Function &function, double const h=std::sqrt(std::numeric_limits< double >::epsilon()))
Find forward difference quotient estimates.
gsl::vector functionGradient
The gradient value.
Namespace for details of ipo_function that are not normally needed to construct and solve a convex op...
size_t getSize() const
Get size of vector for function arguments or zero for arbitrary size.
This class computes a function at a vector.