Sleipnir
|
An asymmetric two-dimensional matrix. More...
#include <fullmatrix.h>
Public Member Functions | |
void | Reset () |
Empties the matrix and deallocates all associated memory. | |
tType **const | Get () const |
Return the two-dimensional array backing the matrix. | |
tType * | Get (size_t iY) const |
Return a single row of the matrix. | |
tType & | Get (size_t iY, size_t iX) const |
Returns the value at the requested matrix position. | |
void | Set (size_t iY, size_t iX, const tType &Value) |
Set the value at the requested matrix position. | |
void | Set (size_t iY, const tType *aValues) |
Set a single row of the matrix. | |
void | Initialize (const CFullMatrix &Mat) |
Create a new matrix using a reference to the given matrix. | |
virtual void | Initialize (size_t iR, size_t iC, tType **aaData=NULL) |
Create a new matrix of the requested size and, optionally, referencing the given data. | |
size_t | GetRows () const |
Return the number of rows in the matrix. | |
size_t | GetColumns () const |
Return the number of columns in the matrix. | |
bool | Open (std::istream &istm, bool fBinary) |
Loads a matrix from the given stream. | |
bool | Open (const char *szFile) |
Loads a matrix from the given filename, or standard input if null. | |
bool | Open (const CFullMatrix &Mat) |
Creates a copy of the given matrix's data. | |
bool | Save (std::ostream &ostm, bool fBinary) const |
Saves a matrix to the given stream in either binary or tab-delimited text format. | |
bool | Save (const char *szFile) const |
Saves a matrix to the given file in binary form; if null, save text to standard output. | |
bool | Save (const char *szFile, bool fBinary) const |
Saves a matrix to the given stream in either binary or tab-delimited text format. | |
void | Clear () |
Sets all entries of the matrix to 0 without changing its size. | |
bool | AddRows (size_t iR, bool fClear=false) |
Increases the number of rows in the matrix by the requested amount. | |
bool | Multiply (std::vector< tType > &vecRight) |
Performs matrix multiplication by applying the given vector on the right of the current matrix. | |
bool | Multiply (const CFullMatrix &MatRight, bool fTranspose=false) |
Performs matrix multiplication by applying the given matrix on the right of the current matrix. | |
bool | SVD (CFullMatrix< tType > &MatU, CFullMatrix< tType > &MatV, std::vector< tType > &vecS) const |
Performs singular value decomposition of the current matrix. |
An asymmetric two-dimensional matrix.
tType | Type of element contained by the matrix. |
Definition at line 52 of file fullmatrix.h.
bool Sleipnir::CFullMatrix< tType >::AddRows | ( | size_t | iR, |
bool | fClear = false |
||
) | [inline] |
Increases the number of rows in the matrix by the requested amount.
iR | Number of rows to append to the matrix. |
fClear | If true, set all values in the new rows to zero. |
Definition at line 421 of file fullmatrix.h.
Referenced by Sleipnir::CPCL::AddGenes().
tType** const Sleipnir::CFullMatrix< tType >::Get | ( | ) | const [inline] |
Return the two-dimensional array backing the matrix.
Definition at line 82 of file fullmatrix.h.
Referenced by Sleipnir::CHMM::Add(), Sleipnir::CStatistics::CholeskyDecomposition(), Sleipnir::CClustKMeans::Cluster(), Sleipnir::CBayesNetMinimal::Evaluate(), Sleipnir::CPCLSet::Get(), Sleipnir::CHMM::Get(), Sleipnir::CPCL::Get(), Sleipnir::CDataSubset::GetContinuous(), Sleipnir::CDataSubset::GetDiscrete(), Sleipnir::CCoalesceMotifLibrary::GetKnown(), Sleipnir::CCoalesceMotifLibrary::GetPWM(), Sleipnir::CPST::GetPWM(), Sleipnir::CPCL::Impute(), Sleipnir::CDataSubset::IsExample(), Sleipnir::CStatistics::MatrixLUDecompose(), Sleipnir::CStatistics::MatrixLUDeterminant(), Sleipnir::CFullMatrix< CExampleImpl >::Multiply(), Sleipnir::CStatistics::MultivariateNormalCDF(), Sleipnir::CBayesNetSmile::Open(), Sleipnir::CPCL::Open(), Sleipnir::CFullMatrix< CExampleImpl >::Open(), Sleipnir::CDataSubset::Open(), Sleipnir::CPCL::OpenBinary(), Sleipnir::CSeekTools::ReadPlatforms(), Sleipnir::CDataSubset::Remove(), Sleipnir::CHMM::Save(), Sleipnir::CPCL::SortGenes(), and Sleipnir::CFullMatrix< CExampleImpl >::SVD().
tType* Sleipnir::CFullMatrix< tType >::Get | ( | size_t | iY | ) | const [inline] |
Return a single row of the matrix.
iY | Matrix row. |
Definition at line 103 of file fullmatrix.h.
tType& Sleipnir::CFullMatrix< tType >::Get | ( | size_t | iY, |
size_t | iX | ||
) | const [inline] |
Returns the value at the requested matrix position.
iY | Matrix row. |
iX | Matrix column. |
Definition at line 127 of file fullmatrix.h.
size_t Sleipnir::CFullMatrix< tType >::GetColumns | ( | ) | const [inline] |
Return the number of columns in the matrix.
Definition at line 243 of file fullmatrix.h.
Referenced by Sleipnir::CPCL::AddGenes(), Sleipnir::CFullMatrix< CExampleImpl >::AddRows(), Sleipnir::CStatistics::CholeskyDecomposition(), Sleipnir::CFullMatrix< CExampleImpl >::Clear(), Sleipnir::CClustKMeans::Cluster(), Sleipnir::CBayesNetMinimal::Evaluate(), Sleipnir::CHMM::Get(), Sleipnir::CCoalesceMotifLibrary::GetKnown(), Sleipnir::CCoalesceMotifLibrary::GetPWM(), Sleipnir::CFullMatrix< CExampleImpl >::Initialize(), Sleipnir::CStatistics::MatrixLUDecompose(), Sleipnir::CStatistics::MatrixLUDeterminant(), Sleipnir::CStatistics::MatrixLUInvert(), Sleipnir::CFullMatrix< CExampleImpl >::Multiply(), Sleipnir::CStatistics::MultivariateNormalCDF(), Sleipnir::CStatistics::MultivariateNormalPDF(), Sleipnir::CBayesNetSmile::Open(), Sleipnir::CPCL::Open(), Sleipnir::CFullMatrix< CExampleImpl >::Open(), Sleipnir::CDataSubset::Open(), Sleipnir::CSeekTools::ReadPlatforms(), Sleipnir::CHMM::Save(), Sleipnir::CFullMatrix< CExampleImpl >::Set(), Sleipnir::CHMM::SetUniform(), and Sleipnir::CFullMatrix< CExampleImpl >::SVD().
size_t Sleipnir::CFullMatrix< tType >::GetRows | ( | ) | const [inline] |
Return the number of rows in the matrix.
Definition at line 229 of file fullmatrix.h.
Referenced by Sleipnir::CPCL::AddGenes(), Sleipnir::CFullMatrix< CExampleImpl >::AddRows(), Sleipnir::CStatistics::CholeskyDecomposition(), Sleipnir::CFullMatrix< CExampleImpl >::Clear(), Sleipnir::CClustQTC::Cluster(), Sleipnir::CClustKMeans::Cluster(), Sleipnir::CBayesNetMinimal::Evaluate(), Sleipnir::CHMM::Get(), Sleipnir::CCoalesceMotifLibrary::GetKnown(), Sleipnir::CCoalesceMotifLibrary::GetPWM(), Sleipnir::CPST::GetPWM(), Sleipnir::CFullMatrix< CExampleImpl >::Initialize(), Sleipnir::CStatistics::MatrixLUDecompose(), Sleipnir::CStatistics::MatrixLUDeterminant(), Sleipnir::CStatistics::MatrixLUInvert(), Sleipnir::CFullMatrix< CExampleImpl >::Multiply(), Sleipnir::CStatistics::MultivariateNormalCDF(), Sleipnir::CStatistics::MultivariateNormalPDF(), Sleipnir::CBayesNetSmile::Open(), Sleipnir::CPCL::Open(), Sleipnir::CBayesNetMinimal::Open(), Sleipnir::CFullMatrix< CExampleImpl >::Open(), Sleipnir::CDataSubset::Open(), Sleipnir::CPCL::OpenBinary(), Sleipnir::CBayesNetMinimal::OpenCounts(), Sleipnir::CSeekTools::ReadPlatforms(), Sleipnir::CFullMatrix< CExampleImpl >::Reset(), Sleipnir::CHMM::Save(), Sleipnir::CHMM::SetUniform(), Sleipnir::CPCL::SortGenes(), and Sleipnir::CFullMatrix< CExampleImpl >::SVD().
void Sleipnir::CFullMatrix< tType >::Initialize | ( | const CFullMatrix< tType > & | Mat | ) | [inline] |
Create a new matrix using a reference to the given matrix.
Mat | Matrix to duplicate in the created matrix. |
Definition at line 187 of file fullmatrix.h.
Referenced by Sleipnir::CClustKMeans::Cluster(), Sleipnir::CPST::GetPWM(), Sleipnir::CFullMatrix< CExampleImpl >::Initialize(), Sleipnir::CDataSubset::Initialize(), Sleipnir::CStatistics::MatrixLUInvert(), Sleipnir::CFullMatrix< CExampleImpl >::Multiply(), Sleipnir::CStatistics::MultivariateNormalPDF(), Sleipnir::CPCLSet::Open(), Sleipnir::CHMM::Open(), Sleipnir::CPCL::Open(), Sleipnir::CFullMatrix< CExampleImpl >::Open(), Sleipnir::CPCL::OpenBinary(), Sleipnir::CBayesNetMinimal::OpenCounts(), and Sleipnir::CFullMatrix< CExampleImpl >::SVD().
virtual void Sleipnir::CFullMatrix< tType >::Initialize | ( | size_t | iR, |
size_t | iC, | ||
tType ** | aaData = NULL |
||
) | [inline, virtual] |
Create a new matrix of the requested size and, optionally, referencing the given data.
iR | Matrix rows. |
iC | Matrix columns. |
aaData | If non-null, the memory that will back the newly created matrix. |
Definition at line 208 of file fullmatrix.h.
bool Sleipnir::CFullMatrix< tType >::Multiply | ( | std::vector< tType > & | vecRight | ) | [inline] |
Performs matrix multiplication by applying the given vector on the right of the current matrix.
vecRight | Vector by which current matrix is multiplied on the right. |
Definition at line 456 of file fullmatrix.h.
bool Sleipnir::CFullMatrix< tType >::Multiply | ( | const CFullMatrix< tType > & | MatRight, |
bool | fTranspose = false |
||
) | [inline] |
Performs matrix multiplication by applying the given matrix on the right of the current matrix.
MatRight | Matrix by which current matrix is multiplied on the right. |
fTranspose | If true, transpose MatRight prior to multiplication. |
Definition at line 488 of file fullmatrix.h.
bool Sleipnir::CFullMatrix< tType >::Open | ( | std::istream & | istm, |
bool | fBinary | ||
) | [inline] |
Loads a matrix from the given stream.
istm | Stream from which matrix is loaded. |
fBinary | If true, matrix and stream are in binary format. |
Definition at line 264 of file fullmatrix.h.
Referenced by Sleipnir::CFullMatrix< CExampleImpl >::Multiply(), Sleipnir::CStatistics::MultivariateNormalPDF(), Sleipnir::CFullMatrix< CExampleImpl >::Open(), Sleipnir::CBayesNetMinimal::Open(), Sleipnir::CSeekTools::ReadPlatforms(), and Sleipnir::CFullMatrix< CExampleImpl >::SVD().
bool Sleipnir::CFullMatrix< tType >::Open | ( | const char * | szFile | ) | [inline] |
Loads a matrix from the given filename, or standard input if null.
szFile | File from which binary matrix is opened; if null, use text from standard input. |
Definition at line 281 of file fullmatrix.h.
bool Sleipnir::CFullMatrix< tType >::Open | ( | const CFullMatrix< tType > & | Mat | ) | [inline] |
Creates a copy of the given matrix's data.
Mat | Matrix from which data is copied. |
Definition at line 307 of file fullmatrix.h.
bool Sleipnir::CFullMatrix< tType >::Save | ( | std::ostream & | ostm, |
bool | fBinary | ||
) | const [inline] |
Saves a matrix to the given stream in either binary or tab-delimited text format.
ostm | Stream to which matrix is saved. |
fBinary | If true, matrix is saved in binary format; otherwise, matrix is saved as tab-delimited text. |
Definition at line 338 of file fullmatrix.h.
Referenced by Sleipnir::CBayesNetMinimal::Save(), and Sleipnir::CFullMatrix< CExampleImpl >::Save().
bool Sleipnir::CFullMatrix< tType >::Save | ( | const char * | szFile | ) | const [inline] |
Saves a matrix to the given file in binary form; if null, save text to standard output.
szFile | File in which binary matrix is saved; if null, text is saved to standard output. |
Definition at line 355 of file fullmatrix.h.
bool Sleipnir::CFullMatrix< tType >::Save | ( | const char * | szFile, |
bool | fBinary | ||
) | const [inline] |
Saves a matrix to the given stream in either binary or tab-delimited text format.
szFile | File to which matrix is saved. |
fBinary | If true, matrix is saved in binary format; otherwise, matrix is saved as tab-delimited text. |
Definition at line 385 of file fullmatrix.h.
void Sleipnir::CFullMatrix< tType >::Set | ( | size_t | iY, |
size_t | iX, | ||
const tType & | Value | ||
) | [inline] |
Set the value at the requested matrix position.
iY | Matrix row. |
iX | Matrix column. |
Value | Value to store. |
Definition at line 151 of file fullmatrix.h.
Referenced by Sleipnir::CPCL::AddGenes(), Sleipnir::CStatistics::CholeskyDecomposition(), Sleipnir::CClustKMeans::Cluster(), Sleipnir::CStatistics::MatrixLUDecompose(), Sleipnir::CStatistics::MatrixLUInvert(), Sleipnir::CFullMatrix< CExampleImpl >::Multiply(), Sleipnir::CPCLSet::Open(), Sleipnir::CPCL::Open(), Sleipnir::CBayesNetMinimal::OpenCounts(), Sleipnir::CPCL::Set(), Sleipnir::CHMM::SetUniform(), and Sleipnir::CFullMatrix< CExampleImpl >::SVD().
void Sleipnir::CFullMatrix< tType >::Set | ( | size_t | iY, |
const tType * | aValues | ||
) | [inline] |
Set a single row of the matrix.
iY | Matrix row. |
aValues | Data to be copied into the requested row. |
Definition at line 172 of file fullmatrix.h.
bool Sleipnir::CFullMatrix< tType >::SVD | ( | CFullMatrix< tType > & | MatU, |
CFullMatrix< tType > & | MatV, | ||
std::vector< tType > & | vecS | ||
) | const [inline] |
Performs singular value decomposition of the current matrix.
MatU | Output U matrix of basis vectors. |
MatV | Output V matrix of analysis vectors. |
vecS | Output diagonal of Sigma matrix of singular values. |
Outputs a singular value decomposition of the current matrix M such that M = U * Sigma * V'. For a matrix of expression values, V behaves as eigengenes, U as eigenconditions, and S quantifies the variability (or weight) attributable to each eigengene.
Definition at line 529 of file fullmatrix.h.