Classes | Defines | Functions
matrix.h File Reference
#include <math.h>
#include <AR/config.h>
Include dependency graph for include/AR/matrix.h:

Go to the source code of this file.

Classes

struct  ARMat
 matrix structure. More...
struct  ARVec
 vector structure. More...

Defines

#define ARELEM0(mat, r, c)   ((mat)->m[(r)*((mat)->clm)+(c)])
 macro function that give direct access to an element (0 origin)
#define ARELEM1(mat, row, clm)   ARELEM0(mat,row-1,clm-1)
 macro function that give direct access to an element (1 origin)

Functions

ARMatarMatrixAlloc (int row, int clm)
 creates a new matrix.
ARMatarMatrixAllocDup (ARMat *source)
 dumps a new matrix
ARMatarMatrixAllocInv (ARMat *source)
 inverses a matrix.
ARMatarMatrixAllocMul (ARMat *a, ARMat *b)
 Multiply two matrix with memory allocation.
ARMatarMatrixAllocTrans (ARMat *source)
 transposes a matrix with allocation.
ARMatarMatrixAllocUnit (int dim)
 Creates a unit matrix.
double arMatrixDet (ARMat *m)
 compute determinant of a matrix.
int arMatrixDisp (ARMat *m)
 display content of a matrix.
int arMatrixDup (ARMat *dest, ARMat *source)
 copy a matrix
int arMatrixFree (ARMat *m)
 deletes a matrix.
int arMatrixInv (ARMat *dest, ARMat *source)
 inverse a matrix.
int arMatrixMul (ARMat *dest, ARMat *a, ARMat *b)
 Multiply two matrix.
int arMatrixPCA (ARMat *input, ARMat *evec, ARVec *ev, ARVec *mean)
 compute the PCA of a matrix.
int arMatrixPCA2 (ARMat *input, ARMat *evec, ARVec *ev)
 compute the PCA of a matrix.
int arMatrixSelfInv (ARMat *m)
 inverses a matrix.
int arMatrixTrans (ARMat *dest, ARMat *source)
 transposes a matrix.
int arMatrixUnit (ARMat *unit)
 Creates a unit matrix.
ARVecarVecAlloc (int clm)
 creates a new vector.
int arVecDisp (ARVec *v)
 display a vector.
int arVecFree (ARVec *v)
 delete a vector.
double arVecHousehold (ARVec *x)
 XXXBK.
double arVecInnerproduct (ARVec *x, ARVec *y)
 Computes the inner product of 2 vectors.
int arVecTridiagonalize (ARMat *a, ARVec *d, ARVec *e)
 XXXBK.

Define Documentation

#define ARELEM0 (   mat,
  r,
 
)    ((mat)->m[(r)*((mat)->clm)+(c)])

macro function that give direct access to an element (0 origin)

Definition at line 100 of file include/AR/matrix.h.

#define ARELEM1 (   mat,
  row,
  clm 
)    ARELEM0(mat,row-1,clm-1)

macro function that give direct access to an element (1 origin)

Definition at line 108 of file include/AR/matrix.h.


Function Documentation

ARMat * arMatrixAlloc ( int  row,
int  clm 
)

creates a new matrix.

Allocate and initialize a new matrix structure. XXXBK initializing ?? to 0 m ??

Parameters:
rownumber of line
clmnumber of column
Returns:
the matrix structure, NULL if allocation is impossible

Definition at line 22 of file lib/SRC/AR/mAlloc.c.

ARMat * arMatrixAllocDup ( ARMat source)

dumps a new matrix

Allocates and recopy the original source matrix.

Parameters:
sourcethe source matrix to copy
Returns:
the matrix if success, NULL if error

Definition at line 22 of file lib/SRC/AR/mAllocDup.c.

int arMatrixAllocInv ( ARMat source)

inverses a matrix.

Inverses a matrix and copy the result in in a new allocated structure.

Parameters:
sourcethe matrix to inverse
Returns:
the inversed matrix if success, NULL if error

Definition at line 21 of file lib/SRC/AR/mAllocInv.c.

ARMat * arMatrixAllocMul ( ARMat a,
ARMat b 
)

Multiply two matrix with memory allocation.

multiply two matrix and copy the result in a new allocate matrix (the source matrix is unmodified). the product is this one : dest = a * b

Parameters:
afirst matrix
bsecond matrix
Returns:
the allocated matrix if success, NULL if error

Definition at line 21 of file lib/SRC/AR/mAllocMul.c.

ARMat * arMatrixAllocTrans ( ARMat source)

transposes a matrix with allocation.

transposes a matrix and copy the result in a new allocate matrix (the source matrix is unmodified).

Parameters:
sourcethe matrix to transpose
Returns:
the allocated matrix if success, NULL if error (creation or transposition impossible)

Definition at line 21 of file lib/SRC/AR/mAllocTrans.c.

int arMatrixAllocUnit ( int  dim)

Creates a unit matrix.

Allocates and initializes a matrix to a an identity matrix.

Parameters:
dimdimensions of the unit matrix (square)
Returns:
the matrix allocated if success, NULL if error

Definition at line 21 of file lib/SRC/AR/mAllocUnit.c.

int arMatrixDet ( ARMat m)

compute determinant of a matrix.

Compute the determinant of a matrix.

Parameters:
mmatrix source
Returns:
the computed determinant

