Show / Hide Table of Contents

Class Translation

This class can map external to internal indices and vice-versa.

Inheritance
object
Translation
Inherited Members
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 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 size is negative.

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 index is negative.

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 index is negative.

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 target does not have the same length as source.

ArgumentNullException

Thrown if source or target is null.

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 index1 or index2 is negative.

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 target (including the trashcan element) does not have the same number of elements as source.

ArgumentNullException

Thrown if source or target is null.

Extension Methods

Utility.ThrowIfNull<T>(T, string)
In this article
Back to top Generated by DocFX