Show / Hide Table of Contents

Interface ISparseMatrix<T>

Describes a sparse matrix that return elements that have links to neighboring non-zero elements.

Inherited Members
IMatrix<T>.Size
IMatrix<T>.this[int, int]
IMatrix<T>.this[MatrixLocation]
IMatrix<T>.SwapRows(int, int)
IMatrix<T>.SwapColumns(int, int)
IMatrix<T>.Reset()
IMatrix<T>.Clear()
Namespace: SpiceSharp.Algebra
Assembly: SpiceSharp.dll
Syntax
public interface ISparseMatrix<T> : IMatrix<T>
Type Parameters
Name Description
T

Properties

ElementCount

Gets the number of elements in the matrix.

Declaration
int ElementCount { get; }
Property Value
Type Description
int

The element count.

Methods

FindDiagonalElement(int)

Finds the ISparseMatrixElement<T> on the diagonal.

Declaration
ISparseMatrixElement<T> FindDiagonalElement(int index)
Parameters
Type Name Description
int index

The index.

Returns
Type Description
ISparseMatrixElement<T>

The matrix element if it exists; otherwise null.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown if index is negative.

FindElement(MatrixLocation)

Finds a pointer to the matrix element at the specified row and column. If the element doesn't exist, null is returned.

Declaration
Element<T> FindElement(MatrixLocation location)
Parameters
Type Name Description
MatrixLocation location

The matrix location.

Returns
Type Description
Element<T>

The matrix element if it exists; otherwise null.

GetElement(MatrixLocation)

Gets a pointer to the matrix element at the specified row and column. If the element doesn't exist, it is created.

Declaration
Element<T> GetElement(MatrixLocation location)
Parameters
Type Name Description
MatrixLocation location

The matrix location.

Returns
Type Description
Element<T>

The matrix element.

GetFirstInColumn(int)

Gets the first non-default ISparseMatrixElement<T> in the specified column.

Declaration
ISparseMatrixElement<T> GetFirstInColumn(int column)
Parameters
Type Name Description
int column

The column index.

Returns
Type Description
ISparseMatrixElement<T>

The matrix element.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown if column is negative.

GetFirstInRow(int)

Gets the first non-default ISparseMatrixElement<T> in the specified row.

Declaration
ISparseMatrixElement<T> GetFirstInRow(int row)
Parameters
Type Name Description
int row

The row index.

Returns
Type Description
ISparseMatrixElement<T>

The matrix element.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown if row is negative.

GetLastInColumn(int)

Gets the last non-default ISparseMatrixElement<T> in the specified column.

Declaration
ISparseMatrixElement<T> GetLastInColumn(int column)
Parameters
Type Name Description
int column

The column index.

Returns
Type Description
ISparseMatrixElement<T>

The matrix element.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown if column is negative.

GetLastInRow(int)

Gets the last non-default ISparseMatrixElement<T> in the specified row.

Declaration
ISparseMatrixElement<T> GetLastInRow(int row)
Parameters
Type Name Description
int row

The row index.

Returns
Type Description
ISparseMatrixElement<T>

The matrix element.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown if row is negative.

RemoveElement(MatrixLocation)

Removes a matrix element at the specified row and column. If the element doesn't exist, this method returns false.

Declaration
bool RemoveElement(MatrixLocation location)
Parameters
Type Name Description
MatrixLocation location

The location.

Returns
Type Description
bool

true if the element was removed; otherwise, false.

Extension Methods

Utility.ThrowIfNull<T>(T, string)

See Also

IMatrix<T>
In this article
Back to top Generated by DocFX