bpp-core3  3.0.0
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)
 
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
 
const std::vector< Scalar > & getRow (size_t i) const
 
std::vector< Scalar > & getRow (size_t i)
 
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)
 
virtual bool equals (const Matrix &m, double threshold=NumConstants::TINY())
 

Protected 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 92 of file Matrix.h.

Constructor & Destructor Documentation

◆ RowMatrix() [1/3]

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

Definition at line 99 of file Matrix.h.

◆ RowMatrix() [2/3]

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

Definition at line 101 of file Matrix.h.

◆ RowMatrix() [3/3]

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

Definition at line 109 of file Matrix.h.

Member Function Documentation

◆ addRow()

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

Definition at line 185 of file Matrix.h.

Referenced by bpp::ApplicationTools::getMatrixParameter().

◆ clone()

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 142 of file Matrix.h.

◆ col()

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 169 of file Matrix.h.

◆ equals()

template<class Scalar>
virtual bool bpp::Matrix< Scalar >::equals ( const Matrix< Scalar > &  m,
double  threshold = NumConstants::TINY() 
)
inlinevirtualinherited

◆ getNumberOfColumns()

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

Implements bpp::Matrix< Scalar >.

Definition at line 150 of file Matrix.h.

Referenced by bpp::DualityDiagram::compute_().

◆ getNumberOfRows()

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

Implements bpp::Matrix< Scalar >.

Definition at line 148 of file Matrix.h.

Referenced by bpp::DualityDiagram::compute_().

◆ getRow() [1/2]

template<class Scalar>
const std::vector<Scalar>& bpp::RowMatrix< Scalar >::getRow ( size_t  i) const
inline

Definition at line 159 of file Matrix.h.

Referenced by bpp::AbstractHmmTransitionMatrix::sample().

◆ getRow() [2/2]

template<class Scalar>
std::vector<Scalar>& bpp::RowMatrix< Scalar >::getRow ( size_t  i)
inline

Definition at line 164 of file Matrix.h.

◆ operator()() [1/2]

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 144 of file Matrix.h.

◆ operator()() [2/2]

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 146 of file Matrix.h.

◆ operator=()

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

Definition at line 123 of file Matrix.h.

◆ resize()

template<class Scalar>
void bpp::RowMatrix< Scalar >::resize ( size_t  nRows,
size_t  nCols 
)
inlinevirtual

Resize the matrix.

Parameters
nRowsThe new number of rows.
nColsThe new number of columns.

Implements bpp::Matrix< Scalar >.

Definition at line 176 of file Matrix.h.

Referenced by bpp::DualityDiagram::compute_(), bpp::EigenValue< Real >::EigenValue(), and bpp::AbstractNumericalDerivative::setParametersToDerivate().

◆ row()

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 152 of file Matrix.h.

Member Data Documentation

◆ m_

template<class Scalar>
std::vector< std::vector<Scalar> > bpp::RowMatrix< Scalar >::m_
protected

Definition at line 96 of file Matrix.h.


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