SparseMatrix Type

Sparse matrix class

Constructors

Constructor Description

SparseMatrix(m, n)

Full Usage: SparseMatrix(m, n)

Parameters:
    m : int - Number of rows
    n : int - Number of columns

Constructor for SparseMatrix class

m : int

Number of rows

n : int

Number of columns

SparseMatrix(m, n, matrixItems, matrixIndices, _count)

Full Usage: SparseMatrix(m, n, matrixItems, matrixIndices, _count)

Parameters:
    m : int
    n : int
    matrixItems : float[][]
    matrixIndices : int[][]
    _count : int[]

m : int
n : int
matrixItems : float[][]
matrixIndices : int[][]
_count : int[]

Instance members

Instance member Description

this.ColumnDimension

Full Usage: this.ColumnDimension

Returns: int n, the number of columns.

Get column dimension.

Returns: int

n, the number of columns.

this.Copy

Full Usage: this.Copy

Returns: SparseMatrix

Returns: SparseMatrix

this.Count

Full Usage: this.Count

Returns: int[]

Returns: int[]

this.DenseMatrix

Full Usage: this.DenseMatrix

Returns: Matrix A matrix equivalent

Dense version of a sparse matrix

Returns: Matrix

A matrix equivalent

this.IsLowerTriangular

Full Usage: this.IsLowerTriangular

Returns: bool true or false

Check if the current matrix is lower triangular

Returns: bool

true or false

this.[arg1, arg2]

Full Usage: this.[arg1, arg2]

Parameters:
    arg0 : int

Returns: int (i,j)th element

Accessor method for (i,j)th element

arg0 : int
Returns: int

(i,j)th element

this.[arg1]

Full Usage: this.[arg1]

Returns: int The ith row as a SparseVector

Accessor method for ith row

Returns: int

The ith row as a SparseVector

this.Mul

Full Usage: this.Mul

Parameters:
    s : float - Scaling factor

Returns: SparseMatrix Scaled sparse matrix

Matrix multiplication by a scalar

s : float

Scaling factor

Returns: SparseMatrix

Scaled sparse matrix

this.RowDimension

Full Usage: this.RowDimension

Returns: int m, the number of rows

Get row dimension.

Returns: int

m, the number of rows

this.ScaleRow

Full Usage: this.ScaleRow

Parameters:
    i : int - Index of the row to be scaled
    j1 : int - Lowest column entry to scale
    j2 : int - High column entry to scale
    sf : float - Scale factor

Method to rescale a row of a Sparse Matrix

i : int

Index of the row to be scaled

j1 : int

Lowest column entry to scale

j2 : int

High column entry to scale

sf : float

Scale factor

this.SolveGE

Full Usage: this.SolveGE

Parameters:
    b : Vector - The right hand side vector

Returns: Vector The solution x

Gaussian elimination method for A*x=b with partial pivoting

b : Vector

The right hand side vector

Returns: Vector

The solution x

this.SolveLower

Full Usage: this.SolveLower

Parameters:
Returns: Vector

Forward substitution routine for solving Lx = b, where L is a lower-triangular matrix

b : Vector

Returns: Vector

this.SwitchRows

Full Usage: this.SwitchRows

Parameters:
    i : int
    j : int

Switch rows of a sparse matrix

i : int
j : int

this.Transpose

Full Usage: this.Transpose

Returns: SparseMatrix New matrix that is the transposed of the original.

Tranpose of sparse matrix

Returns: SparseMatrix

New matrix that is the transposed of the original.

this.minus B

Full Usage: this.minus B

Parameters:
Returns: SparseMatrix The result A - B

Matrix subtraction for a sparse matrix

B : SparseMatrix

The matrix to subtract

Returns: SparseMatrix

The result A - B

this.plus B

Full Usage: this.plus B

Parameters:
Returns: SparseMatrix The result A + B

Matrix addition for a sparse matrix

B : SparseMatrix

The matrix to add

Returns: SparseMatrix

The result A + B

this.times v

Full Usage: this.times v

Parameters:
Returns: Vector

Matrix multiplication

v : Vector

Vector

Returns: Vector

this.times s

Full Usage: this.times s

Parameters:
    s : float - Scalar

Returns: SparseMatrix Scaled sparse matrix

Matrix multiplication by a scalar

s : float

Scalar

Returns: SparseMatrix

Scaled sparse matrix

this.times B

Full Usage: this.times B

Parameters:
Returns: SparseMatrix A * B where A is current sparce matrix

Matrix right multiplication by a matrix

B : SparseMatrix

Scaling factor

Returns: SparseMatrix

A * B where A is current sparce matrix

this.timesRight v

Full Usage: this.timesRight v

Parameters:
Returns: Vector y

Matrix multiplication, y = v * A

v : Vector

Vector

Returns: Vector

y

Static members

Static member Description

m * v

Full Usage: m * v

Parameters:
Returns: Vector

Matrix multiplication

m : SparseMatrix

First factor

v : Vector

Second factor

Returns: Vector

v * m

Full Usage: v * m

Parameters:
Returns: Vector

Matrix multiplication

v : Vector

Vector

m : SparseMatrix

2nd factor

Returns: Vector

A * s

Full Usage: A * s

Parameters:
Returns: SparseMatrix Scaled sparse matrix

Matrix multiplication by a scalar

A : SparseMatrix

Sparse Matrix

s : float

Scalar

Returns: SparseMatrix

Scaled sparse matrix

A * B

Full Usage: A * B

Parameters:
Returns: SparseMatrix

A : SparseMatrix
B : SparseMatrix
Returns: SparseMatrix

A + B

Full Usage: A + B

Parameters:
Returns: SparseMatrix A + B

C = A + B

A : SparseMatrix

first matrix

B : SparseMatrix

another matrix

Returns: SparseMatrix

A + B

A - B

Full Usage: A - B

Parameters:
Returns: SparseMatrix The result A - B

Matrix subtraction for a sparse matrix

A : SparseMatrix

The matrix from which to subtract

B : SparseMatrix

The matrix to subtract

Returns: SparseMatrix

The result A - B

SparseMatrix.Identity(m, n)

Full Usage: SparseMatrix.Identity(m, n)

Parameters:
    m : int - Row dimension
    n : int - Column dimension

Returns: SparseMatrix An m x n sparse identity matrix

Identity matrix in sparse form

m : int

Row dimension

n : int

Column dimension

Returns: SparseMatrix

An m x n sparse identity matrix