Struct EinsumPath
- Namespace
- NumSharp
- Assembly
- NumSharp.dll
The contraction path returned by einsum_path(string, NDArray[]) — NumPy's
['einsum_path', (1, 2), (0, 1)] list expressed as a value.
public readonly struct EinsumPath : IEquatable<EinsumPath>, IReadOnlyList<int[]>, IReadOnlyCollection<int[]>, IEnumerable<int[]>, IEnumerable
- Implements
-
IReadOnlyList<int[]>IEnumerable<int[]>
- Inherited Members
Remarks
This stands in for the FIRST element of NumPy's einsum_path return tuple: a Python
list whose head is the string marker 'einsum_path' and whose tail is one integer
tuple per contraction step, each naming the operand positions contracted at that step. The
head marker is implicit here — Steps and the indexer expose the contraction
tuples directly, and ToString() renders the full NumPy list (marker included).
A value of this type round-trips into optimize: on both
einsum_path(string, NDArray[], object) and
np.einsum(string, NDArray[], NDArray, NPTypeCode?, char, string, object),
exactly as NumPy accepts path_info[0] back as an explicit path.
Constructors
EinsumPath(int[][])
public EinsumPath(int[][] steps)
Parameters
stepsint[][]One entry per contraction step; each is the operand positions contracted.
Fields
Marker
NumPy's list marker, path[0].
public const string Marker = "einsum_path"
Field Value
Properties
Count
The number of contraction steps (the marker is NOT counted).
public int Count { get; }
Property Value
this[int]
The index-th contraction step (the marker is NOT indexed).
public int[] this[int index] { get; }
Parameters
indexint
Property Value
- int[]
Steps
The contraction steps — NumPy's path[1:] (the marker excluded).
public IReadOnlyList<int[]> Steps { get; }
Property Value
- IReadOnlyList<int[]>
Methods
Equals(EinsumPath)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(EinsumPath other)
Parameters
otherEinsumPathAn object to compare with this object.
Returns
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<int[]> GetEnumerator()
Returns
- IEnumerator<int[]>
An enumerator that can be used to iterate through the collection.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToList()
NumPy's list form: {"einsum_path", int[]{1,2}, int[]{0,1}} — the marker string
followed by each contraction tuple, for callers that want the raw heterogeneous list.
public object[] ToList()
Returns
- object[]
ToString()
Renders NumPy's list, e.g. ['einsum_path', (1, 2), (0, 1)].
public override string ToString()