RVL::StdFOFunctional< Scalar, DataType > Class Template Reference

This class implements the Functional interface by combining the operation of three FunctionObjects and a domain Space. More...

#include <functional.hh>

Inheritance diagram for RVL::StdFOFunctional< Scalar, DataType >:

RVL::Functional< Scalar > RVL::Writeable List of all members.

Public Member Functions

 StdFOFunctional (FunctionObjectScalarRedn< Scalar > &f_, FunctionObject &gradf_, FunctionObject &hessf_, const Space< Scalar > &dom_)
 main constructor - takes references to functionals defining main protected methods, domain space.
 StdFOFunctional (const StdFOFunctional< Scalar, DataType > &s)
 ~StdFOFunctional ()
virtual const Space< Scalar > & getDomain () const
virtual ostream & write (ostream &str) const

Protected Member Functions

virtual void apply (const Vector< Scalar > &x, Scalar &val) const
 $val = F(x)$
virtual void applyGradient (const Vector< Scalar > &x, Vector< Scalar > &g) const
 $g = grad F(x)$
virtual void applyHessian (const Vector< Scalar > &x, const Vector< Scalar > &dx, Vector< Scalar > &dy) const
 $dy = Hess F(x) dx$
virtual Functional< Scalar > * clone () const
 virtual copy constructor: make a complete new copy including internal workspace.
 StdFOFunctional ()

Protected Attributes

FunctionObjectScalarRedn<
Scalar > & 
f
FunctionObjectgradf
FunctionObjecthessf
Space< Scalar > const & dom

Detailed Description

template<class Scalar, class DataType = Scalar>
class RVL::StdFOFunctional< Scalar, DataType >

This class implements the Functional interface by combining the operation of three FunctionObjects and a domain Space.

Note that FunctionObject instances have persistent state and thus are not required to yield the same result when applied to the same data. Thus only FunctionObjects which do not change results on repeated evaluation at the same instance are usable in this construction.

Storage of intermediate results likely introduces inefficiencies. The use of this class is primarily for rapid prototyping or the implementation of functionals with no intermediate data between functional, gradient, and hessian evaluations. It is possible to get around this limitation by having these three FOs reference a common external object.

The functional evaluation is performed by a FunctionObjectScalarRedn which returns a Scalar value. The gradient computation is performed by a binary FunctionObject, which will be given the gradient (target) vector as the first input and the point x (data) vector as the second input. The hessian computation is performed by a ternary FunctionObject which will be given the target vector dy first, followed by the point x and direction dx $dy = H(x)*dx$.

Definition at line 1152 of file functional.hh.


Constructor & Destructor Documentation

template<class Scalar, class DataType = Scalar>
RVL::StdFOFunctional< Scalar, DataType >::StdFOFunctional (  )  [protected]

template<class Scalar, class DataType = Scalar>
RVL::StdFOFunctional< Scalar, DataType >::StdFOFunctional ( FunctionObjectScalarRedn< Scalar > &  f_,
FunctionObject gradf_,
FunctionObject hessf_,
const Space< Scalar > &  dom_ 
)

main constructor - takes references to functionals defining main protected methods, domain space.

Definition at line 1203 of file functional.hh.

template<class Scalar, class DataType = Scalar>
RVL::StdFOFunctional< Scalar, DataType >::StdFOFunctional ( const StdFOFunctional< Scalar, DataType > &  s  ) 

Definition at line 1209 of file functional.hh.

template<class Scalar, class DataType = Scalar>
RVL::StdFOFunctional< Scalar, DataType >::~StdFOFunctional (  ) 

Definition at line 1212 of file functional.hh.


Member Function Documentation

template<class Scalar, class DataType = Scalar>
virtual void RVL::StdFOFunctional< Scalar, DataType >::apply ( const Vector< Scalar > &  x,
Scalar &  val 
) const [protected, virtual]

$val = F(x)$

Implements RVL::Functional< Scalar >.

