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

Weighted Matrix. More...

#include <yat/utility/MatrixWeighted.h>

Public Types

typedef DataWeight value_type
 
typedef DataWeightreference
 
typedef const DataWeightconst_reference
 
typedef std::vector
< DataWeight >::iterator 
iterator
 
typedef std::vector
< DataWeight >::const_iterator 
const_iterator
 
typedef StrideIterator
< std::vector< DataWeight >
::iterator
column_iterator
 
typedef StrideIterator
< std::vector< DataWeight >
::const_iterator
const_column_iterator
 
typedef column_iterator row_iterator
 
typedef const_column_iterator const_row_iterator
 

Public Member Functions

 MatrixWeighted (void)
 The default constructor. More...
 
 MatrixWeighted (size_t r, size_t c, double init_value=0, double init_weight=1.0)
 Create a r times c MatrixWeighted. More...
 
 MatrixWeighted (const MatrixWeighted &)
 The copy constructor.
 
 MatrixWeighted (const Matrix &other)
 Constructor. More...
 
 MatrixWeighted (std::istream &, char sep='\0')
 The istream constructor. More...
 
iterator begin (void)
 
const_iterator begin (void) const
 
column_iterator begin_column (size_t i)
 
const_column_iterator begin_column (size_t i) const
 
row_iterator begin_row (size_t i)
 
const_row_iterator begin_row (size_t i) const
 
size_t columns (void) const
 
iterator end (void)
 
const_iterator end (void) const
 
column_iterator end_column (size_t i)
 
const_column_iterator end_column (size_t i) const
 
row_iterator end_row (size_t i)
 
const_row_iterator end_row (size_t i) const
 
void resize (size_t rows, size_t columns)
 Resize MatrixWeighted. More...
 
size_t rows (void) const
 
void swap (MatrixWeighted &other)
 swap objects More...
 
DataWeightoperator() (size_t row, size_t column)
 Element access operator. More...
 
const DataWeightoperator() (size_t row, size_t column) const
 Element access operator. More...
 
const MatrixWeightedoperator= (const MatrixWeighted &other)
 The assignment operator. More...
 

Related Functions

(Note that these are not member functions.)

void swap (MatrixWeighted &, MatrixWeighted &)
 Exchange all elements. More...
 

Detailed Description

Weighted Matrix.

Since
New in yat 0.5

Member Typedef Documentation

Mutable iterator that iterates over one column

Read-only iterator that iterates over one column

Read-only iterator that iterates over all elements

const_reference type is const DataWeight&

Read-only iterator that iterates over one row

Mutable iterator that iterates over all elements

reference type is DataWeight&

Mutable iterator that iterates over one row

value_type is DataWeight

Constructor & Destructor Documentation

theplu::yat::utility::MatrixWeighted::MatrixWeighted ( void  )

The default constructor.

Creates a zero size MatrixWeighted

theplu::yat::utility::MatrixWeighted::MatrixWeighted ( size_t  r,
size_t  c,
double  init_value = 0,
double  init_weight = 1.0 
)

Create a r times c MatrixWeighted.

If r is zero c must be zero and vice versa.

Constructor allocating memory space for r times c elements, and sets all elements to DataWeight(init_value, init_weight)

theplu::yat::utility::MatrixWeighted::MatrixWeighted ( const Matrix other)
explicit

Constructor.

Data is copied from other and weights are calculated using the binary_weight function, i.e., a NaN gets a zero weight (0.0) and other data values results in a unity weight (1.0).

theplu::yat::utility::MatrixWeighted::MatrixWeighted ( std::istream &  ,
char  sep = '\0' 
)
explicit

The istream constructor.

This constructor first creates a Matrix using the Matrix istream constructor, and then constructs MatrixWeighted using MatrixWeighted(const Matrix&).

Note
Weights cannot be set from the streams. Weights are set as outlined in the MatrixWeighted(const Matrix&) documentation.
See Also
Matrix(std::istream &, char) and MatrixWeighted(const Matrix&)

Member Function Documentation

iterator theplu::yat::utility::MatrixWeighted::begin ( void  )

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

Returns
iterator pointing to upper-left element.
const_iterator theplu::yat::utility::MatrixWeighted::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.
column_iterator theplu::yat::utility::MatrixWeighted::begin_column ( size_t  i)

Iterator iterates along a column.

Returns
iterator pointing to first element of column i.
const_column_iterator theplu::yat::utility::MatrixWeighted::begin_column ( size_t  i) const

Iterator iterates along a column.

Returns
const_iterator pointing to first element of column i.
row_iterator theplu::yat::utility::MatrixWeighted::begin_row ( size_t  i)

Iterator iterates along a row.

Returns
iterator pointing to first element of row i.
const_row_iterator theplu::yat::utility::MatrixWeighted::begin_row ( size_t  i) const

Iterator iterates along a row.

Returns
const_iterator pointing to first element of row i.
size_t theplu::yat::utility::MatrixWeighted::columns ( void  ) const
Returns
The number of columns in the matrix.
iterator theplu::yat::utility::MatrixWeighted::end ( void  )
Returns
iterator pointing to end of matrix
const_iterator theplu::yat::utility::MatrixWeighted::end ( void  ) const
Returns
const_iterator pointing to end of matrix
column_iterator theplu::yat::utility::MatrixWeighted::end_column ( size_t  i)
Returns
iterator pointing to end of column i
const_column_iterator theplu::yat::utility::MatrixWeighted::end_column ( size_t  i) const
Returns
const_iterator pointing to end of column i
row_iterator theplu::yat::utility::MatrixWeighted::end_row ( size_t  i)
Returns
iterator pointing to end of row i
const_row_iterator theplu::yat::utility::MatrixWeighted::end_row ( size_t  i) const
Returns
const_iterator pointing to end of row i
DataWeight& theplu::yat::utility::MatrixWeighted::operator() ( size_t  row,
size_t  column 
)

Element access operator.

Returns
Reference to the element position (row, column).
const DataWeight& theplu::yat::utility::MatrixWeighted::operator() ( size_t  row,
size_t  column 
) const

Element access operator.

Returns
Const reference to the element position (row, column).
const MatrixWeighted& theplu::yat::utility::MatrixWeighted::operator= ( const MatrixWeighted other)

The assignment operator.

Returns
A const reference to the resulting Matrix.
void theplu::yat::utility::MatrixWeighted::resize ( size_t  rows,
size_t  columns 
)

Resize MatrixWeighted.

Elements in MatrixWeighted are undefined after a resize.

If rows is zero columns must be zero and vice versa.

Note
this function may invalidate iterators.
size_t theplu::yat::utility::MatrixWeighted::rows ( void  ) const
Returns
The number of rows in the matrix.
void theplu::yat::utility::MatrixWeighted::swap ( MatrixWeighted other)

swap objects

Takes constant time. Invalidates iterators. There is no requirement on the size of other.

Friends And Related Function Documentation

void swap ( MatrixWeighted ,
MatrixWeighted  
)
related

Exchange all elements.

Takes constant time.

See Also
MatrixWeighted::swap(MatrixWeighted&)

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

Generated on Tue Sep 26 2017 02:33:31 for yat by  doxygen 1.8.5