RVL::LinCombFunctional< Scalar > Class Template Reference

LinCombFunctional is a concrete class implementing a linear combination of two or more Functional instances. More...

#include <functional.hh>

Inheritance diagram for RVL::LinCombFunctional< Scalar >:

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

Public Member Functions

 LinCombFunctional ()
 LinCombFunctional (LinCombFunctional< Scalar > const &fn)
 LinCombFunctional (Scalar a1, const Functional< Scalar > &fn1, Scalar a2, const Functional< Scalar > &fn2)
 ~LinCombFunctional ()
const Space< Scalar > & getDomain () const
 access to domain and range
ostream & write (ostream &str) const

Protected Member Functions

void apply (const Vector< Scalar > &x, Scalar &val) const
void applyGradient (const Vector< Scalar > &x, Vector< Scalar > &g) const
void applyHessian (const Vector< Scalar > &x, const Vector< Scalar > &dx, Vector< Scalar > &dy) const
Functional< Scalar > * clone () const

Detailed Description

template<class Scalar>
class RVL::LinCombFunctional< Scalar >

LinCombFunctional is a concrete class implementing a linear combination of two or more Functional instances.

To construct the Functional M = 2L1-3.7L2+9.0L3, where L1, L2 and L3 are Functional instances,

LinCombFunctional<float> M; M.setNext(2.0,L1); M.setNext(-3.7,L2); M.setNext(9.0,L3);

Because linear combinations of two Functionals occur frequently, and for backwards compatibility, a special constructor is provided for this case:

LinCombFunctional<float> M(2.0,L1,-3.7,L2);

constructs M = 2L1-3.7L2.

Post-construction initialization permits linear combinations of arbitrary length, but requires that the user signal when the initialization is complete, so that well-defined behaviour results. As in OpComp, this class uses the convention that the first non-initialization method call flags the completion of the linear combination. No subsequent modifications are permitted.

The domain is determined by the Functional in the first summand. All subsequent summands are checked for matching domain as they are submitted.

Definition at line 922 of file functional.hh.


Constructor & Destructor Documentation

template<class Scalar>
RVL::LinCombFunctional< Scalar >::LinCombFunctional (  ) 

Definition at line 1049 of file functional.hh.

template<class Scalar>
RVL::LinCombFunctional< Scalar >::LinCombFunctional ( LinCombFunctional< Scalar > const &  fn  ) 

Definition at line 1050 of file functional.hh.

References RVL::LinCombFunctional< Scalar >::fnvec, and RVL::LinCombFunctional< Scalar >::wtvec.

template<class Scalar>
RVL::LinCombFunctional< Scalar >::LinCombFunctional ( Scalar  a1,
const Functional< Scalar > &  fn1,
Scalar  a2,
const Functional< Scalar > &  fn2 
)

Definition at line 1063 of file functional.hh.

References RVL::Functional< Scalar >::clone(), RVL::Functional< Scalar >::getDomain(), and RVL::Writeable::write().

template<class Scalar>
RVL::LinCombFunctional< Scalar >::~LinCombFunctional (  ) 

Definition at line 1088 of file functional.hh.


Member Function Documentation

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

Implements RVL::Functional< Scalar >.

Definition at line 962 of file functional.hh.

References RVL::Functional< Scalar >::export_apply().

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

Implements RVL::Functional< Scalar >.

Definition at line 989 of file functional.hh.

References RVL::Functional< Scalar >::export_applyGradient(), RVL::LinCombFunctional< Scalar >::getDomain(), RVL::Vector< Scalar >::linComb(), and RVL::Vector< Scalar >::scale().

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

Implements RVL::Functional< Scalar >.

Definition at line 1015 of file functional.hh.

References RVL::Functional< Scalar >::export_applyHessian(), RVL::LinCombFunctional< Scalar >::getDomain(), RVL::Vector< Scalar >::linComb(), and RVL::Vector< Scalar >::scale().

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

Implements RVL::Functional< Scalar >.

Definition at line 1042 of file functional.hh.

template<class Scalar>
const Space<Scalar>& RVL::LinCombFunctional< Scalar >::getDomain (  )  const [virtual]

access to domain and range

Implements RVL::Functional< Scalar >.

Definition at line 1093 of file functional.hh.

Referenced by RVL::LinCombFunctional< Scalar >::applyGradient(), and RVL::LinCombFunctional< Scalar >::applyHessian().

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

Implements RVL::Writeable.

Definition at line 1110 of file functional.hh.


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