CVR-Lib last update 20 Sep 2009

cvr::lattice1D< T > Class Template Reference
[Aggregate Data TypesLinear Algebra]

Mathematical lattice1D container class. More...

#include <cvrLattice1D.h>

Inheritance diagram for cvr::lattice1D< T >:

Inheritance graph
[legend]
Collaboration diagram for cvr::lattice1D< T >:

Collaboration graph
[legend]

List of all members.

Public Types

Internal types and classes
typedef
cvr::constReferenceException 
constReferenceException
typedef genericLattice1D< T >
::value_type 
value_type
typedef genericLattice1D< T >
::size_type 
size_type
typedef genericLattice1D< T >
::pointer 
pointer
typedef genericLattice1D< T >
::const_pointer 
const_pointer
typedef genericLattice1D< T >
::reference 
reference
typedef genericLattice1D< T >
::const_reference 
const_reference
typedef genericLattice1D< T >
::iterator 
iterator
typedef genericLattice1D< T >
::const_iterator 
const_iterator

Public Member Functions

 lattice1D ()
 lattice1D (const size_type from, const size_type to)
 lattice1D (const iinterval &indices)
 lattice1D (const size_type from, const size_type to, const_reference iniValue)
 lattice1D (const iinterval &indices, const_reference iniValue)
 lattice1D (const size_type from, const size_type to, const value_type data[])
 lattice1D (const iinterval &indices, const value_type data[])
 lattice1D (const size_type from, const size_type to, value_type data[], const eConstantReference constRef)
 lattice1D (const iinterval &indices, value_type data[], const eConstantReference constRef)
 lattice1D (const genericLattice1D< T > &other)
 lattice1D (const genericLattice1D< T > &other, const size_type from, const size_type to=container::MaxIndex)
 lattice1D (const genericLattice1D< T > &other, const iinterval &indices)
 lattice1D (const std::vector< T > &other, const int firstIndex=0)
 lattice1D (const genericVector< T > &other, const int firstIndex=0)
virtual ~lattice1D ()
const std::string & name () const
virtual lattice1D< T > * clone () const
virtual lattice1D< T > * newInstance () const
bool prettyCloseTo (const genericLattice1D< T > &other, const T &tolerance) const
Arithmetical Operations
dot (const genericLattice1D< T > &other) const
lattice1D< T > & emultiply (const genericLattice1D< T > &other)
lattice1D< T > & emultiply (const genericLattice1D< T > &first, const genericLattice1D< T > &second)
lattice1D< T > & edivide (const genericLattice1D< T > &other)
lattice1D< T > & edivide (const genericLattice1D< T > &first, const genericLattice1D< T > &second)
lattice1D< T > & edivide (const T cst)
lattice1D< T > & edivide (const genericLattice1D< T > &other, const T cst)
lattice1D< T > & add (const genericLattice1D< T > &other)
lattice1D< T > & add (const genericLattice1D< T > &first, const genericLattice1D< T > &second)
lattice1D< T > & add (const T cst)
lattice1D< T > & add (const genericLattice1D< T > &other, const T cst)
lattice1D< T > & operator+= (const T cst)
lattice1D< T > & operator+= (const genericLattice1D< T > &other)
lattice1D< T > & addScaled (const T b, const genericLattice1D< T > &other)
lattice1D< T > & addScaled (const T a, const genericLattice1D< T > &first, const T b, const genericLattice1D< T > &second)
lattice1D< T > & addScaled (const genericLattice1D< T > &first, const T b, const genericLattice1D< T > &second)
lattice1D< T > & subtract (const T cst)
lattice1D< T > & subtract (const genericLattice1D< T > &other, const T cst)
lattice1D< T > & subtract (const genericLattice1D< T > &other)
lattice1D< T > & subtract (const genericLattice1D< T > &first, const genericLattice1D< T > &second)
lattice1D< T > & operator-= (const genericLattice1D< T > &other)
lattice1D< T > & operator-= (const T cst)
lattice1D< T > & multiply (const T cst)
lattice1D< T > & multiply (const genericLattice1D< T > &other, const T cst)
lattice1D< T > & operator*= (const T cst)
lattice1D< T > & divide (const T cst)
lattice1D< T > & divide (const genericLattice1D< T > &other, const T cst)
lattice1D< T > & operator/= (const T cst)
computeSumOfElements () const
computeProductOfElements () const
Find extreme values
findMinimum () const
int findIndexOfMinimum () const
findMaximum () const
int findIndexOfMaximum () const
void findExtremes (T &theMinimum, T &theMaximum) const
void findIndexOfExtremes (int &theIdxMinimum, int &theIdxMaximum) const


