Show / Hide Table of Contents

Class ParallelSolver<T>

An ISparseSolver<T> that only allows direct access to an element once. All subsequent calls will be through a local element.

Inheritance
object
ParallelSolver<T>
Implements
ISparsePivotingSolver<T>
ISparseSolver<T>
IPivotingSolver<ISparseMatrix<T>, ISparseVector<T>, T>
ISolver<T>
IParameterSetCollection
IParameterSet
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: SpiceSharp.Components.ParallelComponents
Assembly: SpiceSharp.dll
Syntax
public class ParallelSolver<T> : ISparsePivotingSolver<T>, ISparseSolver<T>, IPivotingSolver<ISparseMatrix<T>, ISparseVector<T>, T>, ISolver<T>, IParameterSetCollection, IParameterSet
Type Parameters
Name Description
T

The value type.

Constructors

ParallelSolver(ISparsePivotingSolver<T>)

Initializes a new instance of the ParallelSolver<T> class.

Declaration
public ParallelSolver(ISparsePivotingSolver<T> parent)
Parameters
Type Name Description
ISparsePivotingSolver<T> parent

The parent.

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
public int Degeneracy { get; set; }
Property Value
Type Description
int

The degeneracy.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown if the value is negative.

ArgumentException

Thrown when trying to write in a parallel solver.

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
public bool IsFactored { get; }
Property Value
Type Description
bool

true if this solver is factored; otherwise, false.

NeedsReordering

Gets or sets a value indicating whether the solver needs to be reordered all the way from the start.

Declaration
public bool NeedsReordering { get; set; }
Property Value
Type Description
bool

true if the solver needs reordering; otherwise, false.

Remarks

If this flag is false, the solver will still reorder when using OrderAndFactor(), but it will try to stay away from reordering as long as possible. This flag will force the solver to immediately start reordering.

Exceptions
Type Condition
ArgumentException

Thrown when trying to write in a parallel solver.

PivotSearchReduction

Gets or sets the pivot search reduction. This makes sure that pivots cannot be chosen from the last N rows. The default, 0, lets the pivot strategy to choose from the whole matrix.

Declaration
public int PivotSearchReduction { get; set; }
Property Value
Type Description
int

The pivot search reduction.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown if the value is negative.

ArgumentException

Thrown when trying to write in a parallel solver.

Size

Gets the size of the solver. This is the total number of equations.

Declaration
public int Size { get; }
Property Value
Type Description
int

The size.

Methods

Apply()

Applies all bridge elements.

Declaration
public void Apply()

CreateParameterSetter<P>(string)

Creates an action that can set the parameter of the specified type and with the specified name.

Declaration
public Action<P> CreateParameterSetter<P>(string name)
Parameters
Type Name Description
string name

The name of the parameter.

Returns
Type Description
Action<P>

An action that can set the parameter value, or null if the parameter could not be found.

Type Parameters
Name Description
P

The parameter value type.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

CreatePropertyGetter<P>(string)

Creates a function that can get the value of a property of the specified type and with the specified name.

Declaration
public Func<P> CreatePropertyGetter<P>(string name)
Parameters
Type Name Description
string name

The name of the property.

Returns
Type Description
Func<P>

A function that can get the property value, or null if the property could not be found.

Type Parameters
Name Description
P

The property value type.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

FindElement(MatrixLocation)

Finds the element at the specified location in the matrix.

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

The location.

Returns
Type Description
Element<T>

The element if it exists; otherwise null.

FindElement(int)

Finds the element at the specified position in the right-hand side vector.

Declaration
public Element<T> FindElement(int row)
Parameters
Type Name Description
int row

The row index.

Returns
Type Description
Element<T>

The element if it exists; otherwise null.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown if row is negative.

GetElement(MatrixLocation)

Gets the element at the specified location in the matrix. A new element is created if it doesn't exist yet.

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

The location.

Returns
Type Description
Element<T>

The matrix element.

GetElement(int)

Gets the element at the specified position in the right-hand side vector. A new element is created if it doesn't exist yet.

Declaration
public Element<T> GetElement(int row)
Parameters
Type Name Description
int row

The row.

Returns
Type Description
Element<T>

The vector element.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown if row is negative.

GetProperty<P>(string)

Gets the value of a property of the specified type and with the specified name.

Declaration
public P GetProperty<P>(string name)
Parameters
Type Name Description
string name

The name of the property.

Returns
Type Description
P

The value of the property.

Type Parameters
Name Description
P

The property value type.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

ParameterNotFoundException

Thrown if a parameter by the specified name could not be found.

RemoveElement(MatrixLocation)

Removes a matrix element at the specified location.

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

The location.

Returns
Type Description
bool

true if the element was removed; otherwise, false.

RemoveElement(int)

Removes a right-hand side vector element.

Declaration
public bool RemoveElement(int index)
Parameters
Type Name Description
int index
Returns
Type Description
bool

true if the element was removed; otherwise, false.

Reset()

Clears all matrix and vector elements.

Declaration
public void Reset()

SetParameter<P>(string, P)

Sets a parameter in the parameter set of the specified type and with the specified name.

Declaration
public void SetParameter<P>(string name, P value)
Parameters
Type Name Description
string name

The name of the parameter.

P value

The value that the parameter should be set to.

Type Parameters
Name Description
P

The parameter value type.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

ParameterNotFoundException

Thrown if a parameter by the specified name could not be found.

TryGetProperty<P>(string, out P)

Tries to get the value of a property of the specified type and with the specified name.

Declaration
public bool TryGetProperty<P>(string name, out P value)
Parameters
Type Name Description
string name

The name of the property.

P value

The value of the property if the property was found.

Returns
Type Description
bool

true if the property was found and returned; otherwise, false.

Type Parameters
Name Description
P

The property value type.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

TrySetParameter<P>(string, P)

Tries to set a parameter in the parameter set of the specified type and with the specified name.

Declaration
public bool TrySetParameter<P>(string name, P value)
Parameters
Type Name Description
string name

The name of the parameter.

P value

The value that the parameter should be set to.

Returns
Type Description
bool

true if a parameter was found and set succesfully; otherwise, false.

Type Parameters
Name Description
P

The parameter value type.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

Implements

ISparsePivotingSolver<T>
ISparseSolver<T>
IPivotingSolver<M, V, T>
ISolver<T>
IParameterSetCollection
IParameterSet

Extension Methods

Utility.ThrowIfNull<T>(T, string)
Documentation.ParameterValues<T>(IParameterSet, bool)
Documentation.Parameters(IParameterSet)
Documentation.ParameterValues<T>(IParameterSetCollection, bool)
Documentation.Parameters(IParameterSetCollection)

See Also

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