RVL::Space< Scalar > Class Template Reference

RVL abstract base class for Hilbert Spaces. More...

#include <space.hh>

Inheritance diagram for RVL::Space< Scalar >:

RVL::Writeable RVL::ProductSpace< Scalar > RVL::StdSpace< Scalar, DataType > RVL::CartesianPowerSpace< Scalar > RVL::StdProductSpace< Scalar > List of all members.

Public Member Functions

 Space ()
 Space (const Space< Scalar > &sp)
virtual ~Space ()
virtual DataContainerbuildDataContainer () const =0
 returns a dynamically allocated DataContainer.
virtual bool operator== (const Space< Scalar > &sp) const =0
 compare two vector spaces - useful for sanity checking in applications
bool operator!= (const Space< Scalar > &sp) const
virtual bool isCompatible (DataContainer const &dc) const =0
 detect compatibility with foreign data container - also useful for sanity checking
virtual Scalar inner (DataContainer const &x, DataContainer const &y) const =0
 inner product
virtual void zero (DataContainer &x) const =0
 assign to data of zero vector
virtual void linComb (Scalar a, DataContainer const &x, Scalar b, DataContainer &y) const =0
 linear combination y=ax+by.
virtual void copy (DataContainer &tgt, DataContainer const &src) const
 Copy: target may not be aliased with source.
virtual void negate (DataContainer &tgt) const
 negate, unary version.
virtual void negate (DataContainer &tgt, DataContainer const &src) const
 negation, binary version.
virtual void scale (DataContainer &tgt, Scalar c) const
 scale, unary version.
virtual void scale (DataContainer &tgt, Scalar c, DataContainer const &src) const
 Scale, binary version.
NormRetType normsq (DataContainer const &x) const
 return Norm Squared.
NormRetType norm (DataContainer const &x) const
 return Norm.

Static Public Member Functions

static std::shared_ptr< Space<
Scalar > > 
clonePtr (Space< Scalar > const &sp)
 class method for safe dynamic allocation

Protected Member Functions

void * operator new (size_t size)
virtual Space< Scalar > * clone () const =0
 Except within other space classes acting as containers, Spaces should always be allocated on the stack.

Static Protected Member Functions

static Space< Scalar > * export_clone (Space< Scalar > const &sp)
 An export version of clone allows Space container classes to own dynamically allocated instances of other spaces, by dynamic copy construction.

Detailed Description

template<class Scalar>
class RVL::Space< Scalar >

RVL abstract base class for Hilbert Spaces.

A vector space over a field of scalars is set of objects, called vectors, together with two operations, scalar multiplication and vector addition, obeying certain axioms. Hilbert spaces add inner product op.

Access to vector objects is implemented through access to their underlying data structures (DataContainers). The build() method returns a pointer to a dynamically allocated DataContainer.

The three linear algebra methods "teach the DataContainer how to behave like a vector" (S. Scott, Y2K).

Definition at line 56 of file space.hh.


Constructor & Destructor Documentation

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

Definition at line 95 of file space.hh.

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

Definition at line 96 of file space.hh.

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

Definition at line 97 of file space.hh.


Member Function Documentation

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

Definition at line 64 of file space.hh.

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

Except within other space classes acting as containers, Spaces should always be allocated on the stack.

Various RVL classes store Space references as data members, and RVL does not reference count. Therefore public dynamic allocation of Spaces risks dangling references. However dynamic space construction in containers (intrusive handles) does not create such a risk. The virtual copy constructor (clone) method is protected, to avoid any possibility of dangling references.

Version 1.0: for those who must, we will allow dynamically allocated spaces - caveat emptor!

Implemented in RVL::StdProductSpace< Scalar >, and RVL::CartesianPowerSpace< Scalar >.

Referenced by RVL::Space< Scalar >::export_clone().

template<class Scalar>
static Space<Scalar>* RVL::Space< Scalar >::export_clone ( Space< Scalar > const &  sp  )  [static, protected]

An export version of clone allows Space container classes to own dynamically allocated instances of other spaces, by dynamic copy construction.

Definition at line 89 of file space.hh.

References RVL::Space< Scalar >::clone().

Referenced by RVL::Space< Scalar >::clonePtr(), RVL::StdProductSpace< Scalar >::set(), and RVL::StdProductSpace< Scalar >::StdProductSpace().

template<class Scalar>
static std::shared_ptr< Space<Scalar> > RVL::Space< Scalar >::clonePtr ( Space< Scalar > const &  sp  )  [static]

class method for safe dynamic allocation

Definition at line 100 of file space.hh.

References RVL::Space< Scalar >::export_clone().

template<class Scalar>
virtual DataContainer* RVL::Space< Scalar >::buildDataContainer (  )  const [pure virtual]

returns a dynamically allocated DataContainer.

The type of this datacontainer encodes the data structure which realizes the storage appropriate for vectors in this space.

