28#ifndef _math_optimize_function_h
29#define _math_optimize_function_h
34#include <util/state/state.h>
35#include <math/optimize/transform.h>
36#include <math/scmat/matrix.h>
37#include <math/scmat/result.h>
53 bool desired_value_accuracy_set_to_default_;
54 bool desired_gradient_accuracy_set_to_default_;
55 bool desired_hessian_accuracy_set_to_default_;
57 bool throw_if_tolerance_exceeded_;
63 virtual void set_value(
double);
77 virtual void set_actual_value_accuracy(
double);
78 virtual void set_actual_gradient_accuracy(
double);
79 virtual void set_actual_hessian_accuracy(
double);
114 double gradacc = DBL_EPSILON,
double hessacc = DBL_EPSILON);
149 int gradient_needed()
const;
150 int do_gradient(
int);
151 virtual void set_desired_gradient_accuracy(
double);
152 virtual double actual_gradient_accuracy()
const;
153 virtual double desired_gradient_accuracy()
const;
162 int hessian_needed()
const;
164 virtual void set_desired_hessian_accuracy(
double);
165 virtual double actual_hessian_accuracy()
const;
166 virtual double desired_hessian_accuracy()
const;
173 virtual bool desired_value_accuracy_set_to_default()
const;
174 virtual bool desired_gradient_accuracy_set_to_default()
const;
175 virtual bool desired_hessian_accuracy_set_to_default()
const;
The Compute class provides a means of keeping results up to date.
Definition compute.h:52
virtual void obsolete()
Marks all results as being out of date.
static std::ostream & out0()
Return an ostream that writes from node 0.
The Function class is an abstract base class that, given a set of coordinates, will compute a value a...
Definition function.h:44
virtual int hessian_implemented() const
int value_needed() const
Returns nonzero if the current value is not up-to-date.
Ref< SCMatrixKit > matrixkit_
Used to construct new matrices.
Definition function.h:46
virtual int value_implemented() const
AccResultRefSymmSCMatrix hessian_
The hessian at x_.
Definition function.h:52
void print_desired_accuracy(std::ostream &=ExEnv::out0()) const
similar to print(), but only prins desired accuracies
RefSCVector x_
The variables.
Definition function.h:48
RefSCDimension dim_
The dimension of x_.
Definition function.h:49
virtual double value()
Return the value of the function.
virtual double actual_value_accuracy() const
Return the accuracy with which the value has been computed.
virtual double desired_value_accuracy() const
Return the accuracy with which the value is to be computed.
int do_value(int)
If passed a nonzero number, compute the value the next time compute() is called.
virtual void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
virtual void guess_hessian(RefSymmSCMatrix &)
Compute a quick, approximate hessian.
virtual int gradient_implemented() const
Function(const Ref< KeyVal > &, double funcacc=DBL_EPSILON, double gradacc=DBL_EPSILON, double hessacc=DBL_EPSILON)
The keyval constructor reads the following keywords:
AccResultdouble value_
The value of the function at x_.
Definition function.h:50
virtual void set_matrixkit(const Ref< SCMatrixKit > &)
Set the SCMatrixKit that should be used to construct the requisite vectors and matrices.
virtual void set_x(const RefSCVector &)
Set and retrieve the coordinate values.
void do_change_coordinates(const Ref< NonlinearTransform > &)
Change the coordinate system and apply the given transform to intermediates matrices and vectors.
RefSCVector & get_x_reference()
Get read/write access to the coordinates for modification.
Definition function.h:83
RefSCDimension dimension() const
Return the SCDimension of the problem.
virtual void print(std::ostream &=ExEnv::out0()) const
Print information about the object.
virtual void set_desired_value_accuracy(double)
Set the accuracy to which the value is to be computed.
AccResultRefSCVector gradient_
The gradient at x_.
Definition function.h:51
Ref< SCMatrixKit > matrixkit() const
Return the SCMatrixKit used to construct vectors and matrices.
virtual Ref< NonlinearTransform > change_coordinates()
An optimizer can call change coordinates periodically to give the function an opportunity to change i...
virtual bool throw_if_tolerance_exceeded() const
Overridden Compute member.
The RefSCDimension class is a smart pointer to an SCDimension specialization.
Definition dim.h:152
The RefSCVector class is a smart pointer to an SCVector specialization.
Definition matrix.h:55
The RefSymmSCMatrix class is a smart pointer to an SCSymmSCMatrix specialization.
Definition matrix.h:265
A template class that maintains references counts.
Definition ref.h:361
Base class for objects that can save/restore state.
Definition state.h:45
Restores fundamental and user-defined types from images created with StateOut.
Definition statein.h:79
Serializes fundamental and user-defined types.
Definition stateout.h:71
Contains all MPQC code up to version 3.
Definition mpqcin.h:14