yat  0.8.3pre
Public Types | Public Member Functions | Related Functions
theplu::yat::classifier::MatrixLookupWeighted Class Reference

General view into utility::MatrixWeighted. More...

#include <yat/classifier/MatrixLookupWeighted.h>

List of all members.

Public Types

typedef utility::DataWeight value_type
typedef const utility::DataWeightconst_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.
 MatrixLookupWeighted (const utility::MatrixWeighted &matrix, bool owner=false)
 Create a lookup into entire matrix.
 MatrixLookupWeighted (const MatrixLookup &matrix)
 MatrixLookupWeighted (const MatrixLookupWeighted &other)
 Copy constructor.
 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.
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 MatrixLookupWeightedoperator= (const MatrixLookupWeighted &)
 assigment operator

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &s, const MatrixLookupWeighted &)

Detailed Description

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.

See also:
MatrixLookup

Member Typedef Documentation

'Read only' iterator used to iterate over a column

const_reference type is const DataWeight

Since:
New in yat 0.5

'Read only' iterator used to iterate over a row

value_type is DataWeight

Since:
New in yat 0.5

Constructor & Destructor Documentation

Create a lookup into matrix.

The created lookup, mlw, will fullfil: mlw(i,j) = matrix(rows(i), columns(j))

Constructor creating a MatrixLookupWeighted from a MatrixLookup. A weight matrix with unitary weights are created internally.

Note:
no check for nan is performed.
from yat 0.5 data is copied and further modifications in matrix will not be reflected in MatrixLookupWeighted.

Copy constructor.

If other is owner of underlying data, constructed MatrixLookup will also be set as owner of underlying data.

Note:
If underlying matrix goes out of scope or is deleted, the MatrixLookupWeighted becomes invalid and the result of further use is undefined.

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: $ MatrixLookupWeighted(i,j)=ml(row[i],column[j]) $. 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.

Note:
If underlying matrix goes out of scope or is deleted, the MatrixLookupWeighted becomes invalid and the result of further use is undefined.

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: $ MatrixLookupWeighted(i,j)=ml(i,index[j])$

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: $ MatrixLookupWeighted(i,j) = ml(index[i],j) $

If ml is owner of underlying data, constructed MatrixLookup will also be set as owner of underlying data.

Note:
If underlying matrix goes out of scope or is deleted, the MatrixLookupWeighted becomes invalid and the result of further use is undefined.
Deprecated:
Provided for backward compatibility with the 0.6 API. Use MatrixLookupWeighted(const MatrixLookupWeighted&, const utility::Index&, const utility::Index&)
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.

See also:
utility::MatrixWeighted(istream&) for details.

Destructor. If MatrixLookup is owner (and the only owner) of underlying matrix, the matrices are destroyed.


Member Function Documentation

Iterator iterates along a row. When end of row is reached it jumps to beginning of next row.

Returns:
const_iterator pointing to upper-left element.

Iterator iterates along a column.

Returns:
iterator pointing to first element of column i.

Iterator iterates along a column.

Returns:
const_iterator pointing to first element of column i.
Returns:
number of columns
double theplu::yat::classifier::MatrixLookupWeighted::data ( size_t  row,
size_t  column 
) const
Returns:
data value of element (row, column)
Returns:
const_iterator pointing to end of matrix
Returns:
const_iterator pointing to end of column i
Returns:
const_iterator pointing to end of row i
const_reference theplu::yat::classifier::MatrixLookupWeighted::operator() ( const size_t  row,
const size_t  column 
) const

Access operator

Returns:
data-weight pair (row, column)
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.

Returns:
number of rows
double theplu::yat::classifier::MatrixLookupWeighted::weight ( size_t  row,
size_t  column 
) const
Returns:
weight value of element (row, column)
Returns:
true

Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  s,
const MatrixLookupWeighted  
)
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.


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

Generated on Thu Dec 20 2012 03:12:58 for yat by  doxygen 1.8.0-20120409