Sleipnir
|
A symmetric two-dimensional matrix. More...
#include <halfmatrix.h>
Public Member Functions | |
void | Reset () |
Empties the matrix and deallocates all associated memory. | |
tType * | GetFullRow (size_t iY) |
const tType * | Get (size_t iY) const |
Return a single row of the matrix. | |
tType * | Get (size_t iY) |
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 CHalfMatrix &Mat) |
Create a new matrix using a reference to the given matrix. | |
virtual void | Initialize (size_t iSize, tType **aaData=NULL) |
Create a new matrix of the requested size and, optionally, referencing the given data. | |
size_t | GetSize () const |
Return the number of elements (row/columns) of the matrix. | |
bool | SetSize (size_t iSize, bool fClear=false) |
void | Clear () |
Sets all entries of the matrix to 0 without changing its size. | |
bool | Save (std::ostream &ostm, bool fBinary, char cSeparator= '\t') const |
Saves a matrix to the given stream in either binary or tab-delimited text format. | |
Static Public Member Functions | |
static size_t | GetSpace (size_t iSize) |
Return the number of entries in a symmetric matrix of the given size. | |
Protected Member Functions | |
bool | SaveBinary (std::ostream &ostm) const |
Saves a matrix to the given stream in binary format. | |
bool | SaveText (std::ostream &ostm, char cSeparator) const |
Saves a matrix to the given stream in either binary or tab-delimited text format. | |
Protected Attributes | |
bool | m_fMemory |
True if the matrix is responsible for disposing of the underlying memory. | |
tType ** | m_aaData |
Two-dimensional array backing the symmetric matrix. |
A symmetric two-dimensional matrix.
tType | Type of element contained by the matrix. |
Definition at line 48 of file halfmatrix.h.
const tType* Sleipnir::CHalfMatrix< tType >::Get | ( | size_t | iY | ) | const [inline] |
Return a single row of the matrix.
iY | Matrix row. |
Definition at line 123 of file halfmatrix.h.
Referenced by Sleipnir::CClustPivot::Cluster(), Sleipnir::CClustKMeans::Cluster(), Sleipnir::CClustQTC::Cluster(), Sleipnir::CDat::Get(), Sleipnir::CHalfMatrix< unsigned char >::SaveBinary(), and Sleipnir::CHalfMatrix< unsigned char >::SaveText().
tType* Sleipnir::CHalfMatrix< tType >::Get | ( | size_t | iY | ) | [inline] |
Return a single row of the matrix.
iY | Matrix row. |
Definition at line 144 of file halfmatrix.h.
tType& Sleipnir::CHalfMatrix< tType >::Get | ( | size_t | iY, |
size_t | iX | ||
) | const [inline] |
Returns the value at the requested matrix position.
iY | Matrix row. |
iX | Matrix column. |
Reimplemented in Sleipnir::CBinaryMatrix.
Definition at line 168 of file halfmatrix.h.
size_t Sleipnir::CHalfMatrix< tType >::GetSize | ( | ) | const [inline] |
Return the number of elements (row/columns) of the matrix.
Definition at line 275 of file halfmatrix.h.
Referenced by Sleipnir::CDataMask::Attach(), Sleipnir::CDataMask::AttachComplement(), Sleipnir::CDataMask::AttachRandom(), Sleipnir::CClustQTC::Cluster(), Sleipnir::CClustPivot::Cluster(), Sleipnir::CClustKMeans::Cluster(), Sleipnir::CHalfMatrix< unsigned char >::Initialize(), Sleipnir::CDat::Open(), Sleipnir::CDatasetCompact::Open(), Sleipnir::CDatasetCompactMap::Open(), Sleipnir::CHalfMatrix< unsigned char >::SaveBinary(), and Sleipnir::CHalfMatrix< unsigned char >::SaveText().
static size_t Sleipnir::CHalfMatrix< tType >::GetSpace | ( | size_t | iSize | ) | [inline, static] |
Return the number of entries in a symmetric matrix of the given size.
iSize | Number of elements in a symmetric matrix for which the entries are calculated. |
Definition at line 63 of file halfmatrix.h.
void Sleipnir::CHalfMatrix< tType >::Initialize | ( | const CHalfMatrix< 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 237 of file halfmatrix.h.
Referenced by Sleipnir::CHalfMatrix< unsigned char >::Initialize(), Sleipnir::CDat::Open(), and Sleipnir::CDatasetCompact::Open().
virtual void Sleipnir::CHalfMatrix< tType >::Initialize | ( | size_t | iSize, |
tType ** | aaData = NULL |
||
) | [inline, virtual] |
Create a new matrix of the requested size and, optionally, referencing the given data.
iSize | Matrix elements. |
aaData | If non-null, the memory that will back the newly created matrix. |
Definition at line 255 of file halfmatrix.h.
bool Sleipnir::CHalfMatrix< tType >::Save | ( | std::ostream & | ostm, |
bool | fBinary, | ||
char | cSeparator = '\t' |
||
) | 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. |
cSeparator | For non-binary output, delimiter between matrix elements (tab by default). |
Definition at line 332 of file halfmatrix.h.
bool Sleipnir::CHalfMatrix< tType >::SaveBinary | ( | std::ostream & | ostm | ) | const [inline, protected] |
Saves a matrix to the given stream in binary format.
ostm | Stream to which matrix is saved. |
Definition at line 355 of file halfmatrix.h.
Referenced by Sleipnir::CHalfMatrix< unsigned char >::Save().
bool Sleipnir::CHalfMatrix< tType >::SaveText | ( | std::ostream & | ostm, |
char | cSeparator | ||
) | const [inline, protected] |
Saves a matrix to the given stream in either binary or tab-delimited text format.
ostm | Stream to which matrix is saved. |
cSeparator | Delimiter saved between distinct values. |
Definition at line 386 of file halfmatrix.h.
Referenced by Sleipnir::CHalfMatrix< unsigned char >::Save().
void Sleipnir::CHalfMatrix< 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 197 of file halfmatrix.h.
Referenced by Sleipnir::CClustQTC::Cluster(), Sleipnir::CDatasetCompact::Open(), and Sleipnir::CDat::Set().
void Sleipnir::CHalfMatrix< 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 222 of file halfmatrix.h.