C# Class Encog.MathUtil.Matrices.Matrix

Exibir arquivo Open project: encog/encog-silverlight-core Class Usage Examples

Public Methods

Method Description
Add ( Matrix matrix ) : void

Add the specified matrix to this matrix. This will modify the matrix to hold the result of the addition.

Add ( int row, int col, double value_ren ) : void

Add the specified value to the specified row and column of the matrix.

Clear ( ) : void

Clear the matrix.

Clone ( ) : object

Clone the matrix.

CreateColumnMatrix ( double input ) : Matrix

Create a matrix that is a single column.

CreateRowMatrix ( double input ) : Matrix

Create a matrix that is a single row.

Equals ( Object other ) : bool

Determine if this matrix is equal to another. Use a precision of 10 decimal places.

FromPackedArray ( double array, int index ) : int

Take the values of thie matrix from a packed array.

GetArrayCopy ( ) : double[][]

Make a copy of this matrix as an array.

GetCol ( int col ) : Matrix

Get one column from this matrix as a column matrix.

GetHashCode ( ) : int

Generate a hash code, this is just rows+cols. Probably a better way to do this, but I really don't see the Matrix class being used as the key to a hash table.

GetMatrix ( int r, int c ) : Matrix

Get a submatrix.

GetMatrix ( int i0, int i1, int c ) : Matrix

Get a submatrix.

GetMatrix ( int i0, int i1, int j0, int j1 ) : Matrix

Get a submatrix.

GetRow ( int row ) : Matrix

Get the specified row as a row matrix.

Inverse ( ) : Matrix

The matrix inverted.

IsVector ( ) : bool

Determine if this matrix is a vector. A vector matrix only has a single row or column.

IsZero ( ) : bool

Determine if all of the values in the matrix are zero.

Matrix ( bool sourceMatrix ) : System

Construct a matrix from a 2D boolean array. Translate true to 1, false to -1.

Matrix ( double sourceMatrix ) : System

Construct a matrix from a 2D double array.

Matrix ( int rows, int cols ) : System

Construct a blank matrix with the specified number of rows and columns.

Multiply ( double vector, double result ) : void

Multiply every row by the specified vector.

Ramdomize ( double min, double max ) : void

Fill the matrix with random values in the specified range.

Randomize ( double min, double max ) : void

Randomize the matrix.

Set ( Matrix other ) : void

Set the values from the other matrix into this one.

Set ( double value_ren ) : void

Set every value in the matrix to the specified value.

SetMatrix ( int r, int c, Matrix x ) : void

Set a submatrix.

SetMatrix ( int r, int j0, int j1, Matrix x ) : void

Set a submatrix.

SetMatrix ( int i0, int i1, int j0, int j1, Matrix x ) : void

Set a submatrix.

Solve ( Matrix b ) : Matrix

Solve A*X = B

Sum ( ) : double

Sum all of the values in the matrix.

ToPackedArray ( ) : double[]

Convert the matrix to a packed array.

equals ( Matrix matrix, int precision ) : bool

Compare the matrix to another with the specified level of precision.

this ( int row, int col ) : double

Allows index access to the elements of the matrix. Warning: This can be a somewhat slow way to access the matrix. Do not put this in performance critical loops. Make sure to use the Data property and access the matrix array directly.

Private Methods

Method Description
Validate ( int row, int col ) : void

Validate that the specified row and column are inside of the range of the matrix.

Method Details

Add() public method

Add the specified matrix to this matrix. This will modify the matrix to hold the result of the addition.
public Add ( Matrix matrix ) : void
matrix Matrix The matrix to add.
return void

Add() public method

Add the specified value to the specified row and column of the matrix.
public Add ( int row, int col, double value_ren ) : void
row int The row to add to.
col int The column to add to.
value_ren double The value to add.
return void

Clear() public method

Clear the matrix.
public Clear ( ) : void
return void

Clone() public method

Clone the matrix.
public Clone ( ) : object
return object

CreateColumnMatrix() public static method

Create a matrix that is a single column.
public static CreateColumnMatrix ( double input ) : Matrix
input double A 1D array to make the matrix from.
return Matrix

CreateRowMatrix() public static method

Create a matrix that is a single row.
public static CreateRowMatrix ( double input ) : Matrix
input double A 1D array to make the matrix from.
return Matrix

Equals() public method

Determine if this matrix is equal to another. Use a precision of 10 decimal places.
public Equals ( Object other ) : bool
other Object The other matrix to compare.
return bool

FromPackedArray() public method

