In file ../include/EST_TMatrix.h:

template<class T> class EST_TMatrix

Template Matrix class.

Inheritance:


Public Methods

[more] EST_TMatrix ()
default constructor
[more] EST_TMatrix (const EST_TMatrix<T> &m)
copy constructor
[more] EST_TMatrix (int rows, int cols)
"size" constructor
[more] EST_TMatrix (int rows, int cols, T* memory, int offset=0, int free_when_destroyed=0)
construct from memory supplied by caller
[more] ~EST_TMatrix ()
EST_TMatrix
[more] access

[more]int num_rows () const
return number of rows
[more]int num_columns () const
return number of columns
[more]INLINE const T& a_no_check (int row, int col) const
const access with no bounds check, care recommend
[more]INLINE T& a_no_check (int row, int col)
access with no bounds check, care recommend
[more]const T& a_check (int row, int col) const
const element access function
[more]T& a_check (int row, int col)
non-const element access function
[more]const T& operator () (int row, int col) const
const element access operator
[more]T& operator () (int row, int col)
non-const element access operator

[more]void resize (int rows, int cols, int set=1)
resize matrix.
[more]void fill (const T &v)
fill matrix with value v
[more]EST_TMatrix& operator= (const EST_TMatrix &s)
assignment operator
[more]EST_TMatrix& add_rows (const EST_TMatrix &s)
The two versions of what might have been operator +=
[more] Sub-Matrix/Vector Extraction

[more]void row (EST_TVector<T> &rv, int r, int start_c=0, int len=-1)
Make the vector rv a window onto row r
[more]void column (EST_TVector<T> &cv, int c, int start_r=0, int len=-1)
Make the vector cv a window onto column c
[more]void sub_matrix (EST_TMatrix<T> &sm, int r=0, int numr=EST_ALL, int c=0, int numc=EST_ALL)
Make the matrix sm a window into this matrix

[more] Copy in and out

[more]void copy_row (int r, T* buf, int offset=0, int num=-1) const
Copy row r of matrix to buf.
[more]void copy_row (int r, EST_TVector<T> &t, int offset=0, int num=-1) const
Copy row <parameter>r</parameter> of matrix to <parameter>buf</parameter>.
[more]void copy_column (int c, T* buf, int offset=0, int num=-1) const
Copy column c of matrix to buf.
[more]void copy_column (int c, EST_TVector<T> &t, int offset=0, int num=-1) const
Copy column <parameter>c</parameter> of matrix to <parameter>buf</parameter>.
[more]void set_row (int n, const T* buf, int offset=0, int num=-1)
Copy buf into row n of matrix.
[more]void set_column (int n, const T* buf, int offset=0, int num=-1)
Copy buf into column n of matrix.
[more]void set_memory (T* buffer, int offset, int rows, int columns, int free_when_destroyed=0)
For when you absolutely have to have access to the memory

[more] io

[more]EST_read_status load (const class EST_String &filename)
load Matrix from file - Not currently implemented
[more]EST_write_status save (const class EST_String &filename) const
save Matrix to file filename

Protected Fields

[more]unsigned int p_num_rows
Visible shape
[more]unsigned int p_row_step
How to access the memory

Protected Methods

[more]INLINE const T& fast_a_m (int r, int c) const
quick method for returning x[m][n]
[more]void set_values (const T* data, int r_step, int c_step, int start_r, int num_r, int start_c, int num_c )
Get and set values from array
[more]void copy (const EST_TMatrix<T> &a)
private resize and copy function.
[more]void copy_data (const EST_TMatrix<T> &a)
just copy data, no resizing, no size check
[more]void just_resize (int new_rows, int new_cols, T** old_vals)
resize the memory and reset the bounds, but don't set values
[more]void default_vals ()
sets data and length to default values (0 in both cases)


Inherited from EST_TVector:

Public Fields

oT* p_memory
ounsigned int p_num_columns
ounsigned int p_offset
ostatic const T* def_val
ostatic T* error_return

Public Methods

oINLINE unsigned int vcell_pos(unsigned int c, unsigned int cs) const
oINLINE const T& fast_a_v(int c) const
oconst T* memory() const
ovoid empty()
oEST_write_status save(const EST_String &filename)
oint operator == (const EST_TVector &v) const
oint operator != (const EST_TVector &v) const
ovoid copy_section(T* dest, int offset=0, int num=-1) const
ovoid sub_vector(EST_TVector<T> &sv, int start_c=0, int len=-1)
ovoid integrity() const


