latest version v1.9 - last update 10 Apr 2010 |
GenericMatrix container class. More...
#include <ltiGenericMatrix.h>
Classes | |
class | const_iterator |
const iterator type (allows read-only operations). More... | |
class | iterator |
iterator type (allows read and write operations). More... | |
Public Types | |
enum | eStoreMode { Connected, Line } |
typedef T | value_type |
typedef ipoint | size_type |
Public Member Functions | |
genericMatrix () | |
genericMatrix (const int rows, const int cols, const T &iniValue=T()) | |
genericMatrix (const int rows, const int cols, const T data[]) | |
genericMatrix (const ipoint &size, const T &iniValue=T()) | |
genericMatrix (const genericMatrix< T > &other, const int fromRow=0, const int toRow=MaxInt32, const int fromCol=0, const int toCol=MaxInt32) | |
genericMatrix (const bool init, const int rows, const int cols) | |
genericMatrix (const bool init, const ipoint &size) | |
genericMatrix (const genericMatrix< T > &other, const genericVector< int > &rows) | |
genericMatrix (const bool copyData, genericMatrix< T > &other, const int fromRow=0, const int toRow=MaxInt32, const int fromCol=0, const int toCol=MaxInt32) | |
virtual | ~genericMatrix () |
virtual const char * | getTypeName () const |
bool | ownsData () const |
void | restoreOwnership () |
void | useExternData (const int rows, const int cols, T *data) |
void | attach (const int rows, const int cols, T *data) |
void | detach (genericMatrix< T > &receiver) |
void | detach (genericVector< T > &receiver) |
void | exchange (genericMatrix< T > &other) |
void | swap (genericMatrix< T > &other) |
eStoreMode | getMode () const |
int | rows () const |
int | columns () const |
int | lastRow () const |
int | lastColumn () const |
int | metaRows () const |
int | metaColumns () const |
const size_type & | size () const |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
iterator | inverseBegin () |
const_iterator | inverseBegin () const |
iterator | inverseEnd () |
const_iterator | inverseEnd () const |
void | resize (const int newRows, const int newCols, const T &iniValue=T(), const bool copyData=true, const bool initNew=true) |
void | clear () |
bool | empty () const |
void | resize (const ipoint &newDim, const T &iniValue=T(), const bool copyData=true, const bool initNew=true) |
void | fill (const T &iniValue, const int fromRow=0, const int fromCol=0, const int toRow=MaxInt32, const int toCol=MaxInt32) |
void | fill (const T &iniValue, const ipoint &from, const ipoint &to=point(MaxInt32, MaxInt32)) |
void | fill (const T &iniValue, const irectangle &window) |
void | fill (const T data[], const int fromRow=0, const int fromCol=0, const int toRow=MaxInt32, const int toCol=MaxInt32) |
void | fill (const T data[], const ipoint &from, const ipoint &to=point(MaxInt32, MaxInt32)) |
void | fill (const T data[], const irectangle &window) |
void | fill (const genericMatrix< T > &mat, const int fromRow=0, const int fromCol=0, const int toRow=MaxInt32, const int toCol=MaxInt32, const int startAtRow=0, const int startAtCol=0) |
void | fill (const genericMatrix< T > &mat, const ipoint &from, const ipoint &to=point(MaxInt32, MaxInt32), const ipoint &startAt=point(0, 0)) |
void | fill (const genericMatrix< T > &mat, const irectangle &window, const ipoint &start=point(0, 0)) |
T & | at (const int row, const int col) |
const T & | at (const int row, const int col) const |
T & | at (const int pos) |
const T & | at (const int pos) const |
T & | at (const ipoint &p) |
const T & | at (const ipoint &p) const |
genericVector< T > & | getRow (const int row) |
const genericVector< T > & | getRow (const int row) const |
genericVector< T > & | operator[] (const int row) |
const genericVector< T > & | operator[] (const int row) const |
void | getRowCopy (const int row, genericVector< T > &theRow) const |
genericVector< T > | getRowCopy (const int row) const |
void | getColumnCopy (const int col, genericVector< T > &theCol) const |
genericVector< T > | getColumnCopy (const int col) const |
void | getDiagonal (genericVector< T > &diag) const |
genericVector< T > | getDiagonal () const |
void | setDiagonal (const genericVector< T > &diag) |
void | setRow (const int row, const genericVector< T > &theRow) |
void | setColumn (const int col, const genericVector< T > &theCol) |
genericMatrix< T > & | copy (const genericMatrix< T > &other) |
genericMatrix< T > & | copy (const genericMatrix< T > &other, const int fromRow, const int toRow=MaxInt32, const int fromCol=0, const int toCol=MaxInt32) |
genericMatrix< T > & | copy (const genericMatrix< T > &other, const irectangle &window) |
genericMatrix< T > & | copy (const genericMatrix< T > &other, const genericVector< int > &idx, bool rows=true) |
template<class U > | |
genericMatrix< T > & | castFrom (const genericMatrix< U > &other) |
virtual mathObject * | clone () const |
bool | equals (const genericMatrix< T > &other) const |
bool | operator== (const genericMatrix< T > &other) const |
genericMatrix< T > & | operator= (const genericMatrix< T > &other) |
Apply Methods | |
genericMatrix< T > & | apply (T(*function)(T)) |
genericMatrix< T > & | apply (const genericMatrix< T > &other, T(*function)(T)) |
genericMatrix< T > & | apply (T(*function)(const T &)) |
genericMatrix< T > & | apply (const genericMatrix< T > &other, T(*function)(const T &)) |
genericMatrix< T > & | apply (const genericMatrix< T > &other, T(*function)(const T &, const T &)) |
genericMatrix< T > & | apply (const genericMatrix< T > &other, T(*function)(T, T)) |
genericMatrix< T > & | apply (const genericMatrix< T > &a, const genericMatrix< T > &b, T(*function)(const T &, const T &)) |
genericMatrix< T > & | apply (const genericMatrix< T > &a, const genericMatrix< T > &b, T(*function)(T, T)) |
Input and Output | |
virtual bool | write (ioHandler &handler, const bool complete=true) const |
virtual bool | read (ioHandler &handler, const bool complete=true) |
Protected Member Functions | |
virtual genericVector< T > * | allocRows (const int n) |
Protected Attributes | |
int & | numRows |
int & | numColumns |
ipoint | theSize |
int | lastRowIdx |
int | lastColIdx |
int | metaNumRows |
int | metaNumColumns |
int | totalSize |
bool | ownData |
eStoreMode | mode |
T * | theElements |
genericVector< T > * | rowAddressTable |
GenericMatrix container class.
The lti::genericMatrix class allows the representation of n x m matrices of any type showing . The rows will be indexed between 0 and n-1, and the columns between 0 and m-1.
All types defined in ltiTypes.h use static members and can be contained by the lti::genericVector and lti::genericMatrix classes.
The genericMatrix class is a container class implemented as template.
If you need to create a genericMatrix of floats with 20 rows and 15 columns, all elements initialized with an initial value of 4.27 just create it:
lti::genericMatrix<float> myMat(20,15,4.27f) // creates genericMatrix // with 300 elements // all initialized with 4.27f
To access the genericMatrix elements use the access operators. There are many possibilities. With at(const int row, const int col) is possible to access an element directly. With at(const int row) you can get the row vector. You cannot for instance resize nor change the memory referenced in this vector (see lti::genericVector::resize()). For example:
float accu = 0; // initialize accumulator lti::genericMatrix<float> myMat(20,15,4.27f) lti::vector<float> myVct; for (int j = 0; j < myMat.rows(); j++) { for (int i = 0; i < myMat.columns(); i++) { tmp += myMat.at(j,i); // access each element of the genericMatrix: // j is the row and i the column } } myMat.getRowCopy(5,myVct); // copy the sixth row in myVct! myVct.resize(6); // Valid, the vector has its own memory! myMat.at(5).resize(6) // ERROR!! the vector is not resizable!
The genericMatrix has following methods:
typedef ipoint lti::genericMatrix< T >::size_type |
return type of the size() member
Reimplemented in lti::matrix< T >, lti::matrix< int32 >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, lti::matrix< sqrType >, lti::matrix< rgbPixel >, and lti::matrix< ubyte >.
typedef T lti::genericMatrix< T >::value_type |
type of the contained data
Reimplemented in lti::matrix< T >, lti::matrix< int32 >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, lti::matrix< sqrType >, lti::matrix< rgbPixel >, and lti::matrix< ubyte >.
enum lti::genericMatrix::eStoreMode |
lti::genericMatrix< T >::genericMatrix | ( | ) |
Default constructor creates an empty genericMatrix.
lti::genericMatrix< T >::genericMatrix | ( | const int | rows, | |
const int | cols, | |||
const T & | iniValue = T() | |||
) |
Create a rows x cols
genericMatrix and initializes all elements with iniValue
.
rows | number of rows of the genericMatrix | |
cols | number of columns of the genericMatrix | |
iniValue | all elements will be initialized with this value |
lti::genericMatrix< T >::genericMatrix | ( | const int | rows, | |
const int | cols, | |||
const T | data[] | |||
) |
Create a rows x cols
genericMatrix and initialize all elements with the data pointed by data
.
The first cols
-elements of the data will be copied on the first row, the next ones on the second row and so on.
rows | number of rows of the genericMatrix | |
cols | number of columns of the genericMatrix | |
data | pointer to the memory block with the data to be initialized with. |
lti::genericMatrix< T >::genericMatrix | ( | const ipoint & | size, | |
const T & | iniValue = T() | |||
) |
This constructor creates a connected size.y x size.x
GenericMatrix and initializes all elements with iniValue
.
size | lti::point with the size of the genericMatrix (size.x is the number of columns and size.y the number of rows) | |
iniValue | all elements will be initialized with this value |
lti::genericMatrix< T >::genericMatrix | ( | const genericMatrix< T > & | other, | |
const int | fromRow = 0 , |
|||
const int | toRow = MaxInt32 , |
|||
const int | fromCol = 0 , |
|||
const int | toCol = MaxInt32 | |||
) |
Copy constructor.
create this genericMatrix as a connected copy of another genericMatrix for this const version, the data will be always copied! It is also possible to create a copy of a subgenericMatrix of another genericMatrix.
other | the genericMatrix to be copied. | |
fromRow | initial row of the other genericMatrix to be copied | |
toRow | last row to be copied of the other genericMatrix | |
fromCol | initial column of the other genericMatrix to be copied | |
toCol | last column to be copied of the other genericMatrix |
Example:
lti::genericMatrix<int> m(4,6,0); // integer genericMatrix with 25 // elements // ... // initialize GenericMatrix with: // 0 1 2 3 4 5 // 2 1 5 4 0 3 // 1 2 1 2 3 2 // 3 3 2 1 2 3 lti::genericMatrix<int> sm(m,0,2,1,3) // last line will lead to // following contents in sm: // 1 2 3 // 1 5 4 // 2 1 2
lti::genericMatrix< T >::genericMatrix | ( | const bool | init, | |
const int | rows, | |||
const int | cols | |||
) |
If init is true this constructor is equivalent to calling genericMatrix(const int rows, const int cols), and thus initializing all elements with T().
However, in some cases the elements need not be initialized during construction, since complex initializion is required. Especially for large matrices, the unnecessary constructor initialization is very time consuming.
If init is false, memory is allocated but no initialization takes place. Thus the following is equivalent:
genericMatrix<int> a(false,100,100); genericMatrix<int> a; a.resize(100,100,0,false,false);
init | initialize genericMatrix or not | |
rows | number of rows of the genericMatrix | |
cols | number of columns of the genericMatrix |
lti::genericMatrix< T >::genericMatrix | ( | const bool | init, | |
const ipoint & | size | |||
) |
If init is true this constructor is equivalent to calling genericMatrix(const int rows, const int cols), and thus initializing all elements with T().
However, in some cases the elements need not be initialized during construction, since complex initializion is required. Especially for large matrices, the unnecessary constructor initialization is very time consuming.
If init is false, memory is allocated but no initialization takes place. Thus the following is equivalent:
genericMatrix<int> a(false,100,100); genericMatrix<int> a; a.resize(100,100,0,false,false);
init | initialize genericMatrix or not | |
size | desired size for the genericMatrix |
lti::genericMatrix< T >::genericMatrix | ( | const genericMatrix< T > & | other, | |
const genericVector< int > & | rows | |||
) |
copy constructor.
create this genericMatrix as a connected copy of another genericMatrix taking only the rows indicated by the vector. for this const version, the data will be always copied! Multiple occurence of one row index in rows
is allowed.
other | the genericMatrix to be copied. | |
rows | inidices of the rows to be copied |
Example:
lti::vector<int> rows(2); // initialize with // 1 3 lti::genericMatrix<int> m(4,6,0); // integer genericMatrix with 25 // elements // ... // initialize GenericMatrix with: // 0 1 2 3 4 5 // 2 1 5 4 0 3 // 1 2 1 2 3 2 // 3 3 2 1 2 3 lti::genericMatrix<int> sm(m,rows) // last line will lead to // following contents in sm: // 2 1 5 4 0 3 // 3 3 2 1 2 3
lti::genericMatrix< T >::genericMatrix | ( | const bool | copyData, | |
genericMatrix< T > & | other, | |||
const int | fromRow = 0 , |
|||
const int | toRow = MaxInt32 , |
|||
const int | fromCol = 0 , |
|||
const int | toCol = MaxInt32 | |||
) |
copy constructor (reference to a submatrix).
creates submatrix of another matrix.
if copyData == true
, the new object has its own data (equivalent to previous copy constructor).
if copyData == false
, the new object has references to the other matrix, which means that the data is not necessarily consecutive. (This will not be a connected but a lined matrix)
Those algorithms which use direct access to the matrix memory block should check first if the memory lies in a consecutive block! (see getMode())
copyData | should the data of the other matrix be copied or not | |
other | the matrix with the data to be copied or to be shared | |
fromRow | initial row of the other matrix to be copied | |
toRow | last row to be copied of the other matrix | |
fromCol | initial column of the other matrix to be copied | |
toCol | last column to be copied of the other matrix |
virtual lti::genericMatrix< T >::~genericMatrix | ( | ) | [virtual] |
destructor
virtual genericVector<T>* lti::genericMatrix< T >::allocRows | ( | const int | n | ) | [inline, protected, virtual] |
Allocate n number of rows or the appropriate type.
Reimplemented in lti::matrix< T >, lti::matrix< int32 >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, lti::matrix< sqrType >, lti::matrix< rgbPixel >, and lti::matrix< ubyte >.
genericMatrix<T>& lti::genericMatrix< T >::apply | ( | const genericMatrix< T > & | a, | |
const genericMatrix< T > & | b, | |||
T(*)(T, T) | function | |||
) |
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 genericMatrix | |
b | the second genericMatrix | |
function | a pointer to C-function with two parameters |
Reimplemented in lti::matrix< T >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, and lti::matrix< sqrType >.
genericMatrix<T>& lti::genericMatrix< T >::apply | ( | const genericMatrix< T > & | a, | |
const genericMatrix< T > & | b, | |||
T(*)(const T &, const T &) | function | |||
) |
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 genericMatrix | |
b | the second genericMatrix | |
function | a pointer to C-function with two parameters |
Reimplemented in lti::matrix< T >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, and lti::matrix< sqrType >.
genericMatrix<T>& lti::genericMatrix< T >::apply | ( | const genericMatrix< T > & | other, | |
T(*)(T, T) | function | |||
) |
a two-parameter C-function receives the i-th elements of this and the given genericMatrix and the result will be left in this genericMatrix.
Note that both matrices must have the same size!
other | the second genericMatrix to be considered (the first genericMatrix will be this object!) | |
function | a pointer to C-function with two parameters |
Reimplemented in lti::matrix< T >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, and lti::matrix< sqrType >.
genericMatrix<T>& lti::genericMatrix< T >::apply | ( | const genericMatrix< T > & | other, | |
T(*)(const T &, const T &) | function | |||
) |
a two-parameter C-function receives the i-th elements of this and the given genericMatrix and the result will be left in this genericMatrix.
Note that both matrices must have the same size!
other | the second genericMatrix to be considered (the first genericMatrix will be this object!) | |
function | a pointer to C-function with two parameters |
Reimplemented in lti::matrix< T >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, and lti::matrix< sqrType >.
genericMatrix<T>& lti::genericMatrix< T >::apply | ( | const genericMatrix< T > & | other, | |
T(*)(const T &) | function | |||
) |
applies a C-function to each element of the other genericMatrix
other | the genericMatrix which elements will go through the given function. | |
function | a pointer to a C-function |
Reimplemented in lti::matrix< T >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, and lti::matrix< sqrType >.
genericMatrix<T>& lti::genericMatrix< T >::apply | ( | T(*)(const T &) | function | ) |
applies a C-function to each element of the genericMatrix.
function | a pointer to a C-function |
Reimplemented in lti::matrix< T >, lti::matrix< int32 >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, lti::matrix< sqrType >, lti::matrix< rgbPixel >, and lti::matrix< ubyte >.
genericMatrix<T>& lti::genericMatrix< T >::apply | ( | const genericMatrix< T > & | other, | |
T(*)(T) | function | |||
) |
applies a C-function to each element of the other genericMatrix
other | the genericMatrix which elements will go through the given function. | |
function | a pointer to a C-function |
Reimplemented in lti::matrix< T >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, and lti::matrix< sqrType >.
genericMatrix<T>& lti::genericMatrix< T >::apply | ( | T(*)(T) | function | ) |
applies a C-function to each element of the genericMatrix.
function | a pointer to a C-function |
Reimplemented in lti::matrix< T >, lti::matrix< int32 >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, lti::matrix< sqrType >, lti::matrix< rgbPixel >, and lti::matrix< ubyte >.
const T& lti::genericMatrix< T >::at | ( | const ipoint & | p | ) | const [inline] |
const access operator of genericMatrix element as a point in a 2D-Map
p | position of the element (this is equivalent to at(p.y,p.x)) |
Reimplemented in lti::kernel2D< T >, lti::kernel2D< float >, and lti::kernel2D< ubyte >.
T& lti::genericMatrix< T >::at | ( | const ipoint & | p | ) | [inline] |
access operator of genericMatrix element as a point in a 2D-Map
p | position of the element (this is equivalent to at(p.y,p.x)) |
Reimplemented in lti::kernel2D< T >, lti::kernel2D< float >, and lti::kernel2D< ubyte >.
const T& lti::genericMatrix< T >::at | ( | const int | pos | ) | const [inline] |
access element at the given position.
(can be used only in connected matrices. See constructors for more information on this.)
With this operator the genericMatrix can be accessed as a vector, where the rows of the genericMatrix are concatenated. The access to the genericMatrix with at(row,col) is equivalent to at(row*columns()+col).
pos | the index of the element of the genericMatrix |
T& lti::genericMatrix< T >::at | ( | const int | pos | ) | [inline] |
access element at the given position.
(can be used only in connected matrices. See constructors for more information on this.)
With this operator the genericMatrix can be accessed as a vector, where the rows of the genericMatrix are concatenated. The access to the genericMatrix with at(row,col) is equivalent to at(row*columns()+col).
pos | the index of the element of the genericMatrix |
const T& lti::genericMatrix< T >::at | ( | const int | row, | |
const int | col | |||
) | const [inline] |
read-only access at the given row and column
row | the row of the element | |
col | the column of the element |
T& lti::genericMatrix< T >::at | ( | const int | row, | |
const int | col | |||
) | [inline] |
access element at the given row and column
row | the row of the element | |
col | the column of the element |
Referenced by lti::decimation::apply(), lti::chrominanceMapEstimator::apply(), lti::overlappingSets2D::doDiscard(), lti::SOFM2DVisualizer::drawClasses(), lti::SOFM2DVisualizer::drawHits(), lti::nearestNeighborInterpolator< T >::interpolate(), lti::biquadraticInterpolator< T >::interpolateUnchk(), lti::bilinearInterpolator< T >::interpolateUnchk(), lti::overlappingSets2D::isContained(), lti::fillPattern::isSet(), lti::medianFilter::realMedian(), and lti::SOFM2DVisualizer::sammonsMapper().
void lti::genericMatrix< T >::attach | ( | const int | rows, | |
const int | cols, | |||
T * | data | |||
) |
Attach extern data to the genericMatrix.
This member allows the use of this object as an access-functor for the 'data'. An access to the element at (r,c) is equivalent to data[r*columns() + c]. If rows and cols are invalid dimensions, the behaviour will be unpredictible.
The memory will be administrated by this genericMatrix object, and may be deleted if required (genericMatrix deleted or resized!). The user should not try to manipulate the memory allocation of the data after the attachment! See also useExternData().
rows | number of rows | |
cols | number of columns | |
data | a pointer to the memory block to be used |
Example:
lti::genericMatrix<int> myMat; int block1[25]; int* block2; block2 = new int[25]; myMat.useExternData(5,5,block1); // ok myMat.attach(5,5,block1); // wrong!!! genericMatrix will try // to manipulate stack memory: // DO NOT DO THIS!!!!! myMat.attach(5,5,block2); // ok! but do not try to delete the memory // block2!!
const_iterator lti::genericMatrix< T >::begin | ( | ) | const [inline] |
returns first element of the genericMatrix as a const_iterator.
Note that you can not change the values of the genericMatrix elements when you use a const_iterator. See also begin() for an example
iterator lti::genericMatrix< T >::begin | ( | ) | [inline] |
returns iterator to the begin of the genericMatrix The use of the interators is similar to the iterators of the Standard Template Library (STL).
If you need to iterate on all elements of the genericMatrix, you can use following code:
int tmp,accu; // a temporal variable lti::genericMatrix<int> myMat(10,8,1); // a vector with 10 elements lti::genericMatrix<int>::iterator it; // an iterator for (it=myMat.begin();it!=myMat.end();it++) { tmp = *it; // tmp has value of element pointed // by the iterator. accu += tmp; (*it) = accu; // change the value in the genericMatrix. }
Please note that if you define it
as a const_iterator, you can not make something like *it=accu
.
Referenced by lti::cityBlockDistance(), lti::distanceSqr(), and lti::regionGrowing::mask().
genericMatrix<T>& lti::genericMatrix< T >::castFrom | ( | const genericMatrix< U > & | other | ) | [inline] |
copy the other
genericMatrix by casting each of its elements
other | The genericMatrix to be casted |
Example:
lti::genericMatrix<int> matA(10,10,1);// a genericMatrix of integers lti::genericMatrix<double> matB; // a genericMatrix of doubles matB.castFrom(matA); // this will copy matA in matB!!
Reimplemented in lti::kernel2D< T >, and lti::matrix< T >.
void lti::genericMatrix< T >::clear | ( | ) |
clears the genericMatrix (at the end this will be an empty genericMatrix)
Referenced by lti::medianFilter::realMedian().
virtual mathObject* lti::genericMatrix< T >::clone | ( | ) | const [virtual] |
create a clone of this genericMatrix
Implements lti::mathObject.
Reimplemented in lti::image, lti::channel, lti::channel8, lti::channel32, lti::kernel2D< T >, lti::matrix< T >, lti::kernel2D< float >, lti::kernel2D< ubyte >, lti::matrix< int32 >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, lti::matrix< sqrType >, lti::matrix< rgbPixel >, and lti::matrix< ubyte >.
int lti::genericMatrix< T >::columns | ( | ) | const [inline] |
number of columns of the genericMatrix
Referenced by lti::earthMoversDistance< W, C, D >::apply(), lti::decimation::apply(), lti::matrix< ubyte >::castFrom(), lti::genericMatrix< bool >::castFrom(), lti::draw< T >::inCanvas(), lti::nearestNeighborInterpolator< T >::interpolate(), lti::kernel2D< ubyte >::lastColumn(), lti::medianFilter::realMedian(), and lti::geometricTransform::rotate().
genericMatrix<T>& lti::genericMatrix< T >::copy | ( | const genericMatrix< T > & | other, | |
const genericVector< int > & | idx, | |||
bool | rows = true | |||
) |
copy the contents of the specified rows/columns of other
into this object.
Multiple occurence of one row/column index in idx
is allowed. If the argument rows is true, idx specifies rows, if false idx specifies columns.
The result of the copy is always a connected genericMatrix. I.e. you cannot copy the sub-genericMatrix property of another genericMatrix.
other | the other genericMatrix to be copied | |
idx | indices of the rows to be copied. | |
rows | if true works on rows, else on columns |
genericMatrix<T>& lti::genericMatrix< T >::copy | ( | const genericMatrix< T > & | other, | |
const irectangle & | window | |||
) | [inline] |
copy the contents in the rectangle windows
of other
in this object.
The result of the copy is always a connected genericMatrix. I.e. you cannot copy the sub-genericMatrix property of another genericMatrix.
other | the other genericMatrix to be copied | |
window | rectangle define the copy area |
Reimplemented in lti::matrix< T >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, and lti::matrix< sqrType >.
genericMatrix<T>& lti::genericMatrix< T >::copy | ( | const genericMatrix< T > & | other, | |
const int | fromRow, | |||
const int | toRow = MaxInt32 , |
|||
const int | fromCol = 0 , |
|||
const int | toCol = MaxInt32 | |||
) |
copy the contents of the rectangle described by the indices of other
into this object.
The result of the copy is always a connected genericMatrix. I.e. you cannot copy the sub-genericMatrix property of another genericMatrix.
other | the other genericMatrix to be copied | |
fromRow | initial row of the other genericMatrix to be copied | |
toRow | last row to be copied of the other genericMatrix | |
fromCol | initial column of the other genericMatrix to be copied | |
toCol | last column to be copied of the other genericMatrix |
Reimplemented in lti::matrix< T >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, and lti::matrix< sqrType >.
genericMatrix<T>& lti::genericMatrix< T >::copy | ( | const genericMatrix< T > & | other | ) |
copy the contents of other
in this object.
The result of the copy is always a connected genericMatrix. I.e. you cannot copy the sub-genericMatrix property of another genericMatrix.
other | the other genericMatrix to be copied |
Reimplemented from lti::ioObject.
Reimplemented in lti::kernel2D< T >, lti::matrix< T >, lti::kernel2D< float >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, and lti::matrix< sqrType >.
void lti::genericMatrix< T >::detach | ( | genericVector< T > & | receiver | ) |
Free the data of this object and hand it over to the "receiver".
The value of ownsData is also transfered to the receiver. (see Note).
This function makes a "memory block transfusion" to a vector by concatenating the rows of the genericMatrix. It is a very efficient way to move the data of this genericMatrix into a vector, if you don't need the source data anymore!
Note: This method will fail if this genericMatrix is not connected. Also take care that if the attach() or useExternData() methods of this genericMatrix have been called before detachment, the same rules for memory management apply now for the receiver.
At the end of the detachment, this genericMatrix will be empty.
receiver | the genericMatrix which will receive the memory block. All data of that genericMatrix will be first deleted! |
void lti::genericMatrix< T >::detach | ( | genericMatrix< T > & | receiver | ) |
Free the data of this object and hand it over to the "receiver".
The value of ownsData is also transfered to the receiver. (see Note).
This function makes a "memory block transfusion" to another genericMatrix. It is a very efficient way to make a copy of this genericMatrix, if you don't need the source data anymore!
Note: This method will fail if this genericMatrix is not connected. Also take care that if the attach() or useExternData() methods of this genericMatrix have been called before detachment, the same rules for memory management apply now for the receiver.
At the end of the detachment, this genericMatrix will be empty.
receiver | the genericMatrix which will receive the memory block. All data of that genericMatrix will be first deleted! |
Referenced by lti::geometricTransform::apply(), lti::decimation::apply(), lti::geometricTransform::rotate(), and lti::geometricTransform::scale().
bool lti::genericMatrix< T >::empty | ( | ) | const |
returns true if the genericMatrix is empty
Referenced by lti::medianFilter::realMedian().
const_iterator lti::genericMatrix< T >::end | ( | ) | const [inline] |
returns iterator to the end of the genericMatrix
iterator lti::genericMatrix< T >::end | ( | ) | [inline] |
returns iterator to the end of the genericMatrix
Referenced by lti::cityBlockDistance(), lti::distanceSqr(), and lti::regionGrowing::mask().
bool lti::genericMatrix< T >::equals | ( | const genericMatrix< T > & | other | ) | const |
Compare this genericMatrix with other.
other | the other genericMatrix to be compared with |
void lti::genericMatrix< T >::exchange | ( | genericMatrix< T > & | other | ) |
void lti::genericMatrix< T >::fill | ( | const genericMatrix< T > & | mat, | |
const irectangle & | window, | |||
const ipoint & | start = point(0, 0) | |||
) | [inline] |
fills the region of this genericMatrix specified by window
with the contents of the genericMatrix mat
starting at start
.
If these values are out of bounds, they will be (internally) adjusted to correct values.
mat | pointer to the data to be copied | |
window | the window to be filled | |
start | the start position of the region to be copied of the genericMatrix mat |
void lti::genericMatrix< T >::fill | ( | const genericMatrix< T > & | mat, | |
const ipoint & | from, | |||
const ipoint & | to = point(MaxInt32, MaxInt32) , |
|||
const ipoint & | startAt = point(0, 0) | |||
) | [inline] |
fills this genericMatrix between the "from's" and "to's" with the contents of the genericMatrix mat
starting at startAtRow
and startAtCol
mat | the genericMatrix with the data to be copied | |
from | first position of the subgenericMatrix to be filled | |
to | last position of the subgenericMatrix to be filled | |
startAt | starting position of mat where the data is located. |
void lti::genericMatrix< T >::fill | ( | const genericMatrix< T > & | mat, | |
const int | fromRow = 0 , |
|||
const int | fromCol = 0 , |
|||
const int | toRow = MaxInt32 , |
|||
const int | toCol = MaxInt32 , |
|||
const int | startAtRow = 0 , |
|||
const int | startAtCol = 0 | |||
) |
fills this genericMatrix between the "from's" and "to's" with the contents of the genericMatrix mat
starting at startAtRow
and startAtCol
WARNING: Syntax changed for the parameters: the old version was fromRow,toRow, fromCol,toCol. Now the order is: fromRow,FROMCOL,TOROW,toCol. This allow to give the from coordinates only!
mat | the genericMatrix with the data to be copied | |
fromRow | first row of the subgenericMatrix to be filled | |
fromCol | first column of the subgenericMatrix to be filled | |
toRow | last row of the subgenericMatrix to be filled | |
toCol | last column of the subgenericMatrix to be filled | |
startAtRow | starting row of mat where the data is located. | |
startAtCol | starting column of mat where the data is located. |
void lti::genericMatrix< T >::fill | ( | const T | data[], | |
const irectangle & | window | |||
) | [inline] |
fills genericMatrix elements with iniValue
.
The fill "area" is limited by window
. If these values are out of bounds, they will be (internally) adjusted to correct values.
data | pointer to the data to be copied | |
window | the window to be filled |
void lti::genericMatrix< T >::fill | ( | const T | data[], | |
const ipoint & | from, | |||
const ipoint & | to = point(MaxInt32, MaxInt32) | |||
) | [inline] |
fills genericMatrix elements with the data pointed by data
.
The fill "area" is limited by fromCol
,toCol
, fromRow
and toRow
. If these values are out of bounds, they will be (internally) adjusted to correct values.
data | pointer to the data to be copied. | |
from | first position of the subgenericMatrix to be filled | |
to | last position of the subgenericMatrix to be filled |
void lti::genericMatrix< T >::fill | ( | const T | data[], | |
const int | fromRow = 0 , |
|||
const int | fromCol = 0 , |
|||
const int | toRow = MaxInt32 , |
|||
const int | toCol = MaxInt32 | |||
) |
fills genericMatrix elements with the data pointed by data
.
The fill "area" is limited by fromCol
,toCol
, fromRow
and toRow
. If these values are out of bounds, they will be (internally) adjusted to correct values.
WARNING: Syntax changed for the parameters: the old version was fromRow,toRow, fromCol,toCol. Now the order is: fromRow,FROMCOL,TOROW,toCol. This allow to give the first coordinates only!
data | pointer to the data to be copied. | |
fromRow | first row of the subgenericMatrix to be filled | |
fromCol | first column of the subgenericMatrix to be filled | |
toRow | last row of the subgenericMatrix to be filled | |
toCol | last column of the subgenericMatrix to be filled |
void lti::genericMatrix< T >::fill | ( | const T & | iniValue, | |
const irectangle & | window | |||
) | [inline] |
fills genericMatrix elements with iniValue
.
The fill "area" is limited by window
. If these values are out of bounds, they will be (internally) adjusted to correct values.
iniValue | the elements will be initialized with this value | |
window | the window to be filled |
void lti::genericMatrix< T >::fill | ( | const T & | iniValue, | |
const ipoint & | from, | |||
const ipoint & | to = point(MaxInt32, MaxInt32) | |||
) | [inline] |
fills genericMatrix elements with iniValue
.
The fill "area" is limited by from
and to
points If these values are out of bounds, they will be (internally) adjusted to correct values.
iniValue | the elements will be initialized with this value | |
from | first position of the subgenericMatrix to be filled | |
to | last row of the subgenericMatrix to be filled |
void lti::genericMatrix< T >::fill | ( | const T & | iniValue, | |
const int | fromRow = 0 , |
|||
const int | fromCol = 0 , |
|||
const int | toRow = MaxInt32 , |
|||
const int | toCol = MaxInt32 | |||
) |
fills genericMatrix elements with iniValue
.
The fill "area" is limited by fromCol
,toCol
, fromRow
and toRow
. If these values are out of bounds, they will be (internally) adjusted to correct values.
WARNING: Syntax changed for the parameters: the old version was fromRow,toRow, fromCol,toCol. Now the order is: fromRow,FROMCOL,TOROW,toCol. This allow to give the first coordinates only!
iniValue | the elements will be initialized with this value | |
fromRow | first row of the subgenericMatrix to be filled | |
fromCol | first column of the subgenericMatrix to be filled | |
toRow | last row of the subgenericMatrix to be filled | |
toCol | last column of the subgenericMatrix to be filled |
genericVector<T> lti::genericMatrix< T >::getColumnCopy | ( | const int | col | ) | const [inline] |
return genericMatrix-column as a vector.
This method copies the data of the genericMatrix, therefore is not as fast as getRow()
col | the number of the column to be copied |
Reimplemented in lti::matrix< T >, lti::matrix< int32 >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, lti::matrix< sqrType >, lti::matrix< rgbPixel >, and lti::matrix< ubyte >.
void lti::genericMatrix< T >::getColumnCopy | ( | const int | col, | |
genericVector< T > & | theCol | |||
) | const |
return genericMatrix-column as a vector.
This method copies the data of the genericMatrix, 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 genericMatrix should be copied. |
genericVector<T> lti::genericMatrix< T >::getDiagonal | ( | ) | const [inline] |
Return the diagonal elements of the genericMatrix as vector.
This method copies the diagonal elements of the genericMatrix into the vector. If the genericMatrix is non-symmetrical, the vector will be of dimension min(rows(),columns()).
Reimplemented in lti::matrix< T >, lti::matrix< int32 >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, lti::matrix< sqrType >, lti::matrix< rgbPixel >, and lti::matrix< ubyte >.
void lti::genericMatrix< T >::getDiagonal | ( | genericVector< T > & | diag | ) | const |
Return the diagonal elements of the genericMatrix as vector.
This method copies the diagonal elements of the genericMatrix into the vector. If the genericMatrix is non-symmetrical, the vector will be of dimension min(rows(),columns()).
diag | a vector, where the diagonal of the genericMatrix should be copied. |
eStoreMode lti::genericMatrix< T >::getMode | ( | ) | const [inline] |
Data storage mode.
Returns the data storage mode, which can be:
Connected
if the memory is a single block, orLine
if the memory of each line is allocated in different places.For the lined-matrices the interators will not work. You can however iterate on each individual row, which are always connected.
The only possible way to get a lined-matrix is as a submatrix of another one, using the appropriate constructor: genericMatrix(const bool, genericMatrix<T>&,const int,const int, const int,const int)
const genericVector<T>& lti::genericMatrix< T >::getRow | ( | const int | row | ) | const [inline] |
return genericMatrix-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 in lti::matrix< T >, lti::matrix< int32 >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, lti::matrix< sqrType >, lti::matrix< rgbPixel >, and lti::matrix< ubyte >.
genericVector<T>& lti::genericMatrix< T >::getRow | ( | const int | row | ) | [inline] |
return genericMatrix-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 in lti::matrix< T >, lti::matrix< int32 >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, lti::matrix< sqrType >, lti::matrix< rgbPixel >, and lti::matrix< ubyte >.
Referenced by lti::genericMatrix< bool >::castFrom().
genericVector<T> lti::genericMatrix< T >::getRowCopy | ( | const int | row | ) | const [inline] |
return genericMatrix-row as a vector.
This method copies the data of the genericMatrix, therefore is not as fast as getRow()
row | the number of tthe row to be copied |
Reimplemented in lti::matrix< T >, lti::matrix< int32 >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, lti::matrix< sqrType >, lti::matrix< rgbPixel >, and lti::matrix< ubyte >.
void lti::genericMatrix< T >::getRowCopy | ( | const int | row, | |
genericVector< T > & | theRow | |||
) | const [inline] |
Copy a row vector in the given parameter.
This method copies the data of a given row of the genericMatrix in the given vector.
row | the number of the row to be copied | |
theRow | the vector, where the data will be copied |
virtual const char* lti::genericMatrix< T >::getTypeName | ( | ) | const [virtual] |
returns the name of this class: "genericMatrix"
Reimplemented from lti::mathObject.
Reimplemented in lti::image, lti::channel, lti::channel8, lti::channel32, lti::kernel2D< T >, lti::matrix< T >, lti::kernel2D< float >, lti::kernel2D< ubyte >, lti::matrix< int32 >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, lti::matrix< sqrType >, lti::matrix< rgbPixel >, and lti::matrix< ubyte >.
const_iterator lti::genericMatrix< T >::inverseBegin | ( | ) | const [inline] |
This method returns an iterator that points to the last valid element of the genericMatrix.
See inverseBegin() for more details.
iterator lti::genericMatrix< T >::inverseBegin | ( | ) | [inline] |
This method returns an iterator that points to the last valid element of the genericMatrix.
It is used for inverse order iteration through the genericMatrix using normal iterators (as opposed to reverse iterators). This has the advantage that iterators going from front to end and in the inverse direction are the same and can thus be compared, copied etc. Further the implementation of reverse_iterators is not as fast as that of iterators and thus not desired in the LTI-Lib.
See lti::genericVector<T>::inverseBegin() for an example.
const_iterator lti::genericMatrix< T >::inverseEnd | ( | ) | const [inline] |
This method returns an iterator that points to the element before the first valid element of the genericMatrix.
iterator lti::genericMatrix< T >::inverseEnd | ( | ) | [inline] |
This method returns an iterator that points to the element before the first valid element of the genericMatrix.
It is used to mark the end for inverse order iteration through the genericMatrix using normal iterators (as opposed to reverse iterators). This has the advantage that iterators going from front to end and in the inverse direction are the same and can thus be compared, copied etc.
int lti::genericMatrix< T >::lastColumn | ( | ) | const [inline] |
Index of the last columns (columns()-1).
Reimplemented in lti::kernel2D< T >, lti::kernel2D< float >, and lti::kernel2D< ubyte >.
Referenced by lti::nearestNeighborInterpolator< T >::interpolate(), lti::draw< rgbPixel >::line(), and lti::medianFilter::realMedian().
int lti::genericMatrix< T >::lastRow | ( | ) | const [inline] |
index of the last row (rows()-1)
Reimplemented in lti::kernel2D< T >, lti::kernel2D< float >, and lti::kernel2D< ubyte >.
Referenced by lti::nearestNeighborInterpolator< T >::interpolate(), lti::draw< rgbPixel >::line(), and lti::medianFilter::realMedian().
int lti::genericMatrix< T >::metaColumns | ( | ) | const [inline] |
Number of "physical" columns of the matrix.
Connected
Matrix, (see getMode()), this member returns the same value as columns().If this is a Line
Matrix, this value is bigger or equal than columns(). If this was created with the copy constructor for a submatrix with "no copy data", this value will return the number of columns of the original matrix.
int lti::genericMatrix< T >::metaRows | ( | ) | const [inline] |
Number of "physical" rows of the matrix.
Connected
Matrix, (see getMode()), this member returns the same value as rows().If this is a Line
Matrix, this value is bigger or equal than rows(). If this was created with the copy constructor for a submatrix with "no copy data", this value will return the size of the original matrix.
genericMatrix<T>& lti::genericMatrix< T >::operator= | ( | const genericMatrix< T > & | other | ) | [inline] |
Assigment operator (alias for copy(other)).
other | the genericMatrix to be copied |
Reimplemented from lti::ioObject.
Reimplemented in lti::matrix< T >, lti::matrix< value_type >, lti::matrix< double >, lti::matrix< float >, lti::matrix< int >, lti::matrix< W >, and lti::matrix< sqrType >.
bool lti::genericMatrix< T >::operator== | ( | const genericMatrix< T > & | other | ) | const [inline] |
Compare the contents of each element of this genericMatrix with the other one.
It assumes the type T can be compared using the operator==.
other | the other genericMatrix to be compared with |
const genericVector<T>& lti::genericMatrix< T >::operator[] | ( | const int | row | ) | const [inline] |
genericVector<T>& lti::genericMatrix< T >::operator[] | ( | const int | row | ) | [inline] |
bool lti::genericMatrix< T >::ownsData | ( | ) | const [inline] |
owns this object the data? returns false if this genericMatrix contains a reference to extern data.
virtual bool lti::genericMatrix< T >::read | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | [virtual] |
read the object from the given ioHandler
Reimplemented from lti::mathObject.
Reimplemented in lti::kernel2D< T >, lti::kernel2D< float >, and lti::kernel2D< ubyte >.
void lti::genericMatrix< T >::resize | ( | const ipoint & | newDim, | |
const T & | iniValue = T() , |
|||
const bool | copyData = true , |
|||
const bool | initNew = true | |||
) | [inline] |
change the dimensions of the genericMatrix.
newDim | new dimensions of the genericMatrix | |
iniValue | the initialization value. | |
copyData | if this parameter is true, the old data of the genericMatrix will be copied. If it is false, the old data will be lost. | |
initNew | if this parameter is true, then all new elements (if they exist) will be initialized with iniValue . if initNew is false, then the new elements are left uninitialized. |
If the resize is possible (see useExternData()), this object will always owns the data afterwards!
This is equivalent to call resize(newDim.y,newDim.x,iniValue,copyData,initNew)
void lti::genericMatrix< T >::resize | ( | const int | newRows, | |
const int | newCols, | |||
const T & | iniValue = T() , |
|||
const bool | copyData = true , |
|||
const bool | initNew = true | |||
) |
change the dimensions of the genericMatrix.
newRows | new number of rows | |
newCols | new number of columns | |
iniValue | the initialization value. | |
copyData | if this parameter is true, the old data of the genericMatrix will be copied. If it is false, the old data will be lost. | |
initNew | if this parameter is true, then all new elements (if they exist) will be initialized with iniValue . if initNew is false, then the new elements are left uninitialized. |
For example:
lti::genericMatrix<int> myMat; // creates empty genericMatrix myMat.resize(5,5,0); // genericMatrix with 5x5 elements // initialized with 0 myMat.resize(10,7,2); // genericMatrix has now 10x7 elements: the // subgenericMatrix 5x5 at (0,0) has still 0s // and the rest have a 2 myMat.resize(20,10,0,false,false); // now the genericMatrix has 20 // elements but their values // are unknown. myMat.resize(5,5,1,false,true); // the genericMatrix has now 5x5 // elements all initialized with 1 // note that the last line could also be written: myMat.resize(5,5,1,false);
If the new size is not equal to the old size, the genericMatrix always owns the data afterwards (i.e. new memory is allocated) even if it didn't own the data before. Otherwise the ownership remains unchanged. You can use restoreOwnership() if you just want to own the data.
Referenced by lti::decimation::apply(), lti::matrix< ubyte >::castFrom(), lti::genericMatrix< bool >::castFrom(), and lti::medianFilter::realMedian().
void lti::genericMatrix< T >::restoreOwnership | ( | ) |
If this object does not own its data, this member will create a new memory buffer with the same data and will make this genericMatrix as its owner.
You can also be sure, that the new memory block will be connected (see also getMode() ). If this genericMatrix already owns its data nothing happens.
int lti::genericMatrix< T >::rows | ( | ) | const [inline] |
number of rows of the genericMatrix
Referenced by lti::earthMoversDistance< W, C, D >::apply(), lti::decimation::apply(), lti::matrix< ubyte >::castFrom(), lti::genericMatrix< bool >::castFrom(), lti::SOFM2DVisualizer::drawClasses(), lti::SOFM2DVisualizer::drawHits(), lti::draw< rgbPixel >::enterPX(), lti::draw< T >::inCanvas(), lti::nearestNeighborInterpolator< T >::interpolate(), lti::kernel2D< ubyte >::lastRow(), lti::medianFilter::realMedian(), lti::geometricTransform::rotate(), and lti::SOFM2DVisualizer::sammonsMapper().
void lti::genericMatrix< T >::setColumn | ( | const int | col, | |
const genericVector< T > & | theCol | |||
) |
void lti::genericMatrix< T >::setDiagonal | ( | const genericVector< T > & | diag | ) |
Sets the diagonal of the genericMatrix to the values given in the genericVector diag.
Let r
be the number of rows and c
be the number of columns of the matrix. Then minRC
is min(r,c)
. Also let d
be the size of diag. Only min(minRC,d)
values are copied from diag. If d
is smaller than minRC
the remaining values on the diagonal are left untouched. The copying always starts at (0,0) of the matrix.
diag | values to be copied into the diagonal of the matrix |
void lti::genericMatrix< T >::setRow | ( | const int | row, | |
const genericVector< T > & | theRow | |||
) | [inline] |
const size_type& lti::genericMatrix< T >::size | ( | ) | const [inline] |
returns the size of the genericMatrix in a lti::point structure.
x
coordinate and the number of rows in its y
coordinate. Referenced by lti::genericMatrix< bool >::castFrom(), lti::cityBlockDistance(), lti::distanceSqr(), and lti::fillPattern::setMask().
void lti::genericMatrix< T >::swap | ( | genericMatrix< T > & | other | ) |
Exchange (in a fast way) the data between this and the other genericMatrix.
Similar to detach(), this method will exchange the complete memory blocks, avoiding an element-wise copy.
other | the genericMatrix with which the data will be exchanged. |
void lti::genericMatrix< T >::useExternData | ( | const int | rows, | |
const int | cols, | |||
T * | data | |||
) |
Reference to extern data.
This member allows the use of this object as an access-functor for the 'data'. An access to the element at (r,c) is equivalent to data[r*columns() + c]. The user must take care for memory allocation and deallocation: this object will never delete the data!. If rows and cols are invalid dimensions, the behaviour will be unpredictible.
rows | number of rows | |
cols | number of columns | |
data | a pointer to the memory block to be used |
For an example see attach()
virtual bool lti::genericMatrix< T >::write | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | const [virtual] |
write the object in the given ioHandler
Reimplemented from lti::mathObject.
Reimplemented in lti::kernel2D< T >, lti::kernel2D< float >, and lti::kernel2D< ubyte >.
int lti::genericMatrix< T >::lastColIdx [protected] |
index of the last column
int lti::genericMatrix< T >::lastRowIdx [protected] |
index of the last row
int lti::genericMatrix< T >::metaNumColumns [protected] |
int lti::genericMatrix< T >::metaNumRows [protected] |
eStoreMode lti::genericMatrix< T >::mode [protected] |
indicate if theElements
points to consecutive memory or to "sparse" memory
int& lti::genericMatrix< T >::numColumns [protected] |
number of columns of the genericMatrix
int& lti::genericMatrix< T >::numRows [protected] |
number of rows of the genericMatrix
bool lti::genericMatrix< T >::ownData [protected] |
indicates if theElements
points to own data or to external data.
genericVector<T>* lti::genericMatrix< T >::rowAddressTable [protected] |
table of pointers to the rows
T* lti::genericMatrix< T >::theElements [protected] |
pointer to the elements of the genericMatrix
ipoint lti::genericMatrix< T >::theSize [protected] |
theSize.x is equal numColumns and theSize.y is equal numRows
int lti::genericMatrix< T >::totalSize [protected] |
size of theElements