Detailed Description

template<typename T>
class cvr::lattice1D< T >

Mathematical lattice1D container class.

This container is inspired on mathematical integer lattices, at least with respect to the indices, which are taken from $Z^n$ in the general case with $n=1$ in this particular case.

You can consider this a generalization of a cvr::vector, in which the index of the first element is not necessarily zero, but a negative or positive value.

The main goal of this class is to provide a fast implementation for random access containers, addressable with negative indices, like filter kernels, and since speed is the premise, it is achieved at some memory costs. This means this class has some storage overhead in order to provide some information at zero time, like size, first and last indices the begin and end iterators, etc., which is only possible by storing them directly.

Additionally to all functionality of the genericLattice1D, this class provides additional arithmetical and mathematical operations.

The following types are supported by cvr::lattice1D:

This restriction is done to avoid the typical template code explosion due to frequently used types in the library. If you need the lattice1D as container of any other type, consider using cvr::genericLattice1D.

The lattice1D class is a container class implemented as template, where the template type T denotes the type of the elements. It is by no means a generic container, since the types it supports must fulfill many requirements, specially support for all arithmetical operators, and the types supported are explicitely instantiated in the library.


Member Typedef Documentation

template<typename T>
typedef genericLattice1D<T>::const_iterator cvr::lattice1D< T >::const_iterator

const_iterator type (allows read-only operations).

The use of the iterator classes is similar to the iterators of the STL (Standard Template Library). See cvr::genericLattice1D::begin() for an example.

For the debugging version of the iterators, boundary check will be done! This explains the low speed of the iterators of the debug version. In the release version, no boundary check will be done, and the iterators are sometimes a factor 10 faster than the debug iterators.

The use of the access operator at() is faster than the iterators in the debug version only. If you need to iterate on a genericLattice1D use iterators instead (in the release version iterators are approximately a factor 3 faster than at()).

Warning:
Try to use the prefix incremental operator (i.e. ++it) instead of the postfix operator (i.e. it++) to allow efficient code also in debug-modus!
See also:
genericLattice1D<T>::iterator

Reimplemented from cvr::genericLattice1D< T >.

Reimplemented in cvr::kernel1D< T >.

template<typename T>
typedef genericLattice1D<T>::const_pointer cvr::lattice1D< T >::const_pointer

Const pointer to value_type.

Reimplemented from cvr::genericLattice1D< T >.

Reimplemented in cvr::kernel1D< T >.

template<typename T>
typedef genericLattice1D<T>::const_reference cvr::lattice1D< T >::const_reference

Const reference to value_type.

Reimplemented from cvr::genericLattice1D< T >.

Reimplemented in cvr::kernel1D< T >.

Exception thrown when a constant reference is violated.

Reimplemented from cvr::genericLattice1D< T >.

template<typename T>
typedef genericLattice1D<T>::iterator cvr::lattice1D< T >::iterator

iterator type (allows read and write operations).

The use of the iterator classes is similar to the iterators of the STL (Standard Template Library). See cvr::genericLattice1D::begin() and cvr::genericLattice1D::inverseBegin() for examples.

For the debugging version of the iterators, boundary check will be done! This explains the low speed of the iterators of the debug version. In the release version, no boundary check will be done, and the iterators are sometimes a factor 10 faster than the debug iterators.

The use of the access operator at() is faster than the iterators in the debug version only. If you need to iterate on a genericLattice1D use iterators instead (in the release version iterators are approximately a factor 3 faster than at()).

Warning:
Try to use the prefix incremental operator (i.e. ++it) instead of the postfix operator (i.e. it++) to allow efficient code also in debug-modus!
See also:
genericLattice1D<T>::const_iterator

Reimplemented from cvr::genericLattice1D< T >.

Reimplemented in cvr::kernel1D< T >.

template<typename T>
typedef genericLattice1D<T>::pointer cvr::lattice1D< T >::pointer

Pointer to value_type.

Reimplemented from cvr::genericLattice1D< T >.

Reimplemented in cvr::kernel1D< T >.

template<typename T>
typedef genericLattice1D<T>::reference cvr::lattice1D< T >::reference

