NCBI C++ ToolKit
Public Types | Public Member Functions | Protected Attributes | List of all members
CNcbiMatrix< T > Class Template Reference

Search Toolkit Book for CNcbiMatrix

#include <util/math/matrix.hpp>

+ Inheritance diagram for CNcbiMatrix< T >:
+ Collaboration diagram for CNcbiMatrix< T >:

Public Types

typedef vector< TTData
 
typedef TData::iterator iterator
 
typedef TData::const_iterator const_iterator
 

Public Member Functions

 CNcbiMatrix ()
 default ctor More...
 
 CNcbiMatrix (size_t r, size_t c, T val=T())
 
void Identity (size_t size)
 make this matrix an identity matrix of a given size More...
 
void Identity ()
 make this matrix an identity matrix More...
 
void Diagonal (size_t size, T val)
 make this matrix a diagonal matrix of a given size, with a given value on the diagonal More...
 
void Diagonal (T val)
 make this matrix a diagonal matrix, with a given value on the diagonal More...
 
void Transpose ()
 transpose this matrix More...
 
void Resize (size_t i, size_t j, T val=T())
 resize this matrix, filling the empty cells with a known value More...
 
void SwapRows (size_t i, size_t j)
 swap two rows in the matrix More...
 
void RemoveRow (size_t i)
 remove a given row in the matrix More...
 
void RemoveCol (size_t i)
 remove a given column in the matrix More...
 
size_t GetRows () const
 get the number of rows in this matrix More...
 
size_t GetCols () const
 get the number of columns in this matrix More...
 
TDataGetData ()
 retrieve the data associated with this matrix More...
 
const TDataGetData () const
 
iterator begin ()
 iterators More...
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
void Set (T val)
 set all values in the matrix to a known value More...
 
void Swap (CNcbiMatrix< T > &M)
 swap two matrices efficiently More...
 
const Toperator[] (size_t i) const
 operator[] for raw data indexing More...
 
Toperator[] (size_t i)
 
const Toperator() (size_t i, size_t j) const
 operator() for row/column indexing More...
 
Toperator() (size_t i, size_t j)
 

Protected Attributes

TData m_Data
 the data strip we use More...
 
size_t m_Rows
 size of this matrix More...
 
size_t m_Cols
 

Detailed Description

template<class T>
class CNcbiMatrix< T >

Definition at line 46 of file matrix.hpp.

Member Typedef Documentation

◆ const_iterator

template<class T >
typedef TData::const_iterator CNcbiMatrix< T >::const_iterator

Definition at line 51 of file matrix.hpp.

◆ iterator

template<class T >
typedef TData::iterator CNcbiMatrix< T >::iterator

Definition at line 50 of file matrix.hpp.

◆ TData

template<class T >
typedef vector<T> CNcbiMatrix< T >::TData

Definition at line 49 of file matrix.hpp.

Constructor & Destructor Documentation

◆ CNcbiMatrix() [1/2]

template<class T >
CNcbiMatrix< T >::CNcbiMatrix
inline

default ctor

Definition at line 281 of file matrix.hpp.

◆ CNcbiMatrix() [2/2]

template<class T >
CNcbiMatrix< T >::CNcbiMatrix ( size_t  r,
size_t  c,
T  val = T() 
)
inline

Definition at line 289 of file matrix.hpp.

References CNcbiMatrix< T >::m_Data, r(), and val.

Member Function Documentation

◆ begin() [1/2]

template<class T >
CNcbiMatrix< T >::iterator CNcbiMatrix< T >::begin ( void  )
inline

◆ begin() [2/2]

template<class T >
CNcbiMatrix< T >::const_iterator CNcbiMatrix< T >::begin ( void  ) const
inline

Definition at line 339 of file matrix.hpp.

◆ Diagonal() [1/2]

template<class T >
void CNcbiMatrix< T >::Diagonal ( size_t  size,
T  val 
)
inline

make this matrix a diagonal matrix of a given size, with a given value on the diagonal

Definition at line 461 of file matrix.hpp.

References i, ncbi::grid::netcache::search::fields::size, T, and val.

◆ Diagonal() [2/2]

template<class T >
void CNcbiMatrix< T >::Diagonal ( T  val)
inline

make this matrix a diagonal matrix, with a given value on the diagonal

Definition at line 449 of file matrix.hpp.

References _ASSERT, i, T, and val.

◆ end() [1/2]

template<class T >
CNcbiMatrix< T >::iterator CNcbiMatrix< T >::end ( void  )
inline

◆ end() [2/2]

template<class T >
CNcbiMatrix< T >::const_iterator CNcbiMatrix< T >::end ( void  ) const
inline

Definition at line 346 of file matrix.hpp.

◆ GetCols()

template<class T >
size_t CNcbiMatrix< T >::GetCols
inline

