bpp-core  2.1.0
 All Classes Namespaces Files Functions Variables Typedefs Friends
bpp::RowMatrix< Scalar > Class Template Reference

Matrix storage by row. More...

#include <Bpp/Numeric/Matrix/Matrix.h>

+ Inheritance diagram for bpp::RowMatrix< Scalar >:
+ Collaboration diagram for bpp::RowMatrix< Scalar >:

Public Member Functions

 RowMatrix ()
 
 RowMatrix (size_t nRow, size_t nCol)
 
 RowMatrix (const Matrix< Scalar > &m)
 
RowMatrixoperator= (const Matrix< Scalar > &m)
 
virtual ~RowMatrix ()
 
RowMatrixclone () const
 Create a copy of this object and send a pointer to it. More...
 
const Scalar & operator() (size_t i, size_t j) const
 
Scalar & operator() (size_t i, size_t j)
 
size_t getNumberOfRows () const
 
size_t getNumberOfColumns () const
 
std::vector< Scalar > row (size_t i) const
 
std::vector< Scalar > col (size_t j) const
 
void resize (size_t nRows, size_t nCols)
 Resize the matrix. More...
 
void addRow (const std::vector< Scalar > &newRow) throw (DimensionException)
 
virtual bool equals (const Matrix &m, double threshold=NumConstants::TINY())
 

Private Attributes

std::vector< std::vector
< Scalar > > 
m_
 

Detailed Description

template<class Scalar>
class bpp::RowMatrix< Scalar >

Matrix storage by row.

This matrix is a vector of vector of Scalar. Row access is in $O(1)$ while column access is in $O(nRow)$.

Definition at line 126 of file Matrix.h.

Constructor & Destructor Documentation

template<class Scalar>
bpp::RowMatrix< Scalar >::RowMatrix ( )
inline

Definition at line 133 of file Matrix.h.

Referenced by bpp::RowMatrix< Real >::clone().

template<class Scalar>
bpp::RowMatrix< Scalar >::RowMatrix ( size_t  nRow,
size_t  nCol 
)
inline

Definition at line 135 of file Matrix.h.

template<class Scalar>
bpp::RowMatrix< Scalar >::RowMatrix ( const Matrix< Scalar > &  m)
inline

Definition at line 143 of file Matrix.h.

template<class Scalar>
virtual bpp::RowMatrix< Scalar >::~RowMatrix ( )
inlinevirtual

Definition at line 173 of file Matrix.h.

Member Function Documentation

template<class Scalar>
void bpp::RowMatrix< Scalar >::addRow ( const std::vector< Scalar > &  newRow) throw (DimensionException)
inline

Definition at line 209 of file Matrix.h.

template<class Scalar>
RowMatrix* bpp::RowMatrix< Scalar >::clone ( ) const
inlinevirtual

Create a copy of this object and send a pointer to it.

Returns
A pointer toward the copy object.

Implements bpp::Clonable.

Definition at line 176 of file Matrix.h.

template<class Scalar>
std::vector<Scalar> bpp::RowMatrix< Scalar >::col ( size_t  j) const
inlinevirtual
Returns
the column at position j as a vector.
Parameters
jThe index of the column.

Implements bpp::Matrix< Scalar >.

Definition at line 193 of file Matrix.h.

template<class Scalar>
size_t bpp::RowMatrix< Scalar >::getNumberOfColumns ( ) const
inlinevirtual
template<class Scalar>
size_t bpp::RowMatrix< Scalar >::getNumberOfRows ( ) const
inlinevirtual
Returns
The number of rows.

Implements bpp::Matrix< Scalar >.

Definition at line 182 of file Matrix.h.

Referenced by bpp::RowMatrix< Real >::col(), and bpp::RowMatrix< Real >::col().

template<class Scalar>
const Scalar& bpp::RowMatrix< Scalar >::operator() ( size_t  i,
size_t  j 
) const
inlinevirtual
Returns
$m_{i,j}$.
Parameters
irow index.
jcolumn index.

Implements bpp::Matrix< Scalar >.

Definition at line 178 of file Matrix.h.

Referenced by bpp::RowMatrix< Real >::col(), and bpp::RowMatrix< Real >::row().

template<class Scalar>
Scalar& bpp::RowMatrix< Scalar >::operator() ( size_t  i,
size_t  j 
)
inlinevirtual
Returns
$m_{i,j}$.
Parameters
irow index.
jcolumn index.

Implements bpp::Matrix< Scalar >.

Definition at line 180 of file Matrix.h.

template<class Scalar>
RowMatrix& bpp::RowMatrix< Scalar >::operator= ( const Matrix< Scalar > &  m)
inline

Definition at line 157 of file Matrix.h.

template<class Scalar>
void bpp::RowMatrix< Scalar >::resize ( size_t  nRows,
size_t  nCols 
)
inlinevirtual
template<class Scalar>
std::vector<Scalar> bpp::RowMatrix< Scalar >::row ( size_t  i) const
inlinevirtual
Returns
the row at position i as a vector.
Parameters
iThe index of the row.

Implements bpp::Matrix< Scalar >.

Definition at line 186 of file Matrix.h.

Member Data Documentation


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