Reference to value_type.

Reimplemented from cvr::genericLattice1D< T >.

Reimplemented in cvr::kernel1D< T >.

template<typename T>
typedef genericLattice1D<T>::size_type cvr::lattice1D< T >::size_type

Return type of the size() member.

Reimplemented from cvr::genericLattice1D< T >.

Reimplemented in cvr::kernel1D< T >.

template<typename T>
typedef genericLattice1D<T>::value_type cvr::lattice1D< T >::value_type

Type of the genericLattice1D elements.

Reimplemented from cvr::genericLattice1D< T >.

Reimplemented in cvr::kernel1D< T >.


Constructor & Destructor Documentation

template<typename T>
cvr::lattice1D< T >::lattice1D (  ) 

Default constructor creates an empty lattice1D;.

template<typename T>
cvr::lattice1D< T >::lattice1D ( const size_type  from,
const size_type  to 
) [explicit]

Create a lattice1D indexed by the given interval but do not initialize its elements.

Parameters:
from initial index.
to final index.
The size of the container will be to-from+1. The to value must be greater or equal than the from value, otherwise an empty lattice will be created.

template<typename T>
cvr::lattice1D< T >::lattice1D ( const iinterval indices  )  [explicit]

Create a lattice1D indexed by the given interval but do not initialize its elements.

Parameters:
indices interval of indices to be used.

template<typename T>
cvr::lattice1D< T >::lattice1D ( const size_type  from,
const size_type  to,
const_reference  iniValue 
) [explicit]

Create a lattice1D indexed by the given interval and initialize it with the given value.

Parameters:
from initial index value
to final index value
iniValue all elements will be initialized with this value.

template<typename T>
cvr::lattice1D< T >::lattice1D ( const iinterval indices,
const_reference  iniValue 
) [explicit]

Create a lattice1D indexed by the given interval and initialize it with the given value.

Parameters:
indices index interval
iniValue all elements will be initialized with this value.

template<typename T>
cvr::lattice1D< T >::lattice1D ( const size_type  from,
const size_type  to,
const value_type  data[] 
)

Create a lattice1D indexed by the given interval and initialize it with the given data.

The data will be copied.

If you need to just use the memory block without copying it, then you can wether use a third parameter of eConstantReference type or later call the useExternData() method.

See also:
useExternData()
Parameters:
from initial index value
to final index value
data a pointer to the data that will be copied.

template<typename T>
cvr::lattice1D< T >::lattice1D ( const iinterval indices,
const value_type  data[] 
)

Create a lattice1D indexed by the given interval and initialize it with the given data.

The data will be copied.

If you need to just use the memory block without copying it, then you can wether use a third parameter of eConstantReference type or later call the useExternData() method.

See also:
useExternData()
Parameters:
indices index interval
data a pointer to the data that will be copied.

template<typename T>
cvr::lattice1D< T >::lattice1D ( const size_type  from,
const size_type  to,
value_type  data[],
const eConstantReference  constRef 
)

Create a lattice1D indexed by the given interval and initialize it with the given data, the same way "useExternData" does, i.e.

the data will not be copied!.

See also:
useExternData()
Parameters:
from initial index
to final index
data a pointer to the data that will be used.
constRef if this parameter is ConstantReference it will not be possible to change the pointer to the external memory block nor to resize the lattice1D. Despite this, the value of each element can be changed by the access operators.

template<typename T>
cvr::lattice1D< T >::lattice1D ( const iinterval indices,
value_type  data[],
const eConstantReference  constRef 
)

Create a lattice1D indexed by the given interval and initialize it with the given data, the same way "useExternData" does, i.e.

the data will not be copied!.

See also:
useExternData()
Parameters:
indices interval used for the lattice indices
data a pointer to the data that will be used.
constRef if this parameter is ConstantReference it will not be possible to change the pointer to the external memory block nor to resize the lattice1D. Despite this, the value of each element can be changed by the access operators.

template<typename T>
cvr::lattice1D< T >::lattice1D ( const genericLattice1D< T > &  other  ) 

Create this lattice1D as a copy of another lattice1D.

Parameters:
other the lattice1D to be copied.

template<typename T>
cvr::lattice1D< T >::lattice1D ( const genericLattice1D< T > &  other,
const size_type  from,
const size_type  to = container::MaxIndex 
)

