C# Class MyMediaLite.DataType.MatrixUtils

Utilities to work with matrices
显示文件 Open project: zenogantner/MML-KDD

Public Methods

Method Description
ColumnAverage ( Matrix matrix, int col ) : double

Compute the average value of the entries in a column of a matrix

ColumnInitNormal ( Matrix matrix, double mean, double stdev, int column ) : void

Initializes one column of a double matrix with normal distributed (Gaussian) noise

FrobeniusNorm ( Matrix matrix ) : double

Compute the Frobenius norm (square root of the sum of squared entries) of a matrix

See http://en.wikipedia.org/wiki/Matrix_norm

Inc ( Matrix matrix1, Matrix matrix2 ) : void

Increment the elements in one matrix by the ones in another

Inc ( Matrix matrix, int i, int j, double v ) : void

Increments the specified matrix element by a double value

InitNormal ( Matrix matrix, double mean, double stdev ) : void

Initializes a double matrix with normal distributed (Gaussian) noise

Multiply ( Matrix matrix, double d ) : void

Multiply all entries of a matrix with a scalar

RowAverage ( Matrix matrix, int row ) : double

Compute the average value of the entries in a row of a matrix

RowDifference ( Matrix matrix1, int i, Matrix matrix2, int j ) : IList

Compute the difference vector between two rows of two matrices

RowInitNormal ( Matrix matrix, double mean, double stdev, int row ) : void

Initializes one row of a double matrix with normal distributed (Gaussian) noise

RowScalarProduct ( Matrix matrix, int i, IList vector ) : double

Compute the scalar product between a vector and a row of the matrix

RowScalarProduct ( Matrix matrix1, int i, Matrix matrix2, int j ) : double

Compute the scalar product between two rows of two matrices

RowScalarProductWithRowDifference ( Matrix matrix1, int i, Matrix matrix2, int j, Matrix matrix3, int k ) : double

Compute the scalar product of a matrix row with the difference vector of two other matrix rows

Method Details

ColumnAverage() public static method

Compute the average value of the entries in a column of a matrix
public static ColumnAverage ( Matrix matrix, int col ) : double
matrix Matrix the matrix
col int the column ID
return double

ColumnInitNormal() public static method

Initializes one column of a double matrix with normal distributed (Gaussian) noise
public static ColumnInitNormal ( Matrix matrix, double mean, double stdev, int column ) : void
matrix Matrix the matrix to initialize
mean double the mean of the normal distribution drawn from
stdev double the standard deviation of the normal distribution
column int the column to be initialized
return void

FrobeniusNorm() public static method

Compute the Frobenius norm (square root of the sum of squared entries) of a matrix
See http://en.wikipedia.org/wiki/Matrix_norm
public static FrobeniusNorm ( Matrix matrix ) : double
matrix Matrix the matrix
return double

Inc() public static method

Increment the elements in one matrix by the ones in another
public static Inc ( Matrix matrix1, Matrix matrix2 ) : void
matrix1 Matrix the matrix to be incremented
matrix2 Matrix the other matrix
return void

Inc() public static method

Increments the specified matrix element by a double value
public static Inc ( Matrix matrix, int i, int j, double v ) : void
matrix Matrix The matrix.
i int the row
j int the column
v double the value
return void

InitNormal() public static method

Initializes a double matrix with normal distributed (Gaussian) noise
public static InitNormal ( Matrix matrix, double mean, double stdev ) : void
matrix Matrix the matrix to initialize
mean double the mean of the normal distribution drawn from
stdev double the standard deviation of the normal distribution
return void

Multiply() public static method

Multiply all entries of a matrix with a scalar
public static Multiply ( Matrix matrix, double d ) : void
matrix Matrix the matrix
d double the number to multiply with
return void

RowAverage() public static method

Compute the average value of the entries in a row of a matrix
public static RowAverage ( Matrix matrix, int row ) : double
matrix Matrix the matrix
row int the row ID
return double

RowDifference() public static method

Compute the difference vector between two rows of two matrices
public static RowDifference ( Matrix matrix1, int i, Matrix matrix2, int j ) : IList
matrix1 Matrix the first matrix
i int the first row ID
matrix2 Matrix the second matrix
j int the second row ID
return IList

RowInitNormal() public static method

Initializes one row of a double matrix with normal distributed (Gaussian) noise
public static RowInitNormal ( Matrix matrix, double mean, double stdev, int row ) : void
matrix Matrix the matrix to initialize
mean double the mean of the normal distribution drawn from
stdev double the standard deviation of the normal distribution
row int the row to be initialized
return void

RowScalarProduct() public static method

Compute the scalar product between a vector and a row of the matrix
public static RowScalarProduct ( Matrix matrix, int i, IList vector ) : double
matrix Matrix the matrix
i int the row ID
vector IList the numeric vector
return double

RowScalarProduct() public static method

Compute the scalar product between two rows of two matrices
public static RowScalarProduct ( Matrix matrix1, int i, Matrix matrix2, int j ) : double
matrix1 Matrix the first matrix
i int the first row ID
matrix2 Matrix the second matrix
j int the second row ID
return double

RowScalarProductWithRowDifference() public static method

Compute the scalar product of a matrix row with the difference vector of two other matrix rows
public static RowScalarProductWithRowDifference ( Matrix matrix1, int i, Matrix matrix2, int j, Matrix matrix3, int k ) : double
matrix1 Matrix the first matrix
i int the first row ID
matrix2 Matrix the second matrix
j int the second row ID
matrix3 Matrix the third matrix
k int the third row ID
return double