SyTen

◆ gradient_descent()

template<typename Value , typename FunctionEval , typename GradientEval >
auto syten::GradientOpt::gradient_descent ( Value  x,
FunctionEval  func,
GradientEval  grad,
SRDef  step_size,
Index  num_steps 
)

Straightforward gradient descent.

Template Parameters
ValueDomain value type
FunctionEvalfunction evaluation type, takes a Value object and returns an object of (unnamed) type X
GradientEvalgradient evaluation type, takes a type X and the associated Value object and returns a type X

The domain value type must support SDef * Value → Value and Value += Value.

Parameters
xinitial value
funcfunction object used to evaluate the function at a specific point
gradgradient object used to evaluate the gradient at a specific function value and point
step_sizestep size to take during the descent
num_stepsnumber of steps to take
Returns
a tuple of the final domain value object and associated image value object.

References std::make_tuple(), and std::move().

+ Here is the call graph for this function: