yat  0.14.5pre
Public Types | Public Member Functions | Related Functions | List of all members
theplu::yat::classifier::MatrixLookupWeighted Class Reference

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

#include <yat/classifier/MatrixLookupWeighted.h>

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. 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 MatrixLookupWeightedoperator= (const MatrixLookupWeighted &)
 assigment operator More...
 

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

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))

theplu::yat::classifier::MatrixLookupWeighted::MatrixLookupWeighted ( const MatrixLookup matrix)
explicit

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.
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.

Note
If underlying matrix goes out of scope or is deleted, the MatrixLookupWeighted becomes invalid and the result of further use is undefined.
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: $ 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.
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: $ 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.
virtual theplu::yat::classifier::MatrixLookupWeighted::~MatrixLookupWeighted ( )
virtual

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

Member Function Documentation

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.

Returns
const_iterator pointing to upper-left element.
const_column_iterator theplu::yat::classifier::MatrixLookupWeighted::begin_column ( size_t  ) const

Iterator iterates along a column.

Returns
iterator pointing to first element of column i.
const_row_iterator theplu::yat::classifier::MatrixLookupWeighted::begin_row ( size_t  ) const

Iterator iterates along a column.

Returns
const_iterator pointing to first element of column i.
size_t theplu::yat::classifier::MatrixLookupWeighted::columns ( void  ) const
Returns
number of columns
double theplu::yat::classifier::MatrixLookupWeighted::data ( size_t  row,
size_t  column 
) const
Returns
data value of element (row, column)
const_iterator theplu::yat::classifier::MatrixLookupWeighted::end ( void  ) const
Returns
const_iterator pointing to end of matrix
const_column_iterator theplu::yat::classifier::MatrixLookupWeighted::end_column ( size_t  ) const
Returns
const_iterator pointing to end of column i
const_row_iterator theplu::yat::classifier::MatrixLookupWeighted::end_row ( size_t  ) const
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.

size_t theplu::yat::classifier::MatrixLookupWeighted::rows ( void  ) const
Returns
number of rows
double theplu::yat::classifier::MatrixLookupWeighted::weight ( size_t  row,
size_t  column 
) const
Returns
weight value of element (row, column)
bool theplu::yat::classifier::MatrixLookupWeighted::weighted ( void  ) const
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 Tue Sep 26 2017 02:33:29 for yat by  doxygen 1.8.5