Create this lattice1D as a copy of the specified interval of elements of another lattice1D.

The from and to values are truncated to the interval used by the other lattice.

Parameters:
other the lattice1D to be copied.
from starting index of other lattice.
to end index of the other lattice.

template<typename T>
cvr::lattice1D< T >::lattice1D ( const genericLattice1D< T > &  other,
const iinterval indices 
)

Create this lattice1D as a copy of the specified interval of elements of another lattice1D.

The from and to values are truncated to the interval used by the other lattice.

Parameters:
other the lattice1D to be copied.
indices index interval of the elements of other to be copied.

template<typename T>
cvr::lattice1D< T >::lattice1D ( const std::vector< T > &  other,
const int  firstIndex = 0 
)

Create this lattice1D as a copy of another std::vector<T>.

Parameters:
other the lattice1D to be copied.
firstIndex index used for the first element of the vector.

template<typename T>
cvr::lattice1D< T >::lattice1D ( const genericVector< T > &  other,
const int  firstIndex = 0 
)

Create this lattice1D as a copy of another cvr::genericVector.

Parameters:
other the lattice1D to be copied.
firstIndex optional argument indicating which index is going to be assigned to the first vector element.

template<typename T>
virtual cvr::lattice1D< T >::~lattice1D (  )  [virtual]

Destructor.


Member Function Documentation

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::add ( const genericLattice1D< T > &  other,
const T  cst 
)

Add constant to the other lattice1D and leave the result here.

Returns a reference to this lattice1D.

Parameters:
other the other lattice1D
cst constant scalar to be added with each element of the other lattice1D
Returns:
a reference to the actual lattice1D

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::add ( const T  cst  ) 

Add constant to this lattice1D.

This lattice1D is changed. Returns this lattice1D.

Parameters:
cst constant scalar to be added with each element
Returns:
a reference to the actual lattice1D

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::add ( const genericLattice1D< T > &  first,
const genericLattice1D< T > &  second 
)

Add two lattice1D and leave the result in this object.

If both lattice1Ds have different size, an assertion will be thrown

Parameters:
first the first lattice1D
second the second lattice1D will be added with the first lattice1D
Returns:
a reference to the actual lattice1D

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::add ( const genericLattice1D< T > &  other  ) 

Add another lattice1D of the same type and same dimension and leave the result in this object.

If both lattice1Ds have different size, an assertion will be thrown

Parameters:
other the other lattice1D to be added with
Returns:
a reference to the actual lattice1D

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::addScaled ( const genericLattice1D< T > &  first,
const T  b,
const genericLattice1D< T > &  second 
)

Leave the addition of the first lattice1D and the second lattice1D scaled with the given factor in this lattice1D.

The lattice1Ds must be of the same types and dimensions. Let A be the first lattice1D and B the second lattice1D with corresponding scaling factor b, further C this lattice1D, then this method performs:

$C=A+b\cdot B$ If both lattice1Ds have different size, an assertion will be thrown

Parameters:
first the first lattice1D to be added after scaling
b scaling factor for second
second the second lattice1D to be added after scaling
Returns:
a reference to this lattice1D

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::addScaled ( const T  a,
const genericLattice1D< T > &  first,
const T  b,
const genericLattice1D< T > &  second 
)

Leave the scaled sum of two lattice1Ds in this lattice1D.

The lattice1Ds must be of the same types and dimensions. Let A be the first lattice1D and B the second lattice1D with corresponding scaling factors a and b, further C this lattice1D, then this method performs:

$C=a\cdot A+b\cdot B$ If both lattice1Ds have different size, an assertion will be thrown

Parameters:
a scaling factor for first
first the first lattice1D to be added after scaling
b scaling factor for second
second the second lattice1D to be added after scaling
Returns:
a reference to this lattice1D

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::addScaled ( const T  b,
const genericLattice1D< T > &  other 
)

Add another lattice1D scaled by b to this lattice1D.

The lattice1Ds must be of the same types and dimensions. Let A be this lattice1D and B the other lattice1D, then this method performs:

$A=A+b\cdot B$ If both lattice1Ds have different size, an assertion will be thrown

Parameters:
b scaling factor for other
other the lattice1D to be added after scaling
Returns:
a reference to this lattice1D

template<typename T>
virtual lattice1D<T>* cvr::lattice1D< T >::clone (  )  const [virtual]

Create a clone of this lattice1D.

