RVL::FunctionalEvaluation< Scalar > Class Template Reference

Evaluation is a pair of a (clone of a) Functional and an evaluation point Vector, stored by reference. More...

#include <functional.hh>

Inheritance diagram for RVL::FunctionalEvaluation< Scalar >:

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

Public Member Functions

 FunctionalEvaluation (const Functional< Scalar > &_f, const Vector< Scalar > &x)
 main constructor - combines const references to Functional, Vector.
 FunctionalEvaluation (const FunctionalEvaluation< Scalar > &ev)
virtual ~FunctionalEvaluation ()
const Space< Scalar > & getDomain () const
 access to domain
Scalar getMaxStep (const Vector< Scalar > &dx) const
 Returns the maximum scalar alpha for which x+alpha*dx is still in the domain of the functional.
Vector< Scalar > & getPoint ()
 const reference to evaluation point
Vector< Scalar > const & getPoint () const
Scalar getValue () const
 extract value of functional at evaluation point.
Vector< Scalar > const & getGradient () const
 returns a reference to the gradient of the functional at the current point.
Scalar getGradientNorm () const
 Returns the norm of the gradient of the functional at the current point.
LinearOp< Scalar > const & getHessian () const
 Returns a LinearOp representing the Hessian of the functional.
Functional< Scalar > const & getFunctional () const
 provided to enable extraction of subclass attributes via a cast, from the current internal copy of the underlying Functional.
ostream & write (ostream &str) const

Protected Member Functions

void applyHessian (const Vector< Scalar > &yin, Vector< Scalar > &yout) const
const ProductSpace< Scalar > & getProductDomain () const
 The next two functions throw exceptions if the referenced functional is not a FcnlProdDom.
Vector< Scalar > const & getPartialGradient (int i) const
void applyPartialHessian (int i, int j, const Vector< Scalar > &dxi, Vector< Scalar > &dxj) const
 applyPartialHessian() computes the image of the (i,j) block of the Hessian on derivative on dxi, giving dxj.
void * operator new (size_t size)
 operator new - not available to general public, but available to children and friends

Protected Attributes

Components< Scalar > cg
HessianEvaluation< Scalar > hess

Friends

class HessianEvaluation< Scalar >
class PartialHessianEvaluation< Scalar >
class FcnlOpComp< Scalar >

Detailed Description

template<class Scalar>
class RVL::FunctionalEvaluation< Scalar >

Evaluation is a pair of a (clone of a) Functional and an evaluation point Vector, stored by reference.

The Functional is re-cloned automatically when the evaluation point Vector changes internal state.

Definition at line 424 of file functional.hh.


Constructor & Destructor Documentation

template<class Scalar>
RVL::FunctionalEvaluation< Scalar >::FunctionalEvaluation ( const Functional< Scalar > &  _f,
const Vector< Scalar > &  x 
)

main constructor - combines const references to Functional, Vector.

The Functional is cloned, and the clone is used as working copy. The const reference is copied (along with that to the evaluation point Vector) and used whenever fresh Functional clones are needed.

Definition at line 574 of file functional.hh.

References RVL::Vector< Scalar >::getSpace().

template<class Scalar>
RVL::FunctionalEvaluation< Scalar >::FunctionalEvaluation ( const FunctionalEvaluation< Scalar > &  ev  ) 

Definition at line 606 of file functional.hh.

template<class Scalar>
virtual RVL::FunctionalEvaluation< Scalar >::~FunctionalEvaluation (  )  [virtual]

Definition at line 613 of file functional.hh.


Member Function Documentation

template<class Scalar>
void RVL::FunctionalEvaluation< Scalar >::applyHessian ( const Vector< Scalar > &  yin,
Vector< Scalar > &  yout 
) const [protected]

Definition at line 469 of file functional.hh.

template<class Scalar>
const ProductSpace<Scalar>& RVL::FunctionalEvaluation< Scalar >::getProductDomain (  )  const [protected]

The next two functions throw exceptions if the referenced functional is not a FcnlProdDom.

They are accessed only by PartialHessianEval, via FcnlProdDomEval, which provides compile time type-safety in addition to the run-time type checking built into these methods.

Definition at line 488 of file functional.hh.

References RVL::FunctionalProductDomain< Scalar >::getProductDomain().

template<class Scalar>
Vector<Scalar> const& RVL::FunctionalEvaluation< Scalar >::getPartialGradient ( int  i  )  const [protected]

Reimplemented in RVL::FunctionalProductDomainEvaluation< Scalar >.

Definition at line 508 of file functional.hh.

References RVL::FunctionalEvaluation< Scalar >::cg.

