Public Member Functions | Public Attributes

BigMatrix Class Reference

Search for all occurrences

Detailed Description

See also:
Class Matrix3.

Description:
This class is available in release 2.0 and later only.

This class implements an m x n matrix for situations & calculations where the usual 4x3 Matrix3 class is not adequate. BigMatrix implements several useful matrix operations, including matrix multiplication and inversion, but is not guaranteed to be especially efficient. All methods are implemented by the system.
Data Members:
int m, n

The dimensions of the matrix. There are m rows and n columns.

float *val

The elements of the matrix. val[i*n+j] is the value in the i'th row and the j'th column.

#include <mnbigmat.h>

Inheritance diagram for BigMatrix:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  BigMatrix ()
DllExport  BigMatrix (int mm, int nn)
DllExport  BigMatrix (const BigMatrix &from)
  ~BigMatrix ()
DllExport void  Clear ()
DllExport int  SetSize (int mm, int nn)
DllExport float *  operator[] (int i) const
DllExport BigMatrix operator= (const BigMatrix &from)
DllExport void  SetTranspose (BigMatrix &trans) const
DllExport float  Invert ()
DllExport void  Identity ()
DllExport void  Randomize (float scale)
DllExport void  MNDebugPrint ()
DllExport void  dump (FILE *fp)

Public Attributes

int  m
int  n
float *  val

Constructor & Destructor Documentation

BigMatrix ( ) [inline]
Remarks:
Initializer. Sets m and n to zero, and val to NULL.
{ val=NULL; m=0; n=0; }
DllExport BigMatrix ( int  mm,
int  nn 
)
Remarks:
Initializer. Sets the dimensions of the matrix to mm by nn, and allocates space for the contents. The total size of the matrix, mm*nn, cannot exceed 10,000.
DllExport BigMatrix ( const BigMatrix from )
Remarks:
Initializer. Sets this BigMatrix equal to from.
~BigMatrix ( ) [inline]
Remarks:
Destructor. Frees the internal arrays.
{ Clear (); }

Member Function Documentation

DllExport void Clear ( )
Remarks:
Frees the internal arrays and sets the matrix's size to 0x0.
DllExport int SetSize ( int  mm,
int  nn 
)
Remarks:
Sets the matrix's size to mm by nn, and allocates space for the contents.
Returns:
Returns the total size of the matrix (mm * nn) or -1 if there's an error.
DllExport float* operator[] ( int  i ) const
Remarks:
Returns a pointer to the i'th row in the matrix. Thus for a BigMatrix A, A[i][j] is the value in the i'th row and the j'th column.
DllExport BigMatrix& operator= ( const BigMatrix from )
Remarks:
Sets this BigMatrix equal to from.
DllExport void SetTranspose ( BigMatrix trans ) const
Remarks:
Sets trans to be the transpose of this BigMatrix.
DllExport float Invert ( )
Remarks:
Inverts this matrix. Note that this only works if this matrix is "square", i.e. if m = n. This algorithm is CUBIC in the number of rows, so be careful!
Returns:
The determinant of the matrix (before inversion) is returned. If the return value is 0, the matrix could not be inverted.
DllExport void Identity ( )
Remarks:
If m and n are equal, this method sets this matrix to the identity. If m and n are not equal, it does nothing.
DllExport void Randomize ( float  scale )
Remarks:
Creates a random matrix for testing purposes. Reseeds the random number generator with the current system time, for a non-reproducible result. Values of the matrix are set to anything in the range (-scale, scale).
DllExport void MNDebugPrint ( )
Remarks:
This method prints the contents of the BigMatrix to the IDE debugging window using DebugPrints.
DllExport void dump ( FILE *  fp )

Member Data Documentation

int m
int n
float* val

BigMatrix BigMatrix BigMatrix BigMatrix BigMatrix BigMatrix BigMatrix BigMatrix BigMatrix BigMatrix
BigMatrix BigMatrix BigMatrix BigMatrix BigMatrix BigMatrix BigMatrix BigMatrix BigMatrix BigMatrix