Documentation

Template Matrix class.

This is an extension of the EST_TVector class to two dimensions.

ounsigned int p_num_rows
Visible shape

ounsigned int p_row_step
How to access the memory

oINLINE const T& fast_a_m(int r, int c) const
quick method for returning x[m][n]

ovoid set_values(const T* data, int r_step, int c_step, int start_r, int num_r, int start_c, int num_c )
Get and set values from array

ovoid copy(const EST_TMatrix<T> &a)
private resize and copy function.

ovoid copy_data(const EST_TMatrix<T> &a)
just copy data, no resizing, no size check

ovoid just_resize(int new_rows, int new_cols, T** old_vals)
resize the memory and reset the bounds, but don't set values

ovoid default_vals()
sets data and length to default values (0 in both cases)

o EST_TMatrix()
default constructor

o EST_TMatrix(const EST_TMatrix<T> &m)
copy constructor

o EST_TMatrix(int rows, int cols)
"size" constructor

o EST_TMatrix(int rows, int cols, T* memory, int offset=0, int free_when_destroyed=0)
construct from memory supplied by caller

o ~EST_TMatrix()
EST_TMatrix

o access
Basic access methods for matrices.

oint num_rows() const
return number of rows

oint num_columns() const
return number of columns

oINLINE const T& a_no_check(int row, int col) const
const access with no bounds check, care recommend

oINLINE T& a_no_check(int row, int col)
access with no bounds check, care recommend

oconst T& a_check(int row, int col) const
const element access function

oT& a_check(int row, int col)
non-const element access function

oconst T& operator () (int row, int col) const
const element access operator

oT& operator () (int row, int col)
non-const element access operator

ovoid resize(int rows, int cols, int set=1)
resize matrix. If set=1, then the current values in the matirx are preserved up to the new size n. If the new size exceeds the old size, the rest of the matrix is filled with the def_val

ovoid fill(const T &v)
fill matrix with value v

oEST_TMatrix& operator=(const EST_TMatrix &s)
assignment operator

oEST_TMatrix& add_rows(const EST_TMatrix &s)
The two versions of what might have been operator +=

o Sub-Matrix/Vector Extraction
All of these return matrecies and vectors which share memory with the original, so altering values them alters the original.

ovoid row(EST_TVector<T> &rv, int r, int start_c=0, int len=-1)
Make the vector rv a window onto row r

ovoid column(EST_TVector<T> &cv, int c, int start_r=0, int len=-1)
Make the vector cv a window onto column c

ovoid sub_matrix(EST_TMatrix<T> &sm, int r=0, int numr=EST_ALL, int c=0, int numc=EST_ALL)
Make the matrix sm a window into this matrix

o Copy in and out
Copy data between buffers and the matrix.

ovoid copy_row(int r, T* buf, int offset=0, int num=-1) const
Copy row r of matrix to buf. buf should be pre-malloced to the correct size.

ovoid copy_row(int r, EST_TVector<T> &t, int offset=0, int num=-1) const
Copy row <parameter>r</parameter> of matrix to <parameter>buf</parameter>. <parameter>buf</parameter> should be pre-malloced to the correct size.

ovoid copy_column(int c, T* buf, int offset=0, int num=-1) const
Copy column c of matrix to buf. buf should be pre-malloced to the correct size.

ovoid copy_column(int c, EST_TVector<T> &t, int offset=0, int num=-1) const
Copy column <parameter>c</parameter> of matrix to <parameter>buf</parameter>. <parameter>buf</parameter> should be pre-malloced to the correct size.

ovoid set_row(int n, const T* buf, int offset=0, int num=-1)
Copy buf into row n of matrix.

ovoid set_column(int n, const T* buf, int offset=0, int num=-1)
Copy buf into column n of matrix.

ovoid set_memory(T* buffer, int offset, int rows, int columns, int free_when_destroyed=0)
For when you absolutely have to have access to the memory

o io
Matrix file io.
Friends:
ostream& operator << (ostream &st,const EST_TMatrix<T> &a)

oEST_read_status load(const class EST_String &filename)
load Matrix from file - Not currently implemented

oEST_write_status save(const class EST_String &filename) const
save Matrix to file filename


This class has no child classes.
See Also:
matrix_example
EST_TVector

Alphabetic index HTML hierarchy of classes or Java


This page is part of the Edinburgh Speech Tools Library documentation
Copyright University of Edinburgh 1997
Contact: speech_tools@cstr.ed.ac.uk