Definition at line 20 of file lib/SRC/AR/mDet.c.

int arMatrixDisp ( ARMat m)

display content of a matrix.

Display in current console, the content of the matrix. The display is done line by line.

Parameters:
m
Returns:
0

Definition at line 16 of file lib/SRC/AR/mDisp.c.

int arMatrixDup ( ARMat dest,
ARMat source 
)

copy a matrix

copy one matrix to another. The two ARMat must be allocated.

Parameters:
destthe destination matrix of the copy
sourcethe original matrix source
Returns:
0 if success, -1 if error (matrix with different size)

Definition at line 16 of file lib/SRC/AR/mDup.c.

int arMatrixFree ( ARMat m)

deletes a matrix.

Delete a matrix structure (deallocate used memory).

Parameters:
mmatrix to delete
Returns:
0

Definition at line 21 of file lib/SRC/AR/mFree.c.

int arMatrixInv ( ARMat dest,
ARMat source 
)

inverse a matrix.

inverse a matrix and copy the result in a new one (the source matrix is unmodified). the destination matrix must be allocated. the source matrix need to be a square matrix.

Parameters:
destresult matrix of the inverse operation
sourcesource matrix
Returns:
0 if success, -1 if error (not square matrix)

Definition at line 16 of file lib/SRC/AR/mInv.c.

int arMatrixMul ( ARMat dest,
ARMat a,
ARMat b 
)

Multiply two matrix.

Multiply two matrix and copy the result in another the product is this one : dest = a * b. The destination matrix must be allocated. Matrix a and b need to have the same size (the source matrix is unmodified).

Parameters:
destfinal matrix product
afirst matrix
bsecond matrix
Returns:
0 if success, -1 if error (multiplication impossible, or destination matrix have not comptabile size)

Definition at line 16 of file lib/SRC/AR/mMul.c.

int arMatrixPCA ( ARMat input,
ARMat evec,
ARVec ev,
ARVec mean 
)

compute the PCA of a matrix.

Compute the Principal Component Analysis (PCA) of a matrix.

Parameters:
inputsource matrix
eveceigen vector computed
eveigen value computed
meanmean computed
Returns:
0 if success to compute, -1 otherwise

Definition at line 49 of file lib/SRC/AR/mPCA.c.

int arMatrixPCA2 ( ARMat input,
ARMat evec,
ARVec ev 
)

compute the PCA of a matrix.

Compute the Principal Component Analysis (PCA) of a matrix.

Parameters:
inputsource matrix
evecresult matrix
evegein value computed
Returns:
0 if success to compute, -1 otherwise

Definition at line 89 of file lib/SRC/AR/mPCA.c.

int arMatrixSelfInv ( ARMat m)

inverses a matrix.

Inverses a matrix and copy the result in the same structure.

Parameters:
mthe matrix to inverse
Returns:
0 if success, -1 if error

Definition at line 18 of file lib/SRC/AR/mSelfInv.c.

int arMatrixTrans ( ARMat dest,
ARMat source 
)

transposes a matrix.

Transposes a matrix. The destination matrix must be allocated (the source matrix is unmodified).

Parameters:
destthe destination matrix of the copy
sourcethe source matrix
Returns:
0 if success, -1 if error (source and destination matrix have different size)

Definition at line 16 of file lib/SRC/AR/mTrans.c.

int arMatrixUnit ( ARMat unit)

Creates a unit matrix.

Transforms the source parameter matrix to a unit matrix (all values are modified). the unit matrix needs to be allocated.

Parameters:
unitthe matrix to transform
Returns:
0 if success, -1 if error

Definition at line 16 of file lib/SRC/AR/mUnit.c.

ARVec * arVecAlloc ( int  clm)

creates a new vector.

Allocates and initializes new vector structure.

Parameters:
clmdimension of vector
Returns:
the allocated vector, NULL if error (impossible allocation)

Definition at line 22 of file lib/SRC/AR/vAlloc.c.

int arVecDisp ( ARVec v)

display a vector.

Display element of a vector.

Parameters:
vthe vector to display
Returns:
0

Definition at line 17 of file lib/SRC/AR/vDisp.c.

int arVecFree ( ARVec v)

delete a vector.

Delete a vector structure (deallocate used memory).

Parameters:
vthe vector to delete
Returns:
0

Definition at line 22 of file lib/SRC/AR/vFree.c.

double arVecHousehold ( ARVec x)

XXXBK.

XXXBK: for QR decomposition ?? (can't success to find french translation of this term)

Parameters:
xXXXBK
Returns:
XXXBK

Definition at line 17 of file lib/SRC/AR/vHouse.c.

double arVecInnerproduct ( ARVec x,
ARVec y 
)

Computes the inner product of 2 vectors.

computes the inner product of the two argument vectors. the operation done is a=x.y (and a is return)

Parameters:
xfirst vector source
ysecond vector source
Returns:
the computed innerproduct

Definition at line 18 of file lib/SRC/AR/vInnerP.c.

int arVecTridiagonalize ( ARMat a,
ARVec d,
ARVec e 
)

XXXBK.

XXXBK

Parameters:
aXXXBK
dXXXBK
eXXXBK
Returns:
XXXBK

Definition at line 17 of file lib/SRC/AR/vTridiag.c.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


ar_recog
Author(s): Graylin Trevor Jay and Christopher Crick
autogenerated on Fri Jan 25 2013 12:15:01