Implemented in RVL::StdProductSpace< Scalar >, RVL::CartesianPowerSpace< Scalar >, and RVL::StdSpace< Scalar, DataType >.

Referenced by RVL::Space< Scalar >::negate(), and RVL::Space< Scalar >::scale().

template<class Scalar>
virtual bool RVL::Space< Scalar >::operator== ( const Space< Scalar > &  sp  )  const [pure virtual]

compare two vector spaces - useful for sanity checking in applications

Implemented in RVL::ProductSpace< Scalar >, RVL::CartesianPowerSpace< Scalar >, and RVL::StdSpace< Scalar, DataType >.

Referenced by RVL::Space< Scalar >::operator!=().

template<class Scalar>
bool RVL::Space< Scalar >::operator!= ( const Space< Scalar > &  sp  )  const

Definition at line 114 of file space.hh.

References RVL::Space< Scalar >::operator==().

template<class Scalar>
virtual bool RVL::Space< Scalar >::isCompatible ( DataContainer const &  dc  )  const [pure virtual]

detect compatibility with foreign data container - also useful for sanity checking

Implemented in RVL::ProductSpace< Scalar >, RVL::CartesianPowerSpace< Scalar >, and RVL::StdSpace< Scalar, DataType >.

template<class Scalar>
virtual Scalar RVL::Space< Scalar >::inner ( DataContainer const &  x,
DataContainer const &  y 
) const [pure virtual]

inner product

Implemented in RVL::ProductSpace< Scalar >, RVL::CartesianPowerSpace< Scalar >, and RVL::StdSpace< Scalar, DataType >.

Referenced by RVL::Space< Scalar >::normsq().

template<class Scalar>
virtual void RVL::Space< Scalar >::zero ( DataContainer x  )  const [pure virtual]

assign to data of zero vector

Implemented in RVL::ProductSpace< Scalar >, RVL::CartesianPowerSpace< Scalar >, and RVL::StdSpace< Scalar, DataType >.

Referenced by RVL::Space< Scalar >::scale().

template<class Scalar>
virtual void RVL::Space< Scalar >::linComb ( Scalar  a,
DataContainer const &  x,
Scalar  b,
DataContainer y 
) const [pure virtual]

linear combination y=ax+by.

Output argument y may not be alised with input argument x.

Implemented in RVL::ProductSpace< Scalar >, RVL::CartesianPowerSpace< Scalar >, and RVL::StdSpace< Scalar, DataType >.

Referenced by RVL::Space< Scalar >::copy(), RVL::Space< Scalar >::negate(), and RVL::Space< Scalar >::scale().

template<class Scalar>
virtual void RVL::Space< Scalar >::copy ( DataContainer tgt,
DataContainer const &  src 
) const [virtual]

Copy: target may not be aliased with source.

Definition at line 149 of file space.hh.

References RVL::Space< Scalar >::linComb().

template<class Scalar>
virtual void RVL::Space< Scalar >::negate ( DataContainer tgt  )  const [virtual]

negate, unary version.

Can be efficient with careful implementation of DC classes and linComb, so that unreferenced memory is not allocated. Else this implementation can be overridden.

Definition at line 166 of file space.hh.

References RVL::Space< Scalar >::buildDataContainer(), and RVL::Space< Scalar >::linComb().

template<class Scalar>
virtual void RVL::Space< Scalar >::negate ( DataContainer tgt,
DataContainer const &  src 
) const [virtual]

negation, binary version.

Target may not be aliased with source.

Definition at line 181 of file space.hh.

References RVL::Space< Scalar >::linComb().

template<class Scalar>
virtual void RVL::Space< Scalar >::scale ( DataContainer tgt,
Scalar  c 
) const [virtual]

scale, unary version.

Can be efficient with careful implementation of DC classes and linComb, so that unreferenced memory is not allocated. Else this implementation can be overridden.

Definition at line 199 of file space.hh.

References RVL::Space< Scalar >::buildDataContainer(), RVL::Space< Scalar >::linComb(), and RVL::Space< Scalar >::zero().

template<class Scalar>
virtual void RVL::Space< Scalar >::scale ( DataContainer tgt,
Scalar  c,
DataContainer const &  src 
) const [virtual]

Scale, binary version.

Target may not be aliased with source.

Definition at line 215 of file space.hh.

References RVL::Space< Scalar >::linComb().

template<class Scalar>
NormRetType RVL::Space< Scalar >::normsq ( DataContainer const &  x  )  const

return Norm Squared.

The norm always returns a non-negative real number

Definition at line 230 of file space.hh.

References RVL::Space< Scalar >::inner().

Referenced by RVL::Space< Scalar >::norm().

template<class Scalar>
NormRetType RVL::Space< Scalar >::norm ( DataContainer const &  x  )  const

return Norm.

The norm always returns a non-negative real number

Definition at line 241 of file space.hh.

References RVL::Space< Scalar >::normsq().


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