7 instantiations of NIndex
System.Numerics.Tensors (7)
System\NIndex.cs (5)
63
public static NIndex Start => new
NIndex
((nint)0);
66
public static NIndex End => new
NIndex
((nint)~0);
78
return new
NIndex
(value);
91
return new
NIndex
(~value);
159
public static implicit operator NIndex(Index value) => new
NIndex
(value);
System\Numerics\Tensors\netcore\Tensor.cs (2)
482
ranges[i] = new NRange(start[i], new
NIndex
(0, fromEnd: true));
498
ranges[i] = new NRange(startIndex[i], new
NIndex
(0, fromEnd: true));
62 references to NIndex
System.Numerics.Tensors (62)
System\NIndex.cs (28)
18
public 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>
63
public static
NIndex
Start => new NIndex((nint)0);
65
/// <summary>Creates an <see cref="
NIndex
"/> that points beyond the last element.</summary>
66
public static
NIndex
End => new NIndex((nint)~0);
68
/// <summary>Creates an <see cref="
NIndex
"/> from the start at the specified position.</summary>
71
public static
NIndex
FromStart(nint value)
84
public 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.
146
public 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>
150
public bool Equals(
NIndex
other) => _value == other._value;
156
public static implicit operator
NIndex
(nint value) => FromStart(value);
159
public static implicit operator
NIndex
(Index value) => new NIndex(value);
161
/// <summary>Converts an <see cref="
NIndex
"/> to an <see cref="Index"/>.</summary>
162
public 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>
165
public static explicit operator checked Index(
NIndex
value) => new Index(checked((int)value.Value), value.IsFromEnd);
System\NRange.cs (15)
22
public
NIndex
Start { get; }
25
public
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>
30
public 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>
93
public 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>
96
public static NRange EndAt(
NIndex
end) => new NRange(
NIndex
.Start, end);
99
public static NRange All => new NRange(
NIndex
.Start,
NIndex
.End);
System\Numerics\Tensors\netcore\IReadOnlyTensor.cs (3)
54
T this[params scoped ReadOnlySpan<
NIndex
> indexes] { get; }
80
ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(params scoped ReadOnlySpan<
NIndex
> startIndex);
133
TSelf Slice(params scoped ReadOnlySpan<
NIndex
> startIndex);
System\Numerics\Tensors\netcore\ITensor.cs (2)
85
new T this[params scoped ReadOnlySpan<
NIndex
> indexes] { get; set; }
111
TensorSpan<T> AsTensorSpan(params scoped ReadOnlySpan<
NIndex
> startIndex);
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan.cs (3)
210
public ReadOnlyTensorSpan(Array? array, scoped ReadOnlySpan<
NIndex
> startIndex, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides)
347
public ref readonly T this[params scoped ReadOnlySpan<
NIndex
> indexes]
655
public ReadOnlyTensorSpan<T> Slice(params scoped ReadOnlySpan<
NIndex
> indexes)
System\Numerics\Tensors\netcore\Tensor.cs (6)
214
public ref T this[params scoped ReadOnlySpan<
NIndex
> indexes] => ref AsTensorSpan()[indexes];
280
T ITensor<Tensor<T>, T>.this[params ReadOnlySpan<
NIndex
> indexes]
310
T IReadOnlyTensor<Tensor<T>, T>.this[params ReadOnlySpan<
NIndex
> indexes] => AsReadOnlyTensorSpan()[indexes];
410
public TensorSpan<T> AsTensorSpan(params scoped ReadOnlySpan<
NIndex
> startIndex) => AsTensorSpan().Slice(startIndex);
437
public ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(params scoped ReadOnlySpan<
NIndex
> startIndex) => AsTensorSpan().Slice(startIndex);
493
public Tensor<T> Slice(params ReadOnlySpan<
NIndex
> startIndex)
System\Numerics\Tensors\netcore\TensorSpan.cs (3)
212
public TensorSpan(Array? array, scoped ReadOnlySpan<
NIndex
> startIndex, scoped ReadOnlySpan<nint> lengths, scoped ReadOnlySpan<nint> strides)
349
public ref T this[params scoped ReadOnlySpan<
NIndex
> indexes]
689
public TensorSpan<T> Slice(params scoped ReadOnlySpan<
NIndex
> indexes)
System\Numerics\Tensors\netcore\TensorSpanHelpers.cs (2)
149
public static nint ComputeStartOffsetSystemArray(Array array, ReadOnlySpan<
NIndex
> indexes)
175
public static nint ComputeLinearIndex(ReadOnlySpan<
NIndex
> indexes, ReadOnlySpan<nint> strides, ReadOnlySpan<nint> lengths)