#include <space.hh>
Inheritance diagram for RVL::Space< Scalar >:
Public Member Functions | |
Space () | |
Space (const Space< Scalar > &sp) | |
virtual | ~Space () |
virtual DataContainer * | buildDataContainer () 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. |
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.
RVL::Space< Scalar >::Space | ( | ) |
RVL::Space< Scalar >::Space | ( | const Space< Scalar > & | sp | ) |
virtual RVL::Space< Scalar >::~Space | ( | ) | [virtual] |
void* RVL::Space< Scalar >::operator new | ( | size_t | size | ) | [protected] |
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().
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().
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().
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().
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!=().
bool RVL::Space< Scalar >::operator!= | ( | const Space< Scalar > & | sp | ) | const |
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 >.
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().