Definition at line 1162 of file functional.hh.

References RVL::Vector< Scalar >::eval(), RVL::StdFOFunctional< Scalar, DataType >::f, and RVL::ScalarRedn< Scalar >::getValue().

template<class Scalar, class DataType = Scalar>
virtual void RVL::StdFOFunctional< Scalar, DataType >::applyGradient ( const Vector< Scalar > &  x,
Vector< Scalar > &  g 
) const [protected, virtual]

$g = grad F(x)$

Implements RVL::Functional< Scalar >.

Definition at line 1177 of file functional.hh.

References RVL::Vector< Scalar >::eval(), and RVL::StdFOFunctional< Scalar, DataType >::gradf.

template<class Scalar, class DataType = Scalar>
virtual void RVL::StdFOFunctional< Scalar, DataType >::applyHessian ( const Vector< Scalar > &  x,
const Vector< Scalar > &  dx,
Vector< Scalar > &  dy 
) const [protected, virtual]

$dy = Hess F(x) dx$

Implements RVL::Functional< Scalar >.

Definition at line 1183 of file functional.hh.

References RVL::Vector< Scalar >::eval(), and RVL::StdFOFunctional< Scalar, DataType >::hessf.

template<class Scalar, class DataType = Scalar>
virtual Functional<Scalar>* RVL::StdFOFunctional< Scalar, DataType >::clone (  )  const [protected, virtual]

virtual copy constructor: make a complete new copy including internal workspace.

Virtual to permit override in child class.

Implements RVL::Functional< Scalar >.

Definition at line 1194 of file functional.hh.

template<class Scalar, class DataType = Scalar>
virtual const Space<Scalar>& RVL::StdFOFunctional< Scalar, DataType >::getDomain (  )  const [virtual]

Implements RVL::Functional< Scalar >.

Definition at line 1215 of file functional.hh.

References RVL::StdFOFunctional< Scalar, DataType >::dom.

template<class Scalar, class DataType = Scalar>
virtual ostream& RVL::StdFOFunctional< Scalar, DataType >::write ( ostream &  str  )  const [virtual]

Implements RVL::Writeable.

Definition at line 1217 of file functional.hh.

References RVL::StdFOFunctional< Scalar, DataType >::f, RVL::StdFOFunctional< Scalar, DataType >::gradf, RVL::StdFOFunctional< Scalar, DataType >::hessf, RVL::FunctionObject::write(), and RVL::FunctionObjectConstEval::write().


Member Data Documentation

template<class Scalar, class DataType = Scalar>
FunctionObjectScalarRedn<Scalar>& RVL::StdFOFunctional< Scalar, DataType >::f [protected]

Definition at line 1154 of file functional.hh.

Referenced by RVL::StdFOFunctional< Scalar, DataType >::apply(), and RVL::StdFOFunctional< Scalar, DataType >::write().

template<class Scalar, class DataType = Scalar>
FunctionObject& RVL::StdFOFunctional< Scalar, DataType >::gradf [protected]

Definition at line 1155 of file functional.hh.

Referenced by RVL::StdFOFunctional< Scalar, DataType >::applyGradient(), and RVL::StdFOFunctional< Scalar, DataType >::write().

template<class Scalar, class DataType = Scalar>
FunctionObject& RVL::StdFOFunctional< Scalar, DataType >::hessf [protected]

Definition at line 1156 of file functional.hh.

Referenced by RVL::StdFOFunctional< Scalar, DataType >::applyHessian(), and RVL::StdFOFunctional< Scalar, DataType >::write().

template<class Scalar, class DataType = Scalar>
Space<Scalar> const& RVL::StdFOFunctional< Scalar, DataType >::dom [protected]

Definition at line 1157 of file functional.hh.

Referenced by RVL::StdFOFunctional< Scalar, DataType >::getDomain().


The documentation for this class was generated from the following file:
Generated on 5 Jan 2017 for RVL by  doxygen 1.4.7