Matrix Type

Matrix class.

Constructors

Constructor Description

Matrix(m, n)

Full Usage: Matrix(m, n)

Parameters:
    m : int - Number of rows.
    n : int - Number of colums.

Construct an m-by-n matrix of zeros.

m : int

Number of rows.

n : int

Number of colums.

Matrix(m, n, s)

Full Usage: Matrix(m, n, s)

Parameters:
    m : int - Number of rows.
    n : int - Number of colums.
    s : float - Fill the matrix with this scalar value.

Construct an m-by-n constant matrix.

m : int

Number of rows.

n : int

Number of colums.

s : float

Fill the matrix with this scalar value.

Matrix(A)

Full Usage: Matrix(A)

Parameters:
    A : float[][] - Two-dimensional array of doubles.

Construct a matrix from a 2-D jagged array.

Array is not copied

A : float[][]

Two-dimensional array of doubles.

ArgumentException All rows must have the same length

Matrix(arr)

Full Usage: Matrix(arr)

Parameters:
    arr : float[,]

arr : float[,]

Matrix(A, m, n)

Full Usage: Matrix(A, m, n)

Parameters:
    A : float[][] - Two-dimensional array of doubles.
    m : int - Number of rows.
    n : int - Number of columns.

Construct a matrix quickly without checking arguments.

A : float[][]

Two-dimensional array of doubles.

m : int

Number of rows.

n : int

Number of columns.

Instance members

Instance member Description

this.Cholesky

Full Usage: this.Cholesky

Returns: Matrix Lower-triangular Cholesky factor for a symmetric positive-definite matrix

Cholesky factorization

Returns: Matrix

Lower-triangular Cholesky factor for a symmetric positive-definite matrix

this.Clone

Full Usage: this.Clone

Returns: Matrix

Make a deep copy of a matrix

Returns: Matrix

this.CloneColumn

Full Usage: this.CloneColumn

Parameters:
    columnNum : int - Column number (zero based)

Returns: Vector Vector containing copy of column's elements

Gets column with number coumnnum from matrix res

columnNum : int

Column number (zero based)

Returns: Vector

Vector containing copy of column's elements

this.ColumnDimension

Full Usage: this.ColumnDimension

Returns: int The number of columns.

Get column dimension.

Returns: int

The number of columns.

this.InverseLower

Full Usage: this.InverseLower

Returns: Matrix

Matrix inverse for a lower triangular matrix

Returns: Matrix

this.[arg1, arg2]

Full Usage: this.[arg1, arg2]

Parameters:
    arg0 : int

Returns: int A(i,j)

Matrix elements accessor.

arg0 : int
Returns: int

A(i,j)

this.[arg1]

Full Usage: this.[arg1]

Returns: int A(i)

Access the Column

Returns: int

A(i)

this.Mul

Full Usage: this.Mul

Parameters:
    s : float - scalar

Returns: Matrix replace A by s*A

Multiply a matrix by a scalar in place, A = s*A

s : float

scalar

Returns: Matrix

replace A by s*A

this.RowDimension

Full Usage: this.RowDimension

Returns: int The number of rows.

Get row dimension.

Returns: int

The number of rows.

this.SolveGE

Full Usage: this.SolveGE

Parameters:
    b : Vector - right hand side Vector

Returns: Vector The solution x = A^(-1) * b as a Vector

Solve A*x = b using Gaussian elimination with partial pivoting

b : Vector

right hand side Vector

Returns: Vector

The solution x = A^(-1) * b as a Vector

this.SolveLower

Full Usage: this.SolveLower

Parameters:
Returns: Vector

b : Vector
Returns: Vector

this.SolveUpper

Full Usage: this.SolveUpper

Parameters:
Returns: Vector

b : Vector
Returns: Vector

this.Submatrix

Full Usage: this.Submatrix

Parameters:
    i0 : int - Initial row index
    i1 : int - Final row index
    j0 : int - Initial column index
    j1 : int - Final column index

Returns: Matrix A(i0:i1,j0:j1)

Get a submatrix.

i0 : int

Initial row index

i1 : int

Final row index

j0 : int

Initial column index

j1 : int

Final column index

Returns: Matrix

A(i0:i1,j0:j1)

IndexOutOfRangeException Submatrix indices

this.Submatrix

Full Usage: this.Submatrix

Parameters:
    r : int[] - Array of row indices.
    c : int[] - Array of column indices.

Returns: Matrix A(r(:),c(:))

Get a submatrix.

r : int[]

Array of row indices.

c : int[]

Array of column indices.

Returns: Matrix

A(r(:),c(:))

IndexOutOfRangeException Submatrix indices

this.Submatrix

Full Usage: this.Submatrix

Parameters:
    i0 : int - Initial row index
    i1 : int - Final row index
    c : int[] - Array of column indices.

Returns: Matrix A(i0:i1,c(:))

Get a submatrix.

i0 : int

Initial row index

i1 : int

Final row index

c : int[]

Array of column indices.

Returns: Matrix

A(i0:i1,c(:))

IndexOutOfRangeException Submatrix indices

this.Submatrix

Full Usage: this.Submatrix

Parameters:
    r : int[] - Array of row indices.
    j0 : int - Initial column index.
    j1 : int - Final column index.

Returns: Matrix A(r(:),j0:j1)

Get a submatrix.

r : int[]

Array of row indices.

j0 : int

Initial column index.

j1 : int

Final column index.

Returns: Matrix

A(r(:),j0:j1)

IndexOutOfRangeException Submatrix indices

this.Transpose

Full Usage: this.Transpose

Returns: Matrix An n-by-m matrix where the input matrix has m rows and n columns.

Transpose of a dense matrix

Returns: Matrix

An n-by-m matrix where the input matrix has m rows and n columns.

this.times s

Full Usage: this.times s

Parameters:
    s : float - scalar

Returns: Matrix s*A

Multiply a matrix by a scalar, C = s*A

s : float

scalar

Returns: Matrix

s*A

Static members

Static member Description

A * s

Full Usage: A * s

Parameters:
Returns: Matrix

A : Matrix
s : float
Returns: Matrix

s * A

Full Usage: s * A

Parameters:
Returns: Matrix

s : float
A : Matrix
Returns: Matrix

A * B

Full Usage: A * B

Parameters:
Returns: Matrix

A : Matrix
B : Matrix
Returns: Matrix

A + B

Full Usage: A + B

Parameters:
Returns: Matrix

A : Matrix
B : Matrix
Returns: Matrix

A - B

Full Usage: A - B

Parameters:
Returns: Matrix

A : Matrix
B : Matrix
Returns: Matrix

Matrix.Identity(m, n)

Full Usage: Matrix.Identity(m, n)

Parameters:
    m : int - Number of rows.
    n : int - Number of colums.

Returns: Matrix An m-by-n matrix with ones on the diagonal and zeros elsewhere.

Generate identity matrix

m : int

Number of rows.

n : int

Number of colums.

Returns: Matrix

An m-by-n matrix with ones on the diagonal and zeros elsewhere.

op_Explicita

Full Usage: op_Explicita

Parameters:
Returns: float[,]

a : Matrix
Returns: float[,]

op_Explicita

Full Usage: op_Explicita

Parameters:
Returns: float[][]

a : Matrix
Returns: float[][]