yat
0.14.5pre
|
General view into utility::MatrixWeighted. More...
#include <yat/classifier/MatrixLookupWeighted.h>
Public Types | |
typedef utility::DataWeight | value_type |
typedef const utility::DataWeight & | const_reference |
typedef utility::StrideIterator < utility::Container2DIterator < const MatrixLookupWeighted, const value_type, const_reference > > | const_iterator |
'Read Only' iterator | |
typedef boost::permutation_iterator < utility::MatrixWeighted::const_column_iterator, utility::Index::const_iterator > | const_column_iterator |
typedef boost::permutation_iterator < utility::MatrixWeighted::const_row_iterator, utility::Index::const_iterator > | const_row_iterator |
Public Member Functions | |
MatrixLookupWeighted (const utility::MatrixWeighted &matrix, const utility::Index &rows, const utility::Index &columns) | |
Create a lookup into matrix. More... | |
MatrixLookupWeighted (const utility::MatrixWeighted &matrix, bool owner=false) | |
Create a lookup into entire matrix. | |
MatrixLookupWeighted (const MatrixLookup &matrix) | |
MatrixLookupWeighted (const MatrixLookupWeighted &other) | |
Copy constructor. More... | |
MatrixLookupWeighted (const MatrixLookupWeighted &ml, const utility::Index &row, const utility::Index &column) | |
MatrixLookupWeighted (const MatrixLookupWeighted &ml, const utility::Index &, const bool row_vectors) | |
MatrixLookupWeighted (const size_t rows, const size_t columns, const double value=0, const double weight=1) | |
MatrixLookupWeighted (std::istream &, char sep='\0') | |
The istream constructor. More... | |
virtual | ~MatrixLookupWeighted () |
const_iterator | begin (void) const |
const_column_iterator | begin_column (size_t) const |
const_row_iterator | begin_row (size_t) const |
size_t | columns (void) const |
double | data (size_t row, size_t column) const |
const_iterator | end (void) const |
const_column_iterator | end_column (size_t) const |
const_row_iterator | end_row (size_t) const |
size_t | rows (void) const |
double | weight (size_t row, size_t column) const |
bool | weighted (void) const |
const_reference | operator() (const size_t row, const size_t column) const |
const MatrixLookupWeighted & | operator= (const MatrixLookupWeighted &) |
assigment operator More... | |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &s, const MatrixLookupWeighted &) |
General view into utility::MatrixWeighted.
A MatrixLookupWeighted can be created directly from a utility::MatrixWeighted or from another MatrixLookupWeighted. In the latter case, the resulting MatrixLookupWeighted is looking directly into the underlying matrix to avoid multiple lookups.
There is a possibility to set the MatrixLookupWeighted as owner of the underlying utility::MatrixWeighted. This implies that underlying data is deleted in destructor of MatrixLookupWeighted, but only if there is no other owner of the underlying data.
typedef boost::permutation_iterator< utility::MatrixWeighted::const_column_iterator, utility::Index::const_iterator> theplu::yat::classifier::MatrixLookupWeighted::const_column_iterator |
'Read only' iterator used to iterate over a column
const_reference type is const DataWeight
typedef boost::permutation_iterator< utility::MatrixWeighted::const_row_iterator, utility::Index::const_iterator> theplu::yat::classifier::MatrixLookupWeighted::const_row_iterator |
'Read only' iterator used to iterate over a row
value_type is DataWeight
theplu::yat::classifier::MatrixLookupWeighted::MatrixLookupWeighted | ( | const utility::MatrixWeighted & | matrix, |
const utility::Index & | rows, | ||
const utility::Index & | columns | ||
) |
Create a lookup into matrix.
The created lookup, mlw, will fullfil: mlw(i,j) = matrix(rows(i), columns(j))
|
explicit |
Constructor creating a MatrixLookupWeighted from a MatrixLookup. A weight matrix with unitary weights are created internally.
theplu::yat::classifier::MatrixLookupWeighted::MatrixLookupWeighted | ( | const MatrixLookupWeighted & | other | ) |
Copy constructor.
If other is owner of underlying data, constructed MatrixLookup will also be set as owner of underlying data.
theplu::yat::classifier::MatrixLookupWeighted::MatrixLookupWeighted | ( | const MatrixLookupWeighted & | ml, |
const utility::Index & | row, | ||
const utility::Index & | column | ||
) |
Creates a sub-MatrixLookupWeighted. The Lookup is independent of MatrixLookupWeighted ml. The MatrixLookupWeighted is created to look directly into the underlying matrix to avoid multiple lookups.
The row and column define what sub-matrix to look into, in other words, the created MatrixLookupWeighted will fullfill the following: . This also means that number of rows in created MatrixLookupWeighted is equal to size of vector row, and number of columns is equal to size of vector column.
If ml is owner of underlying data, constructed MatrixLookup will also be set as owner of underlying data.
theplu::yat::classifier::MatrixLookupWeighted::MatrixLookupWeighted | ( | const MatrixLookupWeighted & | ml, |
const utility::Index & | , | ||
const bool | row_vectors | ||
) |
Constructor creating a lookup into a sub-matrix of ml. The MatrixLookupWeighted is created to look directly into the underlying matrix to avoid multiple lookups.
If row_vectors is true the new MatrixLookupWeighted will consist of the row vectors defined by index. This means that the created MatrixLookupWeighted will fullfill:
If row_vectors is false the new MatrixLookupWeighted will consist of the rolumn vectors defined by index. This means that the created MatrixLookupWeighted will fullfill:
If ml is owner of underlying data, constructed MatrixLookup will also be set as owner of underlying data.
theplu::yat::classifier::MatrixLookupWeighted::MatrixLookupWeighted | ( | const size_t | rows, |
const size_t | columns, | ||
const double | value = 0 , |
||
const double | weight = 1 |
||
) |
Constructor creating a MatrixLookupWeighted with rows rows, columns columns, and all values are set to value. Created MatrixLookupWeighted owns its underlying matrix.
theplu::yat::classifier::MatrixLookupWeighted::MatrixLookupWeighted | ( | std::istream & | , |
char | sep = '\0' |
||
) |
The istream constructor.
In construction the underlying matrix is created from stream. The MatrixLookupWeighted will be owner of the underlying matrix.
|
virtual |
Destructor. If MatrixLookup is owner (and the only owner) of underlying matrix, the matrices are destroyed.
const_iterator theplu::yat::classifier::MatrixLookupWeighted::begin | ( | void | ) | const |
Iterator iterates along a row. When end of row is reached it jumps to beginning of next row.
const_column_iterator theplu::yat::classifier::MatrixLookupWeighted::begin_column | ( | size_t | ) | const |
Iterator iterates along a column.
const_row_iterator theplu::yat::classifier::MatrixLookupWeighted::begin_row | ( | size_t | ) | const |
Iterator iterates along a column.
size_t theplu::yat::classifier::MatrixLookupWeighted::columns | ( | void | ) | const |
double theplu::yat::classifier::MatrixLookupWeighted::data | ( | size_t | row, |
size_t | column | ||
) | const |
const_iterator theplu::yat::classifier::MatrixLookupWeighted::end | ( | void | ) | const |
const_column_iterator theplu::yat::classifier::MatrixLookupWeighted::end_column | ( | size_t | ) | const |
const_row_iterator theplu::yat::classifier::MatrixLookupWeighted::end_row | ( | size_t | ) | const |
const_reference theplu::yat::classifier::MatrixLookupWeighted::operator() | ( | const size_t | row, |
const size_t | column | ||
) | const |
Access operator
const MatrixLookupWeighted& theplu::yat::classifier::MatrixLookupWeighted::operator= | ( | const MatrixLookupWeighted & | ) |
assigment operator
Does only change MatrixLookupWeighted not the underlying matrix object. However if the MatrixLookupWeighted is owner (and the only owner) of its underlying data, those data will be deleted here.
size_t theplu::yat::classifier::MatrixLookupWeighted::rows | ( | void | ) | const |
double theplu::yat::classifier::MatrixLookupWeighted::weight | ( | size_t | row, |
size_t | column | ||
) | const |
bool theplu::yat::classifier::MatrixLookupWeighted::weighted | ( | void | ) | const |
|
related |
The output operator MatrixLookupWeighted
For eacd data element data(i,j) is printed except those being associated with a zero weight for which nothing is printed.