last update 20 Sep 2009 |
#include <cvrLattice2D.h>
Public Types | |
Internal classes and types | |
typedef genericLattice2D< T > ::value_type | value_type |
typedef genericLattice2D< T > ::size_type | size_type |
typedef lattice1D< T > | row_type |
typedef genericLattice2D< T > ::pointer | pointer |
typedef genericLattice2D< T > ::const_pointer | const_pointer |
typedef genericLattice2D< T > ::reference | reference |
typedef genericLattice2D< T > ::const_reference | const_reference |
typedef genericLattice2D< T > ::iterator | iterator |
typedef genericLattice2D< T > ::const_iterator | const_iterator |
Public Member Functions | |
lattice2D () | |
lattice2D (const int fromRow, const int fromCol, const int toRow, const int toCol) | |
lattice2D (const size_type &from, const size_type &to) | |
lattice2D (const iinterval &rows, const iinterval &columns) | |
lattice2D (const int fromRow, const int fromCol, const int toRow, const int toCol, const T &value) | |
lattice2D (const size_type &from, const size_type &to, const T &value) | |
lattice2D (const iinterval &rows, const iinterval &columns, const T &value) | |
lattice2D (const int fromRow, const int fromCol, const int toRow, const int toCol, const T data[]) | |
lattice2D (const size_type &from, const size_type &to, const T data[]) | |
lattice2D (const iinterval &rows, const iinterval &columns, const T data[]) | |
lattice2D (const int fromRow, const int fromCol, const int toRow, const int toCol, T data[], const eConstantReference constRef) | |
lattice2D (const size_type &from, const size_type &to, T data[], const eConstantReference constRef) | |
lattice2D (const iinterval &rows, const iinterval &columns, T data[], const eConstantReference constRef) | |
lattice2D (const genericLattice2D< T > &other) | |
lattice2D (const genericLattice2D< T > &other, const int fromRow, const int fromCol, const int toRow=container::MaxIndex, const int toCol=container::MaxIndex) | |
lattice2D (const genericLattice2D< T > &other, const size_type &from, const size_type &to) | |
lattice2D (const genericLattice2D< T > &other, const iinterval &rows, const iinterval &columns) | |
lattice2D (const genericLattice2D< T > &other, const genericLattice1D< int > &rows) | |
virtual | ~lattice2D () |
row_type & | getRow (const int row) |
const row_type & | getRow (const int row) const |
row_type & | operator[] (const int row) |
const row_type & | operator[] (const int row) const |
row_type | getRowCopy (const int row) const |
void | getRowCopy (const int row, row_type &theRow) const |
row_type | getColumnCopy (const int col) const |
void | getColumnCopy (const int col, row_type &theCol) const |
lattice2D< T > & | copy (const genericLattice2D< T > &other) |
lattice2D< T > & | copy (const genericLattice2D< T > &other, const int fromRow, const int fromCol, const int toRow=container::MaxIndex, const int toCol=container::MaxIndex) |
lattice2D< T > & | copy (const genericLattice2D< T > &other, const size_type &from, const size_type &to) |
lattice2D< T > & | copy (const genericLattice2D< T > &other, const iinterval &r, const iinterval &c) |
lattice2D< T > & | copy (const genericLattice2D< T > &other, const irectangle &window) |
lattice2D< T > & | copyRows (const genericLattice2D< T > &other, const genericLattice1D< int > &idx) |
lattice2D< T > & | copyColumns (const genericLattice2D< T > &other, const genericLattice1D< int > &idx) |
template<typename U > | |
lattice2D< T > & | castFrom (const genericLattice2D< U > &other) |
lattice2D< T > & | castFrom (const genericLattice2D< T > &other) |
template<typename U > | |
lattice2D< T > & | castFrom (const genericLattice2D< U > &other, const int fromRow, const int fromCol, const int toRow=container::MaxIndex, const int toCol=container::MaxIndex) |
lattice2D< T > & | castFrom (const genericLattice2D< T > &other, const int fromRow, const int fromCol, const int toRow=container::MaxIndex, const int toCol=container::MaxIndex) |
const std::string & | name () const |
virtual lattice2D< T > * | clone () const |
virtual lattice2D< T > * | newInstance () const |
bool | prettyCloseTo (const genericLattice2D< T > &other, const T &tolerance) const |
lattice2D< T > & | operator= (const genericLattice2D< T > &other) |
Apply Methods. | |
lattice2D< T > & | apply (T(*function)(T)) |
lattice2D< T > & | apply (const genericLattice2D< T > &other, T(*function)(T)) |
lattice2D< T > & | apply (T(*function)(const T &)) |
lattice2D< T > & | apply (const genericLattice2D< T > &other, T(*function)(const T &)) |
lattice2D< T > & | apply (const genericLattice2D< T > &other, T(*function)(const T &, const T &)) |
lattice2D< T > & | apply (const genericLattice2D< T > &other, T(*function)(T, T)) |
lattice2D< T > & | apply (const genericLattice2D< T > &a, const genericLattice2D< T > &b, T(*function)(const T &, const T &)) |
lattice2D< T > & | apply (const genericLattice2D< T > &a, const genericLattice2D< T > &b, T(*function)(T, T)) |
Arithmetical Operations | |
lattice2D< T > & | add (const genericLattice2D< T > &other) |
lattice2D< T > & | add (const genericLattice2D< T > &a, const genericLattice2D< T > &b) |
lattice2D< T > & | add (const T value) |
lattice2D< T > & | add (const genericLattice2D< T > &other, const T value) |
lattice2D< T > & | operator+= (const T value) |
lattice2D< T > & | operator+= (const genericLattice2D< T > &other) |
lattice2D< T > | operator+ (const genericLattice2D< T > &other) const |
lattice2D< T > | operator+ (const T value) const |
lattice2D< T > | operator- (const genericLattice2D< T > &other) const |
lattice2D< T > | operator- (const T value) const |
lattice2D< T > & | addScaled (const T b, const genericLattice2D< T > &other) |
lattice2D< T > & | addScaled (const genericLattice2D< T > &matA, const T b, const genericLattice2D< T > &matB) |
lattice2D< T > & | addScaled (const T a, const genericLattice2D< T > &first, const T b, const genericLattice2D< T > &second) |
lattice2D< T > & | subtract (const genericLattice2D< T > &other) |
lattice2D< T > & | subtract (const genericLattice2D< T > &a, const genericLattice2D< T > &b) |
lattice2D< T > & | subtract (const T value) |
lattice2D< T > & | subtract (const genericLattice2D< T > &other, const T value) |
lattice2D< T > & | operator-= (const T value) |
lattice2D< T > & | operator-= (const genericLattice2D< T > &other) |
lattice2D< T > & | multiply (const T value) |
lattice2D< T > & | multiply (const genericLattice2D< T > &other, const T value) |
lattice2D< T > & | operator*= (const T value) |
lattice2D< T > & | divide (const T value) |
lattice2D< T > & | divide (const genericLattice2D< T > &other, const T value) |
lattice2D< T > & | operator/= (const T value) |
lattice2D< T > & | emultiply (const genericLattice2D< T > &other) |
lattice2D< T > & | emultiply (const genericLattice2D< T > &a, const genericLattice2D< T > &b) |
lattice2D< T > & | edivide (const genericLattice2D< T > &other) |
lattice2D< T > & | edivide (const genericLattice2D< T > &a, const genericLattice2D< T > &b) |
lattice2D< T > & | outerProduct (const row_type &a, const row_type &b) |
lattice2D< T > & | transpose () |
template<typename U > | |
lattice2D< T > & | transpose (const genericLattice2D< U > &other) |
T | computeSumOfElements () const |
T | computeProductOfElements () const |
Find extreme values | |
T | findMinimum () const |
size_type | findIndexOfMinimum () const |
T | findMaximum () const |
size_type | findIndexOfMaximum () const |
void | findExtremes (T &theMinimum, T &theMaximum) const |
void | findIndexOfExtremes (size_type &theIdxMinimum, size_type &theIdxMaximum) const |
Protected Member Functions | |
Memory allocation and deallocation | |
Restrict all memory allocation and deallocation to these functions. | |
virtual row_type * | allocNewRows (const int fromRow, const int toRow) |
The cvr::lattice2D class is a container class implemented as a template, but explicitelly instantiated to a set of commonly used types:
If you need a container for other type, use cvr::genericLattice2D instead.
The cvr::genericLattice2D class allows the representation of two dimensional lattice, containing an element at each point of the lattice. The points are inidicated with an ordered pair n x m, where n and m can be taken from intervals selected at construction time, that may include negative values.
This class is similar to a cvr::matrix, but allows indexing with negative values as well, a feature useful in the representation of filter kernels or image masks. It can also be seen as a special type of cvr::genericLattice2D to which a set of arithmetical and simple linear algebra operations has been added.
typedef genericLattice2D<T>::const_iterator cvr::lattice2D< T >::const_iterator |
typedef genericLattice2D<T>::const_pointer cvr::lattice2D< T >::const_pointer |
Const pointer to value_type.
Reimplemented from cvr::genericLattice2D< T >.
Reimplemented in cvr::kernel2D< T >.
typedef genericLattice2D<T>::const_reference cvr::lattice2D< T >::const_reference |
Const reference to value_type.
Reimplemented from cvr::genericLattice2D< T >.
Reimplemented in cvr::kernel2D< T >.
typedef genericLattice2D<T>::iterator cvr::lattice2D< T >::iterator |
typedef genericLattice2D<T>::pointer cvr::lattice2D< T >::pointer |
Pointer to value_type.
Reimplemented from cvr::genericLattice2D< T >.
Reimplemented in cvr::kernel2D< T >.
typedef genericLattice2D<T>::reference cvr::lattice2D< T >::reference |
Reference to value_type.
Reimplemented from cvr::genericLattice2D< T >.
Reimplemented in cvr::kernel2D< T >.
typedef lattice1D<T> cvr::lattice2D< T >::row_type |
typedef genericLattice2D<T>::size_type cvr::lattice2D< T >::size_type |
Return type of the size() member.
Reimplemented from cvr::genericLattice2D< T >.
Reimplemented in cvr::kernel2D< T >.
typedef genericLattice2D<T>::value_type cvr::lattice2D< T >::value_type |
Type of the contained data.
Reimplemented from cvr::genericLattice2D< T >.
Reimplemented in cvr::kernel2D< T >.
cvr::lattice2D< T >::lattice2D | ( | ) |
Default constructor creates an empty lattice2D.
cvr::lattice2D< T >::lattice2D | ( | const int | fromRow, | |
const int | fromCol, | |||
const int | toRow, | |||
const int | toCol | |||
) |
Create a lattice2D with uninitialized elements.
fromRow | lowest row index | |
fromCol | lowest column index | |
toRow | highest row index (inclusive) | |
toCol | highest column index (inclusive) |
cvr::lattice2D< T >::lattice2D | ( | const size_type & | from, | |
const size_type & | to | |||
) |
Create a rows x cols lattice2D with uninitialized elements.
from | lowest index | |
to | highest index (inclusive) |
cvr::lattice2D< T >::lattice2D | ( | const iinterval & | rows, | |
const iinterval & | columns | |||
) |
cvr::lattice2D< T >::lattice2D | ( | const int | fromRow, | |
const int | fromCol, | |||
const int | toRow, | |||
const int | toCol, | |||
const T & | value | |||
) |
Create a lattice2D and initialize all elements with the given value.
fromRow | lowest row index | |
fromCol | lowest column index | |
toRow | highest row index (inclusive) | |
toCol | highest column index (inclusive) | |
value | value used for initializing the elements |
cvr::lattice2D< T >::lattice2D | ( | const size_type & | from, | |
const size_type & | to, | |||
const T & | value | |||
) |
Create a lattice2D and initialize all elements with the given value.
from | lowest index | |
to | highest index (inclusive) | |
value | value used for initializing the elements |
cvr::lattice2D< T >::lattice2D | ( | const iinterval & | rows, | |
const iinterval & | columns, | |||
const T & | value | |||
) |
cvr::lattice2D< T >::lattice2D | ( | const int | fromRow, | |
const int | fromCol, | |||
const int | toRow, | |||
const int | toCol, | |||
const T | data[] | |||
) |
Create a lattice2D and initialize all elements with the data pointed by data.
The first elements of the data will be copied on the first row, the next ones on the second row and so on.
fromRow | lowest row index | |
fromCol | lowest column index | |
toRow | highest row index (inclusive) | |
toCol | highest column index (inclusive) | |
data | pointer to the memory block with the data to be initialized with. |
cvr::lattice2D< T >::lattice2D | ( | const size_type & | from, | |
const size_type & | to, | |||
const T | data[] | |||
) |
Create a lattice2D and initialize all elements with the data pointed by data.
The first elements of the data will be copied on the first row, the next ones on the second row and so on.
from | lowest index | |
to | highest index (inclusive) | |
data | pointer to the memory block with the data to be initialized with. |
cvr::lattice2D< T >::lattice2D | ( | const iinterval & | rows, | |
const iinterval & | columns, | |||
const T | data[] | |||
) |
Create a lattice2D and initialize all elements with the data pointed by data.
The first elements of the data will be copied on the first row, the next ones on the second row and so on.
cvr::lattice2D< T >::lattice2D | ( | const int | fromRow, | |
const int | fromCol, | |||
const int | toRow, | |||
const int | toCol, | |||
T | data[], | |||
const eConstantReference | constRef | |||
) |
Create a lattice2D and use the given data as if it was given through the useExternData().
fromRow | lowest row index | |
fromCol | lowest column index | |
toRow | highest row index (inclusive) | |
toCol | highest column index (inclusive) | |
data | pointer to the memory block with the data to be initialized with. | |
constRef | usually you want this value to be ConstantReference. |
cvr::lattice2D< T >::lattice2D | ( | const size_type & | from, | |
const size_type & | to, | |||
T | data[], | |||
const eConstantReference | constRef | |||
) |
Create a lattice2D and use the given data as if it was given through the useExternData().
from | lowest index | |
to | highest index (inclusive) | |
data | pointer to the memory block with the data to be initialized with. | |
constRef | usually you want this value to be ConstantReference. |
cvr::lattice2D< T >::lattice2D | ( | const iinterval & | rows, | |
const iinterval & | columns, | |||
T | data[], | |||
const eConstantReference | constRef | |||
) |
Create a lattice2D and use the given data as if it was given through the useExternData().
cvr::lattice2D< T >::lattice2D | ( | const genericLattice2D< T > & | other | ) |
cvr::lattice2D< T >::lattice2D | ( | const genericLattice2D< T > & | other, | |
const int | fromRow, | |||
const int | fromCol, | |||
const int | toRow = container::MaxIndex , |
|||
const int | toCol = container::MaxIndex | |||
) |
Copy constructor.
Create this lattice2D as a copy of another lattice2D for this const version, the data will be always copied!
other | the genericLattice2D to be copied. | |
fromRow | initial row of the other genericLattice2D to be copied | |
fromCol | initial column of the other genericLattice2D to be copied | |
toRow | last row to be copied of the other genericLattice2D | |
toCol | last column to be copied of the other genericLattice2D |
cvr::lattice2D< T >::lattice2D | ( | const genericLattice2D< T > & | other, | |
const size_type & | from, | |||
const size_type & | to | |||
) |
Copy constructor.
Create this lattice2D as a copy of a section of another lattice2D
other | the genericLattice2D to be copied. | |
from | initial position in the other genericLattice2D to be copied | |
to | last position to be copied of the other genericLattice2D |
cvr::lattice2D< T >::lattice2D | ( | const genericLattice2D< T > & | other, | |
const iinterval & | rows, | |||
const iinterval & | columns | |||
) |
Copy constructor.
Create this lattice2D as a copy of a sublattice2D of another genericLattice2D.
other | the genericLattice2D to be copied. | |
rows | interval of rows to be copied. | |
columns | interval of columns to be copied. |
cvr::lattice2D< T >::lattice2D | ( | const genericLattice2D< T > & | other, | |
const genericLattice1D< int > & | rows | |||
) |
Copy constructor.
Create this lattice2D as a copy of another genericLattice2D taking only the rows indicated by the vector.
The data will be always copied! Multiple occurence of one row index in rows is allowed.
other | the genericLattice2D to be copied. | |
rows | indices of the rows to be copied |
virtual cvr::lattice2D< T >::~lattice2D | ( | ) | [virtual] |
Destructor.
lattice2D<T>& cvr::lattice2D< T >::add | ( | const genericLattice2D< T > & | other, | |
const T | value | |||
) |
lattice2D<T>& cvr::lattice2D< T >::add | ( | const T | value | ) |
lattice2D<T>& cvr::lattice2D< T >::add | ( | const genericLattice2D< T > & | a, | |
const genericLattice2D< T > & | b | |||
) |
lattice2D<T>& cvr::lattice2D< T >::add | ( | const genericLattice2D< T > & | other | ) |
lattice2D<T>& cvr::lattice2D< T >::addScaled | ( | const T | a, | |
const genericLattice2D< T > & | first, | |||
const T | b, | |||
const genericLattice2D< T > & | second | |||
) |
Leave the scaled sum of two matrices in this lattice2D.
The matrices must be of the same types and dimensions. Let be the first lattice2D and the second lattice2D with corresponding scaling factors and , further this lattice2D, then this method performs:
a | scaling factor for first | |
first | the first lattice2D to be added after scaling | |
b | scaling factor for second | |
second | the second lattice2D to be added after scaling |
lattice2D<T>& cvr::lattice2D< T >::addScaled | ( | const genericLattice2D< T > & | matA, | |
const T | b, | |||
const genericLattice2D< T > & | matB | |||
) |
Add a lattice2D A with a lattice2D B scaled by , and leave the result in this lattice2D.
The matrices must be of the same types and dimensions. This method performs:
matA | the first lattice2D | |
b | scaling factor for matB | |
matB | the lattice2D to be added after scaling |
lattice2D<T>& cvr::lattice2D< T >::addScaled | ( | const T | b, | |
const genericLattice2D< T > & | other | |||
) |
Add another lattice2D scaled by to this lattice2D.
The matrices must be of the same types and dimensions. Let be this lattice2D and the other lattice2D, then this method performs:
b | scaling factor for other | |
other | the lattice2D to be added after scaling |
virtual row_type* cvr::lattice2D< T >::allocNewRows | ( | const int | fromRow, | |
const int | toRow | |||
) | [inline, protected, virtual] |
lattice2D<T>& cvr::lattice2D< T >::apply | ( | const genericLattice2D< T > & | a, | |
const genericLattice2D< T > & | b, | |||
T(*)(T, T) | function | |||
) | [inline] |
A two-parameter C-function receives the i-th elements of both given matrices and leaves the result here.
Note that both matrices must have the same size!
a | the first lattice2D | |
b | the second lattice2D | |
function | a pointer to C-function with two parameters |
Reimplemented from cvr::genericLattice2D< T >.
lattice2D<T>& cvr::lattice2D< T >::apply | ( | const genericLattice2D< T > & | a, | |
const genericLattice2D< T > & | b, | |||
T(*)(const T &, const T &) | function | |||
) | [inline] |
A two-parameter C-function receives the i-th elements of both given matrices and leaves the result here.
Note that both matrices must have the same size!
a | the first lattice2D | |
b | the second lattice2D | |
function | a pointer to C-function with two parameters |
Reimplemented from cvr::genericLattice2D< T >.
lattice2D<T>& cvr::lattice2D< T >::apply | ( | const genericLattice2D< T > & | other, | |
T(*)(T, T) | function | |||
) | [inline] |
A two-parameter C-function receives the i-th elements of this and the given lattice2D and the result will be left in this lattice2D.
Note that both matrices must have the same size!
other | the second lattice2D to be considered (the first lattice2D will be this object!) | |
function | a pointer to C-function with two parameters |
Reimplemented from cvr::genericLattice2D< T >.
lattice2D<T>& cvr::lattice2D< T >::apply | ( | const genericLattice2D< T > & | other, | |
T(*)(const T &, const T &) | function | |||
) | [inline] |
A two-parameter C-function receives the i-th elements of this and the given lattice2D and the result will be left in this lattice2D.
Note that both matrices must have the same size!
other | the second lattice2D to be considered (the first lattice2D will be this object!) | |
function | a pointer to C-function with two parameters |
Reimplemented from cvr::genericLattice2D< T >.
lattice2D<T>& cvr::lattice2D< T >::apply | ( | const genericLattice2D< T > & | other, | |
T(*)(const T &) | function | |||
) | [inline] |
Applies a C-function to each element of the other lattice2D.
other | the lattice2D which elements will go through the given function. | |
function | a pointer to a C-function |
Reimplemented from cvr::genericLattice2D< T >.
lattice2D<T>& cvr::lattice2D< T >::apply | ( | T(*)(const T &) | function | ) | [inline] |
Applies a C-function to each element of the lattice2D.
function | a pointer to a C-function |
Reimplemented from cvr::genericLattice2D< T >.
lattice2D<T>& cvr::lattice2D< T >::apply | ( | const genericLattice2D< T > & | other, | |
T(*)(T) | function | |||
) | [inline] |
Applies a C-function to each element of the other lattice2D.
other | the lattice2D which elements will go through the given function. | |
function | a pointer to a C-function |
Reimplemented from cvr::genericLattice2D< T >.
lattice2D<T>& cvr::lattice2D< T >::apply | ( | T(*)(T) | function | ) | [inline] |
Applies a C-function to each element of the lattice2D.
function | a pointer to a C-function |
Reimplemented from cvr::genericLattice2D< T >.
lattice2D<T>& cvr::lattice2D< T >::castFrom | ( | const genericLattice2D< T > & | other, | |
const int | fromRow, | |||
const int | fromCol, | |||
const int | toRow = container::MaxIndex , |
|||
const int | toCol = container::MaxIndex | |||
) |
This is just an alias for copy(const genericLattice2D<T>&, const int fromRow, const int fromCol, const int toRow, const int toCol) to facilitate generic programming.
other | The genericLattice2D to be copied. | |
fromRow | initial row of the other genericLattice2D to be copied | |
fromCol | initial column of the other genericLattice2D to be copied | |
toRow | last row to be copied of the other genericLattice2D | |
toCol | last column to be copied of the other genericLattice2D |
Reimplemented from cvr::genericLattice2D< T >.
lattice2D<T>& cvr::lattice2D< T >::castFrom | ( | const genericLattice2D< U > & | other, | |
const int | fromRow, | |||
const int | fromCol, | |||
const int | toRow = container::MaxIndex , |
|||
const int | toCol = container::MaxIndex | |||
) | [inline] |
Copy a sublattice2D of the other genericLattice2D by casting each of its elements.
other | The genericLattice2D to be casted | |
fromRow | initial row of the other genericLattice2D to be copied | |
fromCol | initial column of the other genericLattice2D to be copied | |
toRow | last row to be copied of the other genericLattice2D | |
toCol | last column to be copied of the other genericLattice2D |
Reimplemented from cvr::genericLattice2D< T >.
lattice2D<T>& cvr::lattice2D< T >::castFrom | ( | const genericLattice2D< T > & | other | ) | [inline] |
Copy the other lattice2D by casting each of its elements.
This 'specialization' ensures that the copy() method is used when U==T.
other | The lattice2D to be casted (copied) |
Reimplemented from cvr::genericLattice2D< T >.
lattice2D<T>& cvr::lattice2D< T >::castFrom | ( | const genericLattice2D< U > & | other | ) | [inline] |
Copy the other lattice2D by casting each of its elements Example:.
cvr::lattice2D<int> matA(10,10,1);// a lattice2D of integers cvr::lattice2D<double> matB; // a lattice2D of doubles matB.castFrom(matA); // this will copy matA in matB!!
other | The lattice2D to be casted |
Reimplemented from cvr::genericLattice2D< T >.
virtual lattice2D<T>* cvr::lattice2D< T >::clone | ( | ) | const [virtual] |
Create a clone of this lattice2D.
Reimplemented from cvr::genericLattice2D< T >.
Reimplemented in cvr::kernel2D< T >.
T cvr::lattice2D< T >::computeProductOfElements | ( | ) | const |
Calculate the product of all elements of the vector.
This member can be used with classes which define the operator '*='
T cvr::lattice2D< T >::computeSumOfElements | ( | ) | const |
Calculate the sum of all elements of the lattice2D.
This member can be used with classes which define the operator '+='
lattice2D<T>& cvr::lattice2D< T >::copy | ( | const genericLattice2D< T > & | other, | |
const irectangle & | window | |||
) | [inline] |
Assigment operator.
Copy the contents of other in this object.
The result of the copy is always a connected lattice2D. I.e. you cannot copy the sub-lattice2D property of another lattice2D.
Reimplemented from cvr::genericLattice2D< T >.
lattice2D<T>& cvr::lattice2D< T >::copy | ( | const genericLattice2D< T > & | other, | |
const iinterval & | r, | |||
const iinterval & | c | |||
) | [inline] |
Assigment operator.
copy the contents of other in this object.
The result of the copy is always a connected lattice2D. I.e. you cannot copy the sub-lattice2D property of another lattice2D.
other | the other lattice2D to be copied | |
r | interval used for the rows | |
c | interval used for the columns |
Reimplemented from cvr::genericLattice2D< T >.
lattice2D<T>& cvr::lattice2D< T >::copy | ( | const genericLattice2D< T > & | other, | |
const size_type & | from, | |||
const size_type & | to | |||
) | [inline] |
Assigment operator.
copy the contents of other in this object.
The result of the copy is always a connected lattice2D. I.e. you cannot copy the sub-lattice2D property of another lattice2D.
other | the other lattice2D to be copied | |
from | initial indices of sublattice2D to be copied | |
to | final indices of sublattice2D to be copied (included) |
lattice2D<T>& cvr::lattice2D< T >::copy | ( | const genericLattice2D< T > & | other, | |
const int | fromRow, | |||
const int | fromCol, | |||
const int | toRow = container::MaxIndex , |
|||
const int | toCol = container::MaxIndex | |||
) | [inline] |
Assigment operator.
copy the contents of other in this object.
The result of the copy is always a connected lattice2D. I.e. you cannot copy the sub-lattice2D property of another lattice2D.
other | the other lattice2D to be copied | |
fromRow | initial row of the other lattice2D to be copied | |
fromCol | initial column of the other lattice2D to be copied | |
toRow | last row to be copied of the other lattice2D | |
toCol | last column to be copied of the other lattice2D |
Reimplemented from cvr::genericLattice2D< T >.
lattice2D<T>& cvr::lattice2D< T >::copy | ( | const genericLattice2D< T > & | other | ) | [inline] |
Assigment operator.
Copy the contents of other in this object.
The result of the copy is always a connected lattice2D. I.e. you cannot copy the sub-lattice2D property of another lattice2D.
other | the other lattice2D to be copied |
Reimplemented from cvr::genericLattice2D< T >.
lattice2D<T>& cvr::lattice2D< T >::copyColumns | ( | const genericLattice2D< T > & | other, | |
const genericLattice1D< int > & | idx | |||
) | [inline] |
Assigment operator.
Copy the contents of the specified columns of other into this object. Multiple occurence of one column index in idx is allowed.
other | the other lattice2D to be copied | |
idx | indices of the rows to be copied. |
Reimplemented from cvr::genericLattice2D< T >.
lattice2D<T>& cvr::lattice2D< T >::copyRows | ( | const genericLattice2D< T > & | other, | |
const genericLattice1D< int > & | idx | |||
) | [inline] |
Assigment operator.
Copy the contents of the specified rows of other into this object. Multiple occurence of one row index in idx is allowed.
other | the other lattice2D to be copied | |
idx | indices of the rows to be copied. |
Reimplemented from cvr::genericLattice2D< T >.
lattice2D<T>& cvr::lattice2D< T >::divide | ( | const genericLattice2D< T > & | other, | |
const T | value | |||
) |
lattice2D<T>& cvr::lattice2D< T >::divide | ( | const T | value | ) |
lattice2D<T>& cvr::lattice2D< T >::edivide | ( | const genericLattice2D< T > & | a, | |
const genericLattice2D< T > & | b | |||
) |
lattice2D<T>& cvr::lattice2D< T >::edivide | ( | const genericLattice2D< T > & | other | ) |
lattice2D<T>& cvr::lattice2D< T >::emultiply | ( | const genericLattice2D< T > & | a, | |
const genericLattice2D< T > & | b | |||
) |
lattice2D<T>& cvr::lattice2D< T >::emultiply | ( | const genericLattice2D< T > & | other | ) |
void cvr::lattice2D< T >::findExtremes | ( | T & | theMinimum, | |
T & | theMaximum | |||
) | const |
Get the extremes of the lattice2D (smallest and biggest elements).
void cvr::lattice2D< T >::findIndexOfExtremes | ( | size_type & | theIdxMinimum, | |
size_type & | theIdxMaximum | |||
) | const |
Get the indices of the extremes of the lattice2D (smallest and biggest elements).
size_type cvr::lattice2D< T >::findIndexOfMaximum | ( | ) | const |
Get the index of the biggest element of the lattice2D.
size_type cvr::lattice2D< T >::findIndexOfMinimum | ( | ) | const |
Get the index of the smallest element of the lattice2D.
T cvr::lattice2D< T >::findMaximum | ( | ) | const |
Get the biggest element of the lattice2D.
T cvr::lattice2D< T >::findMinimum | ( | ) | const |
Get the smallest element of the lattice2D.
void cvr::lattice2D< T >::getColumnCopy | ( | const int | col, | |
row_type & | theCol | |||
) | const [inline] |
Return genericLattice2D-column as a vector.
This method copies the data of the genericLattice2D, therefore is not as fast as getRow()
col | the number of the column to be copied | |
theCol | a vector, where the column vector of the genericLattice2D should be copied. |
row_type cvr::lattice2D< T >::getColumnCopy | ( | const int | col | ) | const [inline] |
const row_type& cvr::lattice2D< T >::getRow | ( | const int | row | ) | const [inline] |
Return lattice2D-row as a const vector.
This method works fast, since it returns a reference to the row vector. The data will NOT be copied.
row | the row to be accessed |
Reimplemented from cvr::genericLattice2D< T >.
row_type& cvr::lattice2D< T >::getRow | ( | const int | row | ) | [inline] |
Return lattice2D-row as a vector.
This method works fast, since it returns a reference to the row vector. The data will NOT be copied.
row | the row to be accessed |
Reimplemented from cvr::genericLattice2D< T >.
void cvr::lattice2D< T >::getRowCopy | ( | const int | row, | |
row_type & | theRow | |||
) | const [inline] |
Copy a row vector in the given parameter.
This method copies the data of a given row of the genericLattice2D in the given vector.
row | the number of the row to be copied | |
theRow | the vector, where the data will be copied |
row_type cvr::lattice2D< T >::getRowCopy | ( | const int | row | ) | const [inline] |
lattice2D<T>& cvr::lattice2D< T >::multiply | ( | const genericLattice2D< T > & | other, | |
const T | value | |||
) |
lattice2D<T>& cvr::lattice2D< T >::multiply | ( | const T | value | ) |
const std::string& cvr::lattice2D< T >::name | ( | ) | const [virtual] |
Returns the name of this class.
Reimplemented from cvr::genericLattice2D< T >.
Reimplemented in cvr::kernel2D< T >.
virtual lattice2D<T>* cvr::lattice2D< T >::newInstance | ( | ) | const [virtual] |
Create a new empty lattice2D.
Reimplemented from cvr::genericLattice2D< T >.
Reimplemented in cvr::kernel2D< T >.
lattice2D<T>& cvr::lattice2D< T >::operator*= | ( | const T | value | ) | [inline] |
Alias for multiply(const T& value).
value | the constant value to be multiplied with |
lattice2D<T> cvr::lattice2D< T >::operator+ | ( | const T | value | ) | const |
lattice2D<T> cvr::lattice2D< T >::operator+ | ( | const genericLattice2D< T > & | other | ) | const |
Add other lattice2D to this lattice2D and leave the result in a new lattice2D.
This object is not changed.
other | the other lattice2D to be added with. |
lattice2D<T>& cvr::lattice2D< T >::operator+= | ( | const genericLattice2D< T > & | other | ) | [inline] |
lattice2D<T>& cvr::lattice2D< T >::operator+= | ( | const T | value | ) | [inline] |
Alias for add(const T value).
value | a constant value to be added to all lattice2D elements |
lattice2D<T> cvr::lattice2D< T >::operator- | ( | const T | value | ) | const |
lattice2D<T> cvr::lattice2D< T >::operator- | ( | const genericLattice2D< T > & | other | ) | const |
Subtract other lattice2D from this lattice2D and leave the result in a new lattice2D.
This object is not changed.
other | the other lattice2D to be added with. |
lattice2D<T>& cvr::lattice2D< T >::operator-= | ( | const genericLattice2D< T > & | other | ) | [inline] |
lattice2D<T>& cvr::lattice2D< T >::operator-= | ( | const T | value | ) | [inline] |
Alias for subtract(const T value).
value | a constant value to be subtracted from all lattice2D elements |
lattice2D<T>& cvr::lattice2D< T >::operator/= | ( | const T | value | ) |
Alias for divide(const T& value).
value | the constant value to be divided by |
lattice2D<T>& cvr::lattice2D< T >::operator= | ( | const genericLattice2D< T > & | other | ) | [inline] |
Assigment operator (alias for copy(other)).
other | the lattice2D to be copied |
Reimplemented from cvr::genericLattice2D< T >.
const row_type& cvr::lattice2D< T >::operator[] | ( | const int | row | ) | const [inline] |
row_type& cvr::lattice2D< T >::operator[] | ( | const int | row | ) | [inline] |
lattice2D<T>& cvr::lattice2D< T >::outerProduct | ( | const row_type & | a, | |
const row_type & | b | |||
) |
Outer-product of two vectors.
The result will be left in this lattice2D. The dimensions of this lattice2D will change if needed. The outer product of two column vectors is defined as
a | first vector (will determine the number of rows) | |
b | second vector (will determine the number of columns) |
bool cvr::lattice2D< T >::prettyCloseTo | ( | const genericLattice2D< T > & | other, | |
const T & | tolerance | |||
) | const |
Compare this lattice2D with other, and use the given tolerance to determine if the value of each element of the other lattice2D approximately equals the values of the actual lattice2D elements.
An element x is approximately equal to another element y with a tolerance t, if following equation holds: x-t < y < x+t
This method is mainly used for matrices containing floating point values.
other | the other lattice2D to be compared with | |
tolerance | the tolerance to be used |
lattice2D<T>& cvr::lattice2D< T >::subtract | ( | const genericLattice2D< T > & | other, | |
const T | value | |||
) |
lattice2D<T>& cvr::lattice2D< T >::subtract | ( | const T | value | ) |
lattice2D<T>& cvr::lattice2D< T >::subtract | ( | const genericLattice2D< T > & | a, | |
const genericLattice2D< T > & | b | |||
) |
lattice2D<T>& cvr::lattice2D< T >::subtract | ( | const genericLattice2D< T > & | other | ) |
lattice2D<T>& cvr::lattice2D< T >::transpose | ( | const genericLattice2D< U > & | other | ) | [inline] |
lattice2D<T>& cvr::lattice2D< T >::transpose | ( | ) |
Transpose lattice2D and leave the result here.
If the lattice2D is square this is actually a fast on-place operation. However, if the lattice2D is not square a temporary lattice2D is created with the new dimensions. This can be less efficient than using transpose(const lattice2D&) directly on a temporary lattice2D if many matrices of the same size need to be transposed.