Matrix< T > Class Template Reference

Class for storing dense matrices. More...

Inheritance diagram for Matrix< T >:
IMatrix< T >

List of all members.

Public Member Functions

void AddRows (int num_rows)
 Enlarges the matrix to num_rows rows.
IMatrix< T > CreateMatrix (int num_rows, int num_columns)
 Create a matrix with a given number of rows and columns.
T[] GetColumn (int j)
 Returns a copy of the j-th column of the matrix.
T[] GetRow (int i)
 Returns a copy of the i-th row of the matrix.
void Grow (int num_rows, int num_cols)
 Grows the matrix to the requested size, if necessary.
void Init (T d)
 Init the matrix with a default value.
 Matrix (Matrix< T > matrix)
 Copy constructor. Creates a deep copy of the given matrix.
 Matrix (int dim1, int dim2)
 Initializes a new instance of the Matrix class.
void SetColumn (int j, T[] column)
 Sets the values of the j-th column to the values in a given array.
void SetColumnToOneValue (int j, T v)
 Sets an entire column to a specified value.
void SetRow (int i, T[] row)
 Sets the values of the i-th row to the values in a given array.
void SetRowToOneValue (int i, T v)
 Sets an entire row to a specified value.

Public Attributes

T[] data
 Data array: data is stored in columns.
int dim1
 Dimension 1, the number of rows.
int dim2
 Dimension 2, the number of columns.

Properties

virtual bool IsSymmetric [get]
 True if the matrix is symmetric, false otherwise.
int NumberOfColumns [get]
 The number of columns of the matrix.
int NumberOfRows [get]
 The number of rows of the matrix.
virtual T this [int i, int j] [get, set]
 The value at (i,j).

Detailed Description

template<T>
class MyMediaLite::DataType::Matrix< T >

Class for storing dense matrices.

The data is stored in row-major mode. Indexes are zero-based.

Template Parameters:
T the type of the matrix entries

Constructor & Destructor Documentation

Matrix ( int  dim1,
int  dim2 
)

Initializes a new instance of the Matrix class.

Parameters:
dim1 the number of rows
dim2 the number of columns
Matrix ( Matrix< T >  matrix  ) 

Copy constructor. Creates a deep copy of the given matrix.

Parameters:
matrix the matrix to be copied

Member Function Documentation

void AddRows ( int  num_rows  ) 

Enlarges the matrix to num_rows rows.

Do nothing if num_rows is less than dim1. The new entries are filled with zeros.

Parameters:
num_rows the minimum number of rows
IMatrix<T> CreateMatrix ( int  num_rows,
int  num_columns 
)

Create a matrix with a given number of rows and columns.

Parameters:
num_rows the number of rows
num_columns the number of columns
Returns:
A matrix with num_rows rows and num_column columns

Implements IMatrix< T >.

T [] GetColumn ( int  j  ) 

Returns a copy of the j-th column of the matrix.

Parameters:
j the column ID
Returns:
A vector of T containing the column data
T [] GetRow ( int  i  ) 

Returns a copy of the i-th row of the matrix.

Parameters:
i the row ID
Returns:
A vector of T containing the row data
void Grow ( int  num_rows,
int  num_cols 
)

Grows the matrix to the requested size, if necessary.

The new entries are filled with zeros.

Parameters:
num_rows the minimum number of rows
num_cols the minimum number of columns
void Init ( d  ) 

Init the matrix with a default value.

Parameters:
d the default value
void SetColumn ( int  j,
T[]  column 
)

Sets the values of the j-th column to the values in a given array.

Parameters:
j the column ID
column A T[] of length dim2
void SetColumnToOneValue ( int  j,
v 
)

Sets an entire column to a specified value.

Parameters:
v the value to be used
j the column ID
void SetRow ( int  i,
T[]  row 
)

Sets the values of the i-th row to the values in a given array.

Parameters:
i the row ID
row A vector of T of length dim1
void SetRowToOneValue ( int  i,
v 
)

Sets an entire row to a specified value.

Parameters:
v the value to be used
i the row ID

Member Data Documentation

T [] data

Data array: data is stored in columns.

int dim1

Dimension 1, the number of rows.

int dim2

Dimension 2, the number of columns.


Property Documentation

virtual bool IsSymmetric [get]

True if the matrix is symmetric, false otherwise.

True if the matrix is symmetric, false otherwise

Implements IMatrix< T >.

int NumberOfColumns [get]

The number of columns of the matrix.

The number of columns of the matrix

Implements IMatrix< T >.

int NumberOfRows [get]

The number of rows of the matrix.

The number of rows of the matrix

Implements IMatrix< T >.

virtual T this[int i, int j] [get, set]

The value at (i,j).

The value at (i,j)

Parameters:
x the row ID
y the column ID

Implements IMatrix< T >.


The documentation for this class was generated from the following file:
Generated on Tue May 24 12:44:17 2011 for MyMediaLite by  doxygen 1.6.3