Show / Hide Table of Contents

Class Markowitz<T>

A search strategy based on methods outlined by Markowitz.

Inheritance
object
ParameterSet
Markowitz<T>
Implements
IParameterSet
ICloneable<Markowitz<T>>
Inherited Members
ParameterSet.SetParameter<P>(string, P)
ParameterSet.TrySetParameter<P>(string, P)
ParameterSet.GetProperty<P>(string)
ParameterSet.TryGetProperty<P>(string, out P)
ParameterSet.CreateParameterSetter<P>(string)
ParameterSet.CreatePropertyGetter<P>(string)
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: SpiceSharp.Algebra.Solve
Assembly: SpiceSharp.dll
Syntax
public class Markowitz<T> : ParameterSet, IParameterSet, ICloneable<Markowitz<T>>
Type Parameters
Name Description
T

The base value type.

Constructors

Markowitz(Func<T, double>)

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

Declaration
public Markowitz(Func<T, double> magnitude)
Parameters
Type Name Description
Func<T, double> magnitude

The function for turning elements into a scalar.

Exceptions
Type Condition
ArgumentNullException

Thrown if magnitude is null.

Properties

AbsolutePivotThreshold

Gets or sets the absolute threshold for choosing a pivot.

Declaration
[ParameterName("pivtol")]
[ParameterInfo("The absolute threshold for validating pivots")]
[GreaterThanOrEquals(0)]
[Finite]
public double AbsolutePivotThreshold { get; set; }
Property Value
Type Description
double

The absolute pivot threshold.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown if the value is negative.

Magnitude

Gets the magnitude.

Declaration
public Func<T, double> Magnitude { get; }
Property Value
Type Description
Func<T, double>

The magnitude.

RelativePivotThreshold

Gets or sets the relative threshold for choosing a pivot.

Declaration
[ParameterName("pivrel")]
[ParameterInfo("The relative threshold for validating pivots")]
[GreaterThan(0)]
[Finite]
public double RelativePivotThreshold { get; set; }
Property Value
Type Description
double

The relative pivot threshold.

Exceptions
Type Condition
ArgumentOutOfRangeException

Thrown if the value is not greater than 0.

Singletons

Gets the number of singletons.

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

Strategies

Gets the strategies used for finding a pivot.

Declaration
public Collection<MarkowitzSearchStrategy<T>> Strategies { get; }
Property Value
Type Description
Collection<MarkowitzSearchStrategy<T>>

The strategies.

Methods

Clear()

Clears the pivot strategy.

Declaration
public void Clear()

Clone()

Clones the instance.

Declaration
public Markowitz<T> Clone()
Returns
Type Description
Markowitz<T>

The cloned instance.

ColumnCount(int)

Gets the Markowitz column counts.

Declaration
public int ColumnCount(int column)
Parameters
Type Name Description
int column
Returns
Type Description
int
Exceptions
Type Condition
IndexOutOfRangeException

Thrown if column is negative or greater than the number of Markowitz columns.

CreateFillin(ISparseMatrix<T>, ISparseMatrixElement<T>)

Notifies the strategy that a fill-in has been created

Declaration
public void CreateFillin(ISparseMatrix<T> matrix, ISparseMatrixElement<T> fillin)
Parameters
Type Name Description
ISparseMatrix<T> matrix

The matrix.

ISparseMatrixElement<T> fillin

The fill-in.

Exceptions
Type Condition
ArgumentNullException

Thrown if matrix or fillin is null.

FindPivot(ISparseMatrix<T>, int, int)

Find a pivot in the matrix.

Declaration
public Pivot<ISparseMatrixElement<T>> FindPivot(ISparseMatrix<T> matrix, int eliminationStep, int max)
Parameters
Type Name Description
ISparseMatrix<T> matrix

The matrix.

int eliminationStep

The current elimination step.

int max

The maximum row/column index of any pivot.

Returns
Type Description
Pivot<ISparseMatrixElement<T>>

