Template Class SummedGradientFunctionGradientFunctionAdapter

Inheritance Relationships

Base Types

Class Documentation

template<typename T>
class parpe::SummedGradientFunctionGradientFunctionAdapter : public parpe::GradientFunction, public parpe::SummedGradientFunction<T>

Adapter / wrapper for SummedGradientFunction to GradientFunction.

Simply evaluates SummedGradientFunction on all datasets.

Public Functions

inline SummedGradientFunctionGradientFunctionAdapter(std::unique_ptr<SummedGradientFunction<T>> gradFun, std::vector<T> datasets)

SummedGradientFunctionGradientFunctionAdapter.

Parameters
  • gradFun: Function to be wrapped

  • datasets: Datasets on which to evaluate

inline virtual FunctionEvaluationStatus evaluate(gsl::span<const double> parameters, double &fval, gsl::span<double> gradient, Logger *logger = nullptr, double *cpuTime = nullptr) const override
inline virtual FunctionEvaluationStatus evaluate(gsl::span<const double> parameters, T dataset, double &fval, gsl::span<double> gradient, Logger *logger, double *cpuTime) const override

Evaluate on single data point.

Return

Evaluation status

Parameters
  • parameters: Parameter vector where the function is to be evaluated

  • dataset: The dataset on which to evaluate the function

  • fval: Output argument for f(x)

  • gradient: Preallocated space for the gradient of size dim(parameters). Or gsl::span<double>() for evaluation without gradient.

  • logger: Optional Logger instance used for output

  • cputime: Optional output argument to reoprt cpuTime consumed by the the function

inline virtual FunctionEvaluationStatus evaluate(gsl::span<const double> parameters, std::vector<T> datasets, double &fval, gsl::span<double> gradient, Logger *logger, double *cpuTime) const override

Evaluate on vector of data points.

Return

Evaluation status

Parameters
  • parameters: Parameter vector where the function is to be evaluated

  • datasets: The datasets on which to evaluate the function

  • fval: Output argument for f(x)

  • gradient: Preallocated space for the gradient of size dim(parameters). Or gsl::span<double>() for evaluation without gradient.

  • logger: Optional Logger instance used for output

  • cputime: Optional output argument to reoprt cpuTime consumed by the the function

inline virtual int numParameters() const override
inline virtual std::vector<std::string> getParameterIds() const override
inline SummedGradientFunction<T> *getWrappedFunction() const

Return pointer to the wrapped function (non-owning).

Return

Pointer to wrapped function