Interface ISolver<T>
Describes a linear system of equations. It tracks permutations of the equations and the variables.
Inherited Members
Namespace: SpiceSharp.Algebra
Assembly: SpiceSharp.dll
Syntax
public interface ISolver<T> : IParameterSetCollection, IParameterSet
Type Parameters
Name | Description |
---|---|
T | The base type. |
Properties
Degeneracy
Gets or sets the degeneracy of the matrix. For example, specifying 1 will let the solver know that one equation is expected to be linearly dependent on the others.
Declaration
int Degeneracy { get; set; }
Property Value
Type | Description |
---|---|
int | The degeneracy. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if the value is negative. |
IsFactored
Gets a value indicating whether this solver has been factored. A solver needs to be factored becore it can solve for a solution.
Declaration
bool IsFactored { get; }
Property Value
Type | Description |
---|---|
bool |
|
this[MatrixLocation]
Gets or sets the value of the matrix at the specified location.
Declaration
T this[MatrixLocation location] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
MatrixLocation | location | The location. |
Property Value
Type | Description |
---|---|
T | The value of the matrix element. |
this[int]
Gets or sets the value of the right hand side vector at the specified row.
Declaration
T this[int row] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
int | row | The row. |
Property Value
Type | Description |
---|---|
T | The value of the right hand side vector. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if |
this[int, int]
Gets or sets the value of the matrix at the specified row and column.
Declaration
T this[int row, int column] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
int | row | The row. |
int | column | The column. |
Property Value
Type | Description |
---|---|
T | The value. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if |
Size
Gets the size of the solver. This is the total number of equations.
Declaration
int Size { get; }
Property Value
Type | Description |
---|---|
int | The size. |
Methods
BackwardSubstitute(IVector<T>)
Applies backward substitution on a factored matrix and the intermediate vector.
Declaration
void BackwardSubstitute(IVector<T> solution)
Parameters
Type | Name | Description |
---|---|---|
IVector<T> | solution | The solution vector. |
BackwardSubstituteTransposed(IVector<T>)
Applies backward substitution on the adjoint matrix and the intermediate vector.
Declaration
void BackwardSubstituteTransposed(IVector<T> solution)
Parameters
Type | Name | Description |
---|---|---|
IVector<T> | solution | The solution vector. |
Clear()
Clears the solver of any elements. The size of the solver becomes 0.
Declaration
void Clear()
Remarks
The method is only redefined here to avoid ambiguity issues between IMatrix<T> and IVector<T>.
ComputeDegenerateContribution(int)
Computes a contribution for degenerate solvers (Degeneracy is larger than 0). Used when solving submatrices separately.
Declaration
T ComputeDegenerateContribution(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index. |
Returns
Type | Description |
---|---|
T | Returns the contribution. |
ComputeDegenerateContributionTransposed(int)
Computes a contribution of the transposed solving for degenerate solvers (Degeneracy is larger than 0). Used when solving submatrices separately.
Declaration
T ComputeDegenerateContributionTransposed(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index. |
Returns
Type | Description |
---|---|
T | Returns the contribution. |
Factor()
Factor the equation matrix and right hand side vector. This method can save time when factoring similar matrices in succession.
Declaration
bool Factor()
Returns
Type | Description |
---|---|
bool |
|
ForwardSubstitute(IVector<T>)
Applies forward substitution on a factored matrix and right-hand side vector.
Declaration
void ForwardSubstitute(IVector<T> solution)
Parameters
Type | Name | Description |
---|---|---|
IVector<T> | solution | The solution vector. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
AlgebraException | Thrown if the solver is not factored yet. |
ArgumentException | Thrown if |
ForwardSubstituteTransposed(IVector<T>)
Applies forward substitution on the adjoint matrix and right-hand side vector.
Declaration
void ForwardSubstituteTransposed(IVector<T> solution)
Parameters
Type | Name | Description |
---|---|---|
IVector<T> | solution | The solution vector. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
AlgebraException | Thrown if the solver is not factored yet. |
ArgumentException | Thrown if |
Reset()
Clears all matrix and vector elements.
Declaration
void Reset()
Remarks
This method is only redefined here to avoid ambiguity issues between IMatrix<T> and IVector<T>.