C:/Users/Alex Lusco/Documents/Visual Studio 2008/Projects/MatrixLiteSF/trunk/src/MatrixLiteLib/MatrixLiteLib.c File Reference

Source Code for Library. More...

#include <malloc.h>
#include "MatrixLiteLib.h"

Defines

#define NULL   0
#define ERRORCHECK
 Enables Error Checking on applicable functions.

Functions

bool InitializeMatrixData (LPMATRIX matrix, tinyint rows, tinyint cols)
 Internal function that initializes a matrix structure with its data.
void MLmemcpy (void *d, const void *source, size_t len)
 Replacement for memcpy, since we need it and its size prohitibitive to include string.h for it.
LPMATRIX CreateIdentityMatrix (tinyint rows)
 Returns a pointer to a new Matrix, that is the identity matrix for the size Row x Row.
LPMATRIX CreateMatrices (tinyint rows, tinyint cols, tinyint number)
 Returns a pointer to an array of matrices size rows x cols.
void FreeMatrices (LPMATRIX matrices, tinyint number)
 Frees an array of matrices.
LPMATRIX MatrixCopy (LPMATRIX src)
 Creates a copy of a matrix and its internal data.
float MatrixGet (const LPMATRIX matrix, tinyint row, tinyint col)
 Gets a cell of a matrix.
bool MatrixSet (LPMATRIX matrix, tinyint row, tinyint col, float data)
 Sets a cell of a matrix.
void MatrixSetAll (LPMATRIX matrix, float value)
 Sets an entire matrix to a single value.
LPMATRIX MatrixAddSub (const LPMATRIX first, const LPMATRIX second, bool bAdd)
 Adds or subtracts two matrices.
LPMATRIX MatrixMultiply (const LPMATRIX first, LPMATRIX second)
 Multiplies two matrices together.
LPMATRIX MatrixTranspose (const LPMATRIX matrix)
 Tranposes a matrix.
LPMATRIX MatrixInverse (const LPMATRIX matrix)
 Modified for a c environment, this performs an inversion of a symmetric square matrix.


Detailed Description

Source Code for Library.


Define Documentation

#define ERRORCHECK

Enables Error Checking on applicable functions.

You should really only do this for debugging, it does add some overhead to each function that it applies (and if size is really important this can be bad

#define NULL   0


Function Documentation

LPMATRIX CreateIdentityMatrix ( tinyint  rows  ) 

Returns a pointer to a new Matrix, that is the identity matrix for the size Row x Row.

Parameters:
rows size of the matrix to return
Returns:
Pointer to identity matrix

LPMATRIX CreateMatrices ( tinyint  rows,
tinyint  cols,
tinyint  number 
)

Returns a pointer to an array of matrices size rows x cols.

Parameters:
rows Number of Rows in matrix
cols Number of Columns in matrix
number Numer of matrices to create
Returns:
pointer to an array of matrices

void FreeMatrices ( LPMATRIX  matrices,
tinyint  number 
)

Frees an array of matrices.

Parameters:
matrices pointer to an array of matrices
number the number of matrices in the array

bool InitializeMatrixData ( LPMATRIX  matrix,
tinyint  rows,
tinyint  cols 
)

Internal function that initializes a matrix structure with its data.

Parameters:
matrix pointer to a matrix structure
rows rows in matrix
cols columns in matrix
Returns:
true if matrix was initialized properly / false if not

LPMATRIX MatrixAddSub ( const LPMATRIX  first,
const LPMATRIX  second,
bool  bAdd 
)

Adds or subtracts two matrices.

Parameters:
first Pointer to a matrix
second Pointer to another matrix
bAdd True to perform addition, false for subtraction
Returns:
New Matrix with result, NULL if ERRORCHECK and matrices are incompatible sizes

LPMATRIX MatrixCopy ( LPMATRIX  src  ) 

Creates a copy of a matrix and its internal data.

Parameters:
src Source Matrix To copy
Returns:
Pointer to a copied matrix

float MatrixGet ( const LPMATRIX  matrix,
tinyint  row,
tinyint  col 
)

Gets a cell of a matrix.

Parameters:
matrix Pointer to the matrix
row row to retrieve
col column to retrieve
Returns:
Value of row,col

LPMATRIX MatrixInverse ( const LPMATRIX  matrix  ) 

Modified for a c environment, this performs an inversion of a symmetric square matrix.

Implementation of CholeskyCrout ganked from http://www.gpstk.org/doxygen/MatrixFunctors_8hpp-source.html#l00658 More ganks http://www.gpstk.org/doxygen/MatrixOperators_8hpp-source.html#l00544

Parameters:
matrix Matrix to be inverted
Returns:
Inverted Matrix, NULL if ERRORCHECK and non-square matrix

LPMATRIX MatrixMultiply ( const LPMATRIX  first,
LPMATRIX  second 
)

Multiplies two matrices together.

Parameters:
first Pointer to a matrix
second Pointer to a matrix
Returns:
New matrix with result, NULL if ERRORCHECK and matrices are invalid sizes

bool MatrixSet ( LPMATRIX  matrix,
tinyint  row,
tinyint  col,
float  data 
)

Sets a cell of a matrix.

Parameters:
matrix Pointer to the matrix
row Row to set
col Column to set
Returns:
true if successfull / false if not

void MatrixSetAll ( LPMATRIX  matrix,
float  value 
)

Sets an entire matrix to a single value.

Parameters:
matrix Pointer to the matrix
value Value to set the matrix to

LPMATRIX MatrixTranspose ( const LPMATRIX  matrix  ) 

Tranposes a matrix.

Parameters:
matrix Pointer to the matrix to transpose
Returns:
New tranposed matrix

void MLmemcpy ( void *  d,
const void *  source,
size_t  len 
)

Replacement for memcpy, since we need it and its size prohitibitive to include string.h for it.

Parameters:
d Destination Pointer
source Source Pointer
len sizeof code in bytes


Generated on Sat Jul 25 02:20:25 2009 for Matrix Lite Lib by  doxygen 1.5.9