The pivot information.

Remarks

The pivot should be searched for in the submatrix towards the right and down of the current diagonal at row/column eliminationStep. This pivot element will be moved to the diagonal for this elimination step.

Exceptions
Type Condition
ArgumentNullException

Thrown if matrix is null.

ArgumentOutOfRangeException

Thrown if eliminationStep or max not 1 or higher, or eliminationStep is higher than max.

Initialize(IMatrix<T>)

Initializes the pivot searching algorithm.

Declaration
public void Initialize(IMatrix<T> matrix)
Parameters
Type Name Description
IMatrix<T> matrix

The matrix to use for initialization.

Exceptions
Type Condition
ArgumentNullException

Thrown if matrix is null.

IsValidPivot(ISparseMatrixElement<T>, int)

This method will check whether or not a pivot element is valid or not. It checks for the submatrix right/below of the pivot.

Declaration
public bool IsValidPivot(ISparseMatrixElement<T> pivot, int max)
Parameters
Type Name Description
ISparseMatrixElement<T> pivot

The pivot candidate.

int max

The maximum index that a pivot can have.

Returns
Type Description
bool

True if the pivot can be used.

Exceptions
Type Condition
ArgumentNullException

Thrown if pivot is null.

MovePivot(ISparseMatrix<T>, ISparseVector<T>, ISparseMatrixElement<T>, int)

Move the pivot to the diagonal for this elimination step.

Declaration
public void MovePivot(ISparseMatrix<T> matrix, ISparseVector<T> rhs, ISparseMatrixElement<T> pivot, int eliminationStep)
Parameters
Type Name Description
ISparseMatrix<T> matrix

The matrix.

ISparseVector<T> rhs

The right-hand side vector.

ISparseMatrixElement<T> pivot

The pivot element.

int eliminationStep

The elimination step.

Remarks

This is done by swapping the rows and columns of the diagonal and that of the pivot.

Exceptions
Type Condition
ArgumentNullException

Thrown if matrix, rhs or pivot is null.

Product(int)

Gets the Markowitz products.

Declaration
public int Product(int index)
Parameters
Type Name Description
int index
Returns
Type Description
int
Exceptions
Type Condition
IndexOutOfRangeException

Thrown if index is negative or greater than the number of Markowitz size.

RowCount(int)

Gets the Markowitz row counts.

Declaration
public int RowCount(int row)
Parameters
Type Name Description
int row
Returns
Type Description
int
Exceptions
Type Condition
IndexOutOfRangeException

Thrown if row is negative or greater than the number of Markowitz rows.

Setup(ISparseMatrix<T>, ISparseVector<T>, int, int)

Setup the pivot strategy.

Declaration
public void Setup(ISparseMatrix<T> matrix, ISparseVector<T> rhs, int eliminationStep, int max)
Parameters
Type Name Description
ISparseMatrix<T> matrix

The matrix.

ISparseVector<T> rhs

The right-hand side vector.

int eliminationStep

The current elimination step.

int max

The maximum row/column index.

Exceptions
Type Condition
ArgumentNullException

Thrown if matrix or rhs is null.

Update(ISparseMatrix<T>, ISparseMatrixElement<T>, int)

Update the strategy after the pivot was moved.

Declaration
public void Update(ISparseMatrix<T> matrix, ISparseMatrixElement<T> pivot, int limit)
Parameters
Type Name Description
ISparseMatrix<T> matrix

The matrix.

ISparseMatrixElement<T> pivot

The pivot element.

int limit

The maximum row/column for pivots.

Exceptions
Type Condition
ArgumentNullException

Thrown if matrix or pivot is null.

Implements

IParameterSet
ICloneable<T>

Extension Methods

Utility.ThrowIfNull<T>(T, string)
Documentation.ParameterValues<T>(IParameterSet, bool)
Documentation.Parameters(IParameterSet)
In this article
Back to top Generated by DocFX