Matrix object.

## Inheritance:

### Public Fields

int m
Size of the matrix
real** ptr
Data of the matrix
real* base
NULL if not allocated by Mat.

### Public Methods

Mat(real** ptr_, int n_rows, int n_cols)
Create a matrix from values in ptr_.
Mat(real* ptr_, int n_rows, int n_cols)
Create a matrix from values in ptr_.
Mat(int n_rows, int n_cols)
Create a new matrix
void copy(Mat* mat)
Copy the matrix mat
void zero()
Zero the matrix
real norm1()
Compute the norm1
real normFrobenius()
Compute the Frobenius norm
real normInf()
Compute the norm inf
Vec* getRow(int row, Vec* vec = NULL)
Return the row row of the matrix.
Vec* getCol(int col, Vec* vec = NULL)
Return the column col of the matrix.
void setRow(int row, Vec* vec)
Set the row row to values in vec
void setCol(int row, Vec* vec)
Set the column col to values in vec
Mat* subMat(int row1, int col1, int row2, int col2)
Return a sub-matrix.

### Public Fields

Allocator* allocator

### Public Methods

void addOption(const char* name, int size, void* ptr, const char* help="")
void addIOption(const char* name, int* ptr, int init_value, const char* help="")
void addROption(const char* name, real* ptr, real init_value, const char* help="")
void addBOption(const char* name, bool* ptr, bool init_value, const char* help="")
void addOOption(const char* name, Object** ptr, Object* init_value, const char* help="")
void setOption(const char* name, void* ptr)
void setIOption(const char* name, int option)
void setROption(const char* name, real option)
void setBOption(const char* name, bool option)
void setOOption(const char* name, Object* option)
virtual void saveXFile(XFile* file)
void save(const char* filename)
void* operator new(size_t size, Allocator* allocator_=NULL)
void* operator new(size_t size, Allocator* allocator_, void* ptr_)
void operator delete(void* ptr)

## Documentation

Matrix object.

int m
Size of the matrix

real** ptr
Data of the matrix

real* base
NULL if not allocated by Mat. (when you're using the first constructor of Mat, or for the matrix returned by subMat)

Mat(real** ptr_, int n_rows, int n_cols)
Create a matrix from values in ptr_. (No memory copy).

Mat(real* ptr_, int n_rows, int n_cols)
Create a matrix from values in ptr_. (No memory copy).

Mat(int n_rows, int n_cols)
Create a new matrix

void copy(Mat* mat)
Copy the matrix mat

void zero()
Zero the matrix

real norm1()
Compute the norm1

real normFrobenius()
Compute the Frobenius norm

real normInf()
Compute the norm inf

Vec* getRow(int row, Vec* vec = NULL)
Return the row row of the matrix. If vec is NULL, return a new vector. Else copy the row in vec.

Vec* getCol(int col, Vec* vec = NULL)
Return the column col of the matrix. If vec is NULL, return a new vector. Else copy the column in vec.

void setRow(int row, Vec* vec)
Set the row row to values in vec

void setCol(int row, Vec* vec)
Set the column col to values in vec

Mat* subMat(int row1, int col1, int row2, int col2)
Return a sub-matrix. Note that the memory is shared with the original matrix, so *be carefull*. You have to destroy the returned matrix.

This class has no child classes.
Author:
Ronan Collobert (collober@idiap.ch)