Cafu Engine
DiagMatrixT Class Reference

This class implements a diagonally symmetric matrix for two-bit numbers, that is, the elements of the matrix can only be the numbers 0, 1, 2 or 3. More...

Public Member Functions

 DiagMatrixT ()
 Creates a DiagMatrixT of size 0. More...
 
void SetSize (unsigned long n)
 (Re-)sets the size of this DiagMatrixT to n*n and initializes the elements with zeros. More...
 
char GetValue (unsigned long row, unsigned long col) const
 Returns the value at (row, col). More...
 
void SetValue (unsigned long row, unsigned long col, char value)
 Sets the value at (row, col). Note that value must be 0, 1, 2 or 3. More...
 
unsigned long GetBytesAlloced () const
 
bool Test ()
 Implements a simple test case for objects of this class. More...
 

Detailed Description

This class implements a diagonally symmetric matrix for two-bit numbers, that is, the elements of the matrix can only be the numbers 0, 1, 2 or 3.

Implementation notes:

  • Only the lower left half of the matrix is physically stored.
  • Each matrix element is physically represented by two bits.
  • The elements in turn are stored in tuples of 16 in "unsigned long"s.
  • Assumes that the type "unsigned long" has (at least) 32 bits.

Constructor & Destructor Documentation

DiagMatrixT::DiagMatrixT ( )
inline

Creates a DiagMatrixT of size 0.

Member Function Documentation

char DiagMatrixT::GetValue ( unsigned long  row,
unsigned long  col 
) const
inline

Returns the value at (row, col).

void DiagMatrixT::SetSize ( unsigned long  n)
inline

(Re-)sets the size of this DiagMatrixT to n*n and initializes the elements with zeros.

void DiagMatrixT::SetValue ( unsigned long  row,
unsigned long  col,
char  value 
)
inline

Sets the value at (row, col). Note that value must be 0, 1, 2 or 3.

bool DiagMatrixT::Test ( )

Implements a simple test case for objects of this class.

Returns true if all tests pass, false otherwise. The contents of the matrix after the test is undefined.


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