template<class Scalar>
void RVL::FunctionalEvaluation< Scalar >::applyPartialHessian ( int  i,
int  j,
const Vector< Scalar > &  dxi,
Vector< Scalar > &  dxj 
) const [protected]

applyPartialHessian() computes the image of the (i,j) block of the Hessian on derivative on dxi, giving dxj.

Definition at line 528 of file functional.hh.

References RVL::FunctionalProductDomain< Scalar >::applyPartialHessian().

template<class Scalar>
void* RVL::FunctionalEvaluation< Scalar >::operator new ( size_t  size  )  [protected]

operator new - not available to general public, but available to children and friends

Version 1.0: user control

Definition at line 560 of file functional.hh.

template<class Scalar>
const Space<Scalar>& RVL::FunctionalEvaluation< Scalar >::getDomain (  )  const

access to domain

Definition at line 618 of file functional.hh.

template<class Scalar>
Scalar RVL::FunctionalEvaluation< Scalar >::getMaxStep ( const Vector< Scalar > &  dx  )  const

Returns the maximum scalar alpha for which x+alpha*dx is still in the domain of the functional.

Definition at line 629 of file functional.hh.

References RVL::FunctionalEvaluation< Scalar >::getPoint().

template<class Scalar>
Vector<Scalar>& RVL::FunctionalEvaluation< Scalar >::getPoint (  ) 

const reference to evaluation point

Definition at line 635 of file functional.hh.

Referenced by RVL::FunctionalEvaluation< Scalar >::getMaxStep().

template<class Scalar>
Vector<Scalar> const& RVL::FunctionalEvaluation< Scalar >::getPoint (  )  const

Definition at line 636 of file functional.hh.

template<class Scalar>
Scalar RVL::FunctionalEvaluation< Scalar >::getValue (  )  const

extract value of functional at evaluation point.

Checks to see if latter has been updated; if so, updates internal copy of value.

Definition at line 641 of file functional.hh.

Referenced by RVL::GradientTest().

template<class Scalar>
Vector<Scalar> const& RVL::FunctionalEvaluation< Scalar >::getGradient (  )  const

returns a reference to the gradient of the functional at the current point.

WARNING: It is not safe to save a reference to the gradient. This method should be called to ensure proper recalculation of the gradient when the point changes.

Definition at line 663 of file functional.hh.

Referenced by RVL::FunctionalEvaluation< Scalar >::getGradientNorm(), and RVL::GradientTest().

template<class Scalar>
Scalar RVL::FunctionalEvaluation< Scalar >::getGradientNorm (  )  const

Returns the norm of the gradient of the functional at the current point.

WARNING: It is not safe to save a reference to the gradient. This method (or the getGradient() method) should be called to ensure proper recalculation of the gradient when the point changes.

Definition at line 686 of file functional.hh.

References RVL::FunctionalEvaluation< Scalar >::getGradient().

template<class Scalar>
LinearOp<Scalar> const& RVL::FunctionalEvaluation< Scalar >::getHessian (  )  const

Returns a LinearOp representing the Hessian of the functional.

This LinearOp is a lightweight object that refers back to the evaluation, and get destroyed in the evaluation destructor. It is safe to store a reference to the Hessian for the lifetime of the evaluation.

Definition at line 709 of file functional.hh.

References RVL::FunctionalEvaluation< Scalar >::hess.

template<class Scalar>
Functional<Scalar> const& RVL::FunctionalEvaluation< Scalar >::getFunctional (  )  const

provided to enable extraction of subclass attributes via a cast, from the current internal copy of the underlying Functional.

Definition at line 714 of file functional.hh.

template<class Scalar>
ostream& RVL::FunctionalEvaluation< Scalar >::write ( ostream &  str  )  const [virtual]

Implements RVL::Writeable.

Reimplemented in RVL::FunctionalProductDomainEvaluation< Scalar >.

Definition at line 716 of file functional.hh.


Friends And Related Function Documentation

template<class Scalar>
friend class HessianEvaluation< Scalar > [friend]

Definition at line 426 of file functional.hh.

template<class Scalar>
friend class PartialHessianEvaluation< Scalar > [friend]

Definition at line 427 of file functional.hh.

template<class Scalar>
friend class FcnlOpComp< Scalar > [friend]

Definition at line 428 of file functional.hh.


Member Data Documentation

template<class Scalar>
Components<Scalar> RVL::FunctionalEvaluation< Scalar >::cg [protected]

Definition at line 465 of file functional.hh.

Referenced by RVL::FunctionalEvaluation< Scalar >::getPartialGradient().

template<class Scalar>
HessianEvaluation<Scalar> RVL::FunctionalEvaluation< Scalar >::hess [protected]

Definition at line 466 of file functional.hh.

Referenced by RVL::FunctionalEvaluation< Scalar >::getHessian().


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