7 instantiations of NIndex
System.Numerics.Tensors (7)
System\NIndex.cs (5)
63public static NIndex Start => new NIndex((nint)0); 66public static NIndex End => new NIndex((nint)~0); 78return new NIndex(value); 91return new NIndex(~value); 159public static implicit operator NIndex(Index value) => new NIndex(value);
System\Numerics\Tensors\netcore\Tensor.cs (2)
483ranges[i] = new NRange(start[i], new NIndex(0, fromEnd: true)); 499ranges[i] = new NRange(startIndex[i], new NIndex(0, fromEnd: true));
62 references to NIndex
System.Numerics.Tensors (62)
System\NIndex.cs (28)
18public readonly struct NIndex : IEquatable<NIndex> 22/// <summary>Constructs an <see cref="NIndex"/> using an index value and a Boolean that indicates if the <see cref="NIndex"/> is from the start or from the end.</summary> 42/// <summary>Constructs an <see cref="NIndex"/> from an <see cref="Index"/>.</summary> 43/// <param name="index">The <see cref="Index"/> to create the <see cref="NIndex"/> from.</param> 62/// <summary>Creates an <see cref="NIndex"/> that points at the first element.</summary> 63public static NIndex Start => new NIndex((nint)0); 65/// <summary>Creates an <see cref="NIndex"/> that points beyond the last element.</summary> 66public static NIndex End => new NIndex((nint)~0); 68/// <summary>Creates an <see cref="NIndex"/> from the start at the specified position.</summary> 71public static NIndex FromStart(nint value) 84public static NIndex FromEnd(nint value) 95/// Converts the <see cref="NIndex"/> to an <see cref="Index"/>. 101/// Converts the <see cref="NIndex"/> to an <see cref="Index"/> without doing bounds checks. 106/// <summary>Gets the <see cref="NIndex"/> value.</summary> 118/// <summary>Gets a value that indicates whether the <see cref="NIndex"/> is from the start or the end.</summary> 126/// It is expected <see cref="NIndex"/> will be used with collections that always have a non-negative length/count. If the returned offset is negative and 127/// then used to <see cref="NIndex"/> a collection, an <see cref="ArgumentOutOfRangeException" /> is thrown, which has the same effect as the validation. 146public override bool Equals([NotNullWhen(true)] object? value) => value is NIndex other && _value == other._value; 148/// <summary>Compares the current <see cref="NIndex"/> object to another <see cref="NIndex"/> object for equality.</summary> 150public bool Equals(NIndex other) => _value == other._value; 156public static implicit operator NIndex(nint value) => FromStart(value); 159public static implicit operator NIndex(Index value) => new NIndex(value); 161/// <summary>Converts an <see cref="NIndex"/> to an <see cref="Index"/>.</summary> 162public static explicit operator Index(NIndex value) => new Index((int)value.Value, value.IsFromEnd); 164/// <summary>Converts an <see cref="NIndex"/> to an <see cref="Index"/>.</summary> 165public static explicit operator checked Index(NIndex value) => new Index(checked((int)value.Value), value.IsFromEnd);
System\NRange.cs (15)
22public NIndex Start { get; } 25public NIndex End { get; } 27/// <summary>Constructs an <see cref="NRange"/> object using the start and end <see cref="NIndex"/>.</summary> 28/// <param name="start">The inclusive start <see cref="NIndex"/> of the <see cref="NRange"/>.</param> 29/// <param name="end">The exclusive end <see cref="NIndex"/> of the <see cref="NRange"/>.</param> 30public NRange(NIndex start, NIndex end) 92/// <summary>Creates an <see cref="NRange"/> object starting from start <see cref="NIndex"/> to the end of the collection.</summary> 93public static NRange StartAt(NIndex start) => new NRange(start, NIndex.End); 95/// <summary>Creates an <see cref="NRange"/> object starting from first element in the collection to the end <see cref="NIndex"/>.</summary> 96public static NRange EndAt(NIndex end) => new NRange(NIndex.Start, end); 99public static NRange All => new NRange(NIndex.Start, NIndex.End);
System\Numerics\Tensors\netcore\IReadOnlyTensor.cs (3)
54T this[params scoped ReadOnlySpan<NIndex> indexes] { get; } 80ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(params scoped ReadOnlySpan<NIndex> startIndex); 133TSelf Slice(params scoped ReadOnlySpan<NIndex> startIndex);
System\Numerics\Tensors\netcore\ITensor.cs (2)
85new T this[params scoped ReadOnlySpan<NIndex> indexes] { get; set; } 111TensorSpan<T> AsTensorSpan(params scoped ReadOnlySpan<NIndex> startIndex);
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan.cs (3)
197public ReadOnlyTensorSpan(Array? array, scoped ReadOnlySpan<NIndex> startIndex, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides) 330public ref readonly T this[params scoped ReadOnlySpan<NIndex> indexes] 638public ReadOnlyTensorSpan<T> Slice(params scoped ReadOnlySpan<NIndex> indexes)
System\Numerics\Tensors\netcore\Tensor.cs (6)
215public ref T this[params scoped ReadOnlySpan<NIndex> indexes] => ref AsTensorSpan()[indexes]; 281T ITensor<Tensor<T>, T>.this[params ReadOnlySpan<NIndex> indexes] 311T IReadOnlyTensor<Tensor<T>, T>.this[params ReadOnlySpan<NIndex> indexes] => AsReadOnlyTensorSpan()[indexes]; 411public TensorSpan<T> AsTensorSpan(params scoped ReadOnlySpan<NIndex> startIndex) => AsTensorSpan().Slice(startIndex); 438public ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(params scoped ReadOnlySpan<NIndex> startIndex) => AsTensorSpan().Slice(startIndex); 494public Tensor<T> Slice(params ReadOnlySpan<NIndex> startIndex)
System\Numerics\Tensors\netcore\TensorSpan.cs (3)
201public TensorSpan(Array? array, scoped ReadOnlySpan<NIndex> startIndex, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides) 334public ref T this[params scoped ReadOnlySpan<NIndex> indexes] 674public TensorSpan<T> Slice(params scoped ReadOnlySpan<NIndex> indexes)
System\Numerics\Tensors\netcore\TensorSpanHelpers.cs (2)
149public static nint ComputeStartOffsetSystemArray(Array array, ReadOnlySpan<NIndex> indexes) 175public static nint ComputeLinearIndex(ReadOnlySpan<NIndex> indexes, ReadOnlySpan<nint> strides, ReadOnlySpan<nint> lengths)