Take the values of thie matrix from a packed array.
public FromPackedArray ( double array, int index ) : int
array double The packed array to read the matrix from.
index int The index to begin reading at in the array.
return int

GetArrayCopy() public method

Make a copy of this matrix as an array.
public GetArrayCopy ( ) : double[][]
return double[][]

GetCol() public method

Get one column from this matrix as a column matrix.
public GetCol ( int col ) : Matrix
col int The desired column.
return Matrix

GetHashCode() public method

Generate a hash code, this is just rows+cols. Probably a better way to do this, but I really don't see the Matrix class being used as the key to a hash table.
public GetHashCode ( ) : int
return int

GetMatrix() public method

Get a submatrix.
public GetMatrix ( int r, int c ) : Matrix
r int Array of row indices.
c int Array of column indices.
return Matrix

GetMatrix() public method

Get a submatrix.
public GetMatrix ( int i0, int i1, int c ) : Matrix
i0 int Initial row index.
i1 int Final row index.
c int Array of column indices.
return Matrix

GetMatrix() public method

Get a submatrix.
public GetMatrix ( int i0, int i1, int j0, int j1 ) : Matrix
i0 int Initial row index.
i1 int Final row index.
j0 int Initial column index.
j1 int Final column index.
return Matrix

GetRow() public method

Get the specified row as a row matrix.
public GetRow ( int row ) : Matrix
row int The desired row.
return Matrix

Inverse() public method

The matrix inverted.
public Inverse ( ) : Matrix
return Matrix

IsVector() public method

Determine if this matrix is a vector. A vector matrix only has a single row or column.
public IsVector ( ) : bool
return bool

IsZero() public method

Determine if all of the values in the matrix are zero.
public IsZero ( ) : bool
return bool

Matrix() public method

Construct a matrix from a 2D boolean array. Translate true to 1, false to -1.
public Matrix ( bool sourceMatrix ) : System
sourceMatrix bool A 2D array to construcat the matrix from.
return System

Matrix() public method

Construct a matrix from a 2D double array.
public Matrix ( double sourceMatrix ) : System
sourceMatrix double A 2D double array.
return System

Matrix() public method

Construct a blank matrix with the specified number of rows and columns.
public Matrix ( int rows, int cols ) : System
rows int How many rows.
cols int How many columns.
return System

Multiply() public method

Multiply every row by the specified vector.
public Multiply ( double vector, double result ) : void
vector double The vector to multiply by.
result double The result to hold the values.
return void

Ramdomize() public method

Fill the matrix with random values in the specified range.
public Ramdomize ( double min, double max ) : void
min double The minimum value for the random numbers.
max double The maximum value for the random numbers.
return void

Randomize() public method

Randomize the matrix.
public Randomize ( double min, double max ) : void
min double Minimum random value.
max double Maximum random value.
return void

Set() public method

Set the values from the other matrix into this one.
public Set ( Matrix other ) : void
other Matrix The source matrix.
return void

Set() public method

Set every value in the matrix to the specified value.
public Set ( double value_ren ) : void
value_ren double The value to set the matrix to.
return void

SetMatrix() public method

Set a submatrix.
public SetMatrix ( int r, int c, Matrix x ) : void
r int Array of row indices.
c int Array of column indices.
x Matrix The matrix to set.
return void

SetMatrix() public method

Set a submatrix.
public SetMatrix ( int r, int j0, int j1, Matrix x ) : void
r int Array of row indices.
j0 int Initial column index
j1 int Final column index
x Matrix A(r(:),j0:j1)
return void

SetMatrix() public method

Set a submatrix.
public SetMatrix ( int i0, int i1, int j0, int j1, Matrix x ) : void
i0 int Initial row index
i1 int Final row index
j0 int Initial column index
j1 int Final column index
x Matrix A(i0:i1,j0:j1)
return void

Solve() public method

Solve A*X = B
public Solve ( Matrix b ) : Matrix
b Matrix right hand side.
return Matrix

Sum() public method

Sum all of the values in the matrix.
public Sum ( ) : double
return double

ToPackedArray() public method

Convert the matrix to a packed array.
public ToPackedArray ( ) : double[]
return double[]

equals() public method

Compare the matrix to another with the specified level of precision.
public equals ( Matrix matrix, int precision ) : bool
matrix Matrix The other matrix to compare.
precision int The number of decimal places of precision to use.
return bool

this() public method

Allows index access to the elements of the matrix. Warning: This can be a somewhat slow way to access the matrix. Do not put this in performance critical loops. Make sure to use the Data property and access the matrix array directly.
public this ( int row, int col ) : double
row int The row to access.
col int The column to access.
return double