|
Sleipnir
|
Store a discrete matrix using the fewest possible bytes. More...
#include <compactmatrix.h>
Public Member Functions | |
| void | Initialize (size_t iRows, size_t iColumns, unsigned char cValues, bool fClear) |
| Initialize a new compact matrix with the requested numbers of rows, columns, and discrete values. | |
| size_t | GetRows () const |
| Returns the number of rows in the matrix. | |
| size_t | GetColumns () const |
| Returns the number of columns in the matrix. | |
| unsigned char | Get (size_t iY, size_t iX) const |
| Returns the value at the requested matrix position. | |
| void | Set (size_t iY, size_t iX, unsigned char cValue) |
| Set the value at the requested matrix position. | |
Store a discrete matrix using the fewest possible bytes.
Store a discrete matrix using the fewest possible bytes. This is done using sub-byte alignment, with each value occupying the smallest number of bits possible to store the total number of possible different values.
Definition at line 170 of file compactmatrix.h.
| unsigned char Sleipnir::CCompactFullMatrix::Get | ( | size_t | iY, |
| size_t | iX | ||
| ) | const [inline] |
Returns the value at the requested matrix position.
| iY | Matrix row. |
| iX | Matrix column. |
Reimplemented from Sleipnir::CCompactMatrixBase.
Definition at line 251 of file compactmatrix.h.
| size_t Sleipnir::CCompactFullMatrix::GetColumns | ( | ) | const [inline] |
Returns the number of columns in the matrix.
Definition at line 227 of file compactmatrix.h.
| size_t Sleipnir::CCompactFullMatrix::GetRows | ( | ) | const [inline] |
Returns the number of rows in the matrix.
Definition at line 213 of file compactmatrix.h.
| void Sleipnir::CCompactFullMatrix::Initialize | ( | size_t | iRows, |
| size_t | iColumns, | ||
| unsigned char | cValues, | ||
| bool | fClear | ||
| ) | [inline] |
Initialize a new compact matrix with the requested numbers of rows, columns, and discrete values.
| iRows | Number of rows in the matrix. |
| iColumns | Number of columns in the matrix. |
| cValues | Number of different values that each entry in the matrix can take. |
| fClear | If true, set each matrix entry to zero after allocation. |
Allocates and, optionally, clears enough memory to store a matrix with the requested number of rows and columns, with each entry taking the requested number of different values. A matrix with iRows rows and iColumns columns will have iRows * iColumns entries, each of which takes ceil(log2(cValues)) bits. This means that roughly ceil(8 * log2(cValues) * iRows * iColumns) bytes will be allocated for the entire matrix.
Definition at line 197 of file compactmatrix.h.
| void Sleipnir::CCompactFullMatrix::Set | ( | size_t | iY, |
| size_t | iX, | ||
| unsigned char | cValue | ||
| ) | [inline] |
Set the value at the requested matrix position.
| iY | Matrix row. |
| iX | Matrix column. |
| cValue | Value to store. |
Reimplemented from Sleipnir::CCompactMatrixBase.
Definition at line 275 of file compactmatrix.h.
1.7.6.1