Class Translation
This class can map external to internal indices and vice-versa.
Inherited Members
Namespace: SpiceSharp.Algebra.Solve
Assembly: SpiceSharp.dll
Syntax
public class Translation
Constructors
Translation()
Initializes a new instance of the Translation class.
Declaration
public Translation()
Translation(int)
Initializes a new instance of the Translation class.
Declaration
public Translation(int size)
Parameters
Type | Name | Description |
---|---|---|
int | size | The number of translations to be allocated. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if |
Properties
this[int]
Gets the internal index from an external index.
Declaration
public int this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
int | index | The external index. |
Property Value
Type | Description |
---|---|
int | The internal index. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if |
Length
Gets the current length of the translation vector.
Declaration
public int Length { get; }
Property Value
Type | Description |
---|---|
int | The length of the translation vector. |
Methods
Clear()
Clears all translations.
Declaration
public void Clear()
Reverse(int)
Gets the external index from an internal index.
Declaration
public int Reverse(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The internal index |
Returns
Type | Description |
---|---|
int | The external index. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if |
Scramble<T>(IVector<T>, IVector<T>)
Scramble a vector according to the map.
Declaration
public void Scramble<T>(IVector<T> source, IVector<T> target)
Parameters
Type | Name | Description |
---|---|---|
IVector<T> | source | The source vector. |
IVector<T> | target | The target vector. |
Type Parameters
Name | Description |
---|---|
T | The value type of the vector. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if |
ArgumentNullException | Thrown if |
Swap(int, int)
Swaps two (internal) indices, such that the external indices still point to the right ones.
Declaration
public void Swap(int index1, int index2)
Parameters
Type | Name | Description |
---|---|---|
int | index1 | First index. |
int | index2 | Second index. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if |
Unscramble<T>(T[], IVector<T>)
Unscramble a vector. The first index of the array is ignored.
Declaration
public void Unscramble<T>(T[] source, IVector<T> target)
Parameters
Type | Name | Description |
---|---|---|
T[] | source | The source vector. |
IVector<T> | target | The target vector. |
Type Parameters
Name | Description |
---|---|
T | The value type of the vector. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if |
ArgumentNullException | Thrown if |