Returns:
a pointer to a copy of this lattice1D

Reimplemented from cvr::genericLattice1D< T >.

Reimplemented in cvr::kernel1D< T >.

template<typename T>
T cvr::lattice1D< T >::computeProductOfElements (  )  const

Calculate the product of all elements of the lattice1D.

This member can be used with classes which define the operator '*='

template<typename T>
T cvr::lattice1D< T >::computeSumOfElements (  )  const

Calculate the sum of all elements of the lattice1D.

This member can be used with classes which define the operator '+='

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::divide ( const genericLattice1D< T > &  other,
const T  cst 
)

Divide the other lattice1D by a constant and leave the result here.

Returns a reference to this lattice1D.

Parameters:
other the lattice1D to be divide by the constant value
cst the elements of the lattice1D will be divided with this constant
Returns:
a reference to the actual lattice1D

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::divide ( const T  cst  ) 

Divide this lattice1D by a constant.

This lattice1D will changed! Returns this lattice1D.

Parameters:
cst the elements of the lattice1D will be divided with this constant
Returns:
a reference to the actual lattice1D

template<typename T>
T cvr::lattice1D< T >::dot ( const genericLattice1D< T > &  other  )  const

Dot product with another lattice1D of the same type.

The dot product of lattices is here defined as the sum of the products of elements sharing the same indices. If the lattices have different definition intervals, then only the common interval will be considered (as it will be assumed that the other lattice has a zero in all other undefined elements.

Parameters:
other the other lattice1D to be multiplied with
Returns:
a scalar value with the type of the lattice1D elements

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::edivide ( const genericLattice1D< T > &  other,
const T  cst 
) [inline]

Divide the other lattice1D with a constant and leave the result here.

Returns a reference to this lattice1D.

synonym for divide(const lattice1D<T>& other,const T cst).

Parameters:
other the lattice1D to be divide by the constant value
cst the elements of the lattice1D will be divided with this constant
Returns:
a reference to the actual lattice1D

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::edivide ( const T  cst  )  [inline]

Divide this lattice1D with a constant.

This lattice1D will be changed! Returns this lattice1D. synonym for divide(const T cst).

Parameters:
cst the elements of the lattice1D will be divided with this constant
Returns:
a reference to the actual lattice1D

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::edivide ( const genericLattice1D< T > &  first,
const genericLattice1D< T > &  second 
)

Elementwise division.

This lattice1D will contain the elementwise division of the elements in first by second.

If both lattice1Ds have different definition intervals, an assertion will be thrown

Parameters:
first the first lattice1D
second the second lattice1D, is the divisor
Returns:
a reference to the actual lattice1D

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::edivide ( const genericLattice1D< T > &  other  ) 

Elementwise division.

Each element of this lattice1D will be divided by the elements of the other lattice1D and the result will be left in this object! The returned lattice1D is this object!

If both lattice1Ds have different definition intervals, an assertion will be thrown.

Parameters:
other the other lattice1D to be divided by
Returns:
a reference to the actual lattice1D

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::emultiply ( const genericLattice1D< T > &  first,
const genericLattice1D< T > &  second 
)

Elementwise multiplication.

This lattice1D will contain the elementwise multiplication of the elements in first and second.

If both lattice1Ds have different definition intervals, an assertion will be thrown.

Parameters:
first the first lattice1D
second the second lattice1D will be multiplied with the first lattice1D
Returns:
a reference to the actual lattice1D

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::emultiply ( const genericLattice1D< T > &  other  ) 

Elementwise multiplication.

Each element of this lattice1D will be multiplied with the corresponding elements of the other lattice1D and the result will be left in this object!

If both lattice1Ds have different definition intervals, an assertion will be thrown.

Parameters:
other the other lattice1D to be multiplied with
Returns:
a reference to the actual lattice1D

template<typename T>
void cvr::lattice1D< T >::findExtremes ( T &  theMinimum,
T &  theMaximum 
) const

Find the extremes of the lattice1D (smallest and biggest elements).

template<typename T>
void cvr::lattice1D< T >::findIndexOfExtremes ( int &  theIdxMinimum,
int &  theIdxMaximum 
) const

Find the indices of the extremes of the lattice1D (smallest and biggest elements).

template<typename T>
int cvr::lattice1D< T >::findIndexOfMaximum (  )  const

Find the index of the biggest element of the lattice1D.

template<typename T>
int cvr::lattice1D< T >::findIndexOfMinimum (  )  const

Find the index of the smallest element of the lattice1D.

template<typename T>
T cvr::lattice1D< T >::findMaximum (  )  const

Find the biggest element of the lattice1D.

template<typename T>
T cvr::lattice1D< T >::findMinimum (  )  const

Find the smallest element of the lattice1D.

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::multiply ( const genericLattice1D< T > &  other,
const T  cst 
)

Multiply the other lattice1D with a constant and leave the result here.

Returns a reference to this lattice1D. If both lattice1Ds have different size, an assertion will be thrown

Parameters:
other the other lattice1D to be multiplied with the constant value
cst constant scalar to be multiplied with the other lattice1D.
Returns:
a reference to the actual lattice1D

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::multiply ( const T  cst  ) 

Multiply this lattice1D with a constant.

This lattice1D will changed! Returns this lattice1D. If both lattice1Ds have different size, an assertion will be thrown

Parameters:
cst constant scalar to be multiplied with
Returns:
a reference to the actual lattice1D

template<typename T>
const std::string& cvr::lattice1D< T >::name (  )  const [virtual]

Returns the name of this class.

Reimplemented from cvr::genericLattice1D< T >.

Reimplemented in cvr::kernel1D< T >.

template<typename T>
virtual lattice1D<T>* cvr::lattice1D< T >::newInstance (  )  const [virtual]

Create a new lattice1D instance.

Returns:
a pointer to a new instance of lattice1D

Reimplemented from cvr::genericLattice1D< T >.

Reimplemented in cvr::kernel1D< T >.

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::operator*= ( const T  cst  ) 

Multiply with a constant.

This lattice1D is changed.

Parameters:
cst constant scalar to be multiplied with
Returns:
a reference to the actual lattice1D

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::operator+= ( const genericLattice1D< T > &  other  )  [inline]

Alias for add(const lattice1D<T>& other).

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::operator+= ( const T  cst  )  [inline]

Alias for add(const T cst).

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::operator-= ( const T  cst  ) 

Alias for subtract(const T& cst).

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::operator-= ( const genericLattice1D< T > &  other  )  [inline]

Alias for substract(const lattice1D<T>& other) If both lattice1Ds have different size, an assertion will be thrown.

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::operator/= ( const T  cst  ) 

Alias for divide(const T& cst).

template<typename T>
bool cvr::lattice1D< T >::prettyCloseTo ( const genericLattice1D< T > &  other,
const T &  tolerance 
) const

Compare this lattice1D with other, and use the given tolerance to determine if the value of each element of the other lattice1D approximately equals the values of the actual lattice1D elements.

An element x is approximately equal to another element y with a tolerance t, if following equation holds: x-t < y < x+t.

Both lattices must have exactly the same definition interval. Otherwise false is returned.

Parameters:
other the other lattice1D to be compared with
tolerance the tolerance to be used
Returns:
true if both lattice1Ds are approximatly equal

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::subtract ( const genericLattice1D< T > &  first,
const genericLattice1D< T > &  second 
)

Subtracts two lattice1Ds and leaves the result in this object.

If both lattice1Ds have different size, an assertion will be thrown

Parameters:
first the first lattice1D
second the second lattice1D will be substracted from the first lattice1D
Returns:
a reference to the actual lattice1D

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::subtract ( const genericLattice1D< T > &  other  ) 

Subtracts another lattice1D of the same type and same dimension and leaves the result in this object If both lattice1Ds have different size, an assertion will be thrown.

Parameters:
other will be substracted from this lattice1D
Returns:
a reference to the actual lattice1D

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::subtract ( const genericLattice1D< T > &  other,
const T  cst 
)

Subtract constant from the other lattice1D and leave the result here.

Returns a reference to this lattice1D.

Parameters:
other the other lattice1D
cst constant scalar to be subtracted from each element of the other lattice1D
Returns:
a reference to the actual lattice1D

template<typename T>
lattice1D<T>& cvr::lattice1D< T >::subtract ( const T  cst  ) 

Subtract constant from this lattice1D.

This lattice1D is changed. Returns this lattice1D.

Parameters:
cst constant scalar to be subtracted from each element
Returns:
a reference to the actual lattice1D


The documentation for this class was generated from the following file:

Generated on Sun Sep 20 22:08:59 2009 for CVR-Lib by Doxygen 1.5.8