◆ GetData() [1/2]

template<class T >
CNcbiMatrix< T >::TData & CNcbiMatrix< T >::GetData ( void  )
inline

retrieve the data associated with this matrix

Definition at line 312 of file matrix.hpp.

Referenced by CDistMethods::AllFinite(), operator*(), operator==(), and CBlastTabularInfo::SetFields().

◆ GetData() [2/2]

template<class T >
const CNcbiMatrix< T >::TData & CNcbiMatrix< T >::GetData ( void  ) const
inline

Definition at line 319 of file matrix.hpp.

◆ GetRows()

template<class T >
size_t CNcbiMatrix< T >::GetRows ( void  ) const
inline

◆ Identity() [1/2]

template<class T >
void CNcbiMatrix< T >::Identity
inline

make this matrix an identity matrix

Definition at line 425 of file matrix.hpp.

References _ASSERT, i, and T.

◆ Identity() [2/2]

template<class T >
void CNcbiMatrix< T >::Identity ( size_t  size)
inline

make this matrix an identity matrix of a given size

Definition at line 437 of file matrix.hpp.

References i, ncbi::grid::netcache::search::fields::size, and T.

◆ operator()() [1/2]

template<class T >
T & CNcbiMatrix< T >::operator() ( size_t  i,
size_t  j 
)
inline

Definition at line 380 of file matrix.hpp.

References _ASSERT, and i.

◆ operator()() [2/2]

template<class T >
const T & CNcbiMatrix< T >::operator() ( size_t  i,
size_t  j 
) const
inline

operator() for row/column indexing

Definition at line 370 of file matrix.hpp.

References _ASSERT, and i.

◆ operator[]() [1/2]

template<class T >
T & CNcbiMatrix< T >::operator[] ( size_t  i)
inline

Definition at line 362 of file matrix.hpp.

References _ASSERT, and i.

◆ operator[]() [2/2]

template<class T >
const T & CNcbiMatrix< T >::operator[] ( size_t  i) const
inline

operator[] for raw data indexing

Definition at line 354 of file matrix.hpp.

References _ASSERT, and i.

◆ RemoveCol()

template<class T >
void CNcbiMatrix< T >::RemoveCol ( size_t  i)
inline

remove a given column in the matrix

Definition at line 525 of file matrix.hpp.

References _ASSERT, and r().

◆ RemoveRow()

template<class T >
void CNcbiMatrix< T >::RemoveRow ( size_t  i)
inline

remove a given row in the matrix

Definition at line 510 of file matrix.hpp.

References _ASSERT, and r().

◆ Resize()

template<class T >
void CNcbiMatrix< T >::Resize ( size_t  i,
size_t  j,
T  val = T() 
)
inline

◆ Set()

template<class T >
void CNcbiMatrix< T >::Set ( T  val)
inline

set all values in the matrix to a known value

Definition at line 417 of file matrix.hpp.

References val.

Referenced by CDistanceMatrix::AsMatrix(), CDistances::ComputeMatrix(), and CSequence::Reset().

◆ Swap()

template<class T >
void CNcbiMatrix< T >::Swap ( CNcbiMatrix< T > &  M)
inline

swap two matrices efficiently

Definition at line 501 of file matrix.hpp.

References CNcbiMatrix< T >::m_Cols, CNcbiMatrix< T >::m_Data, CNcbiMatrix< T >::m_Rows, and swap().

Referenced by CSequence::InsertGaps(), operator>>(), and CSequence::PropagateGaps().

◆ SwapRows()

template<class T >
void CNcbiMatrix< T >::SwapRows ( size_t  i,
size_t  j 
)
inline

swap two rows in the matrix

Definition at line 489 of file matrix.hpp.

References i, and swap().

◆ Transpose()

template<class T >
void CNcbiMatrix< T >::Transpose
inline

transpose this matrix

Definition at line 473 of file matrix.hpp.

References i, and swap().

Member Data Documentation

◆ m_Cols

template<class T >
size_t CNcbiMatrix< T >::m_Cols
protected

Definition at line 121 of file matrix.hpp.

Referenced by CNcbiMatrix< T >::Swap().

◆ m_Data

template<class T >
TData CNcbiMatrix< T >::m_Data
protected

the data strip we use

Definition at line 117 of file matrix.hpp.

Referenced by CNcbiMatrix< T >::CNcbiMatrix(), and CNcbiMatrix< T >::Swap().

◆ m_Rows

template<class T >
size_t CNcbiMatrix< T >::m_Rows
protected

size of this matrix

Definition at line 120 of file matrix.hpp.

Referenced by CNcbiMatrix< T >::Swap().


The documentation for this class was generated from the following file:
Modified on Fri Apr 26 16:26:16 2024 by modify_doxy.py rev. 669887