9 instantiations of NRange
System.Numerics.Tensors (9)
System\Buffers\NRange.cs (4)
92
public static NRange StartAt(NIndex start) => new
NRange
(start, NIndex.End);
95
public static NRange EndAt(NIndex end) => new
NRange
(NIndex.Start, end);
98
public static NRange All => new
NRange
(NIndex.Start, NIndex.End);
127
public static implicit operator NRange(Range range) => new
NRange
(range.Start, range.End);
System\Numerics\Tensors\netcore\Tensor.cs (3)
1756
srcIndexes[dimension] = new
NRange
(i - 1, i);
1757
dstIndexes[dimension] = new
NRange
(tensor.Lengths[dimension] - i, tensor.Lengths[dimension] - i + 1);
1858
sliceDims[(int)dimension] = new
NRange
(start, start + splitLength);
System\Numerics\Tensors\netcore\TensorShape.cs (2)
545
ranges[dimension] = new
NRange
(curRange.Start.Value + 1, curRange.End.Value + 1);
558
ranges[i - 1] = new
NRange
(ranges[i - 1].Start.Value + 1, ranges[i - 1].End.Value + 1);
75 references to NRange
System.Numerics.Tensors (75)
System\Buffers\NRange.cs (28)
18
public readonly struct NRange : IEquatable<
NRange
>
26
/// <summary>Constructs an <see cref="
NRange
"/> object using the start and end <see cref="NIndex"/>.</summary>
27
/// <param name="start">The inclusive start <see cref="NIndex"/> of the <see cref="
NRange
"/>.</param>
28
/// <param name="end">The exclusive end <see cref="NIndex"/> of the <see cref="
NRange
"/>.</param>
36
/// Constructs an <see cref="
NRange
"/> object using a <see cref="Range"/>.
45
/// <summary>Compares the current <see cref="
NRange
"/> object to another object of the same type for equality.</summary>
48
value is
NRange
r &&
52
/// <summary>Compares the current <see cref="
NRange
"/> object to another <see cref="
NRange
"/> object for equality.</summary>
54
public bool Equals(
NRange
other) => other.Start.Equals(Start) && other.End.Equals(End);
91
/// <summary>Creates an <see cref="
NRange
"/> object starting from start <see cref="NIndex"/> to the end of the collection.</summary>
92
public static
NRange
StartAt(NIndex start) => new NRange(start, NIndex.End);
94
/// <summary>Creates an <see cref="
NRange
"/> object starting from first element in the collection to the end <see cref="NIndex"/>.</summary>
95
public static
NRange
EndAt(NIndex end) => new NRange(NIndex.Start, end);
98
public static
NRange
All => new NRange(NIndex.Start, NIndex.End);
100
/// <summary>Calculates the start offset and length of the <see cref="
NRange
"/> object using a collection length.</summary>
101
/// <param name="length">The length of the collection that the <see cref="
NRange
"/> will be used with. Must be a positive value.</param>
105
/// The <see cref="
NRange
"/> is validated to be inside the length scope, however.
124
/// Implicitly converts a <see cref="Range"/> to an <see cref="
NRange
"/>.
127
public static implicit operator
NRange
(Range range) => new NRange(range.Start, range.End);
130
/// Explicitly converts an <see cref="
NRange
"/> to a <see cref="Range"/> without doing bounds checks.
132
/// <param name="value"><see cref="
NRange
"/> to convert.</param>
133
public static explicit operator Range(
NRange
value) => new Range((Index)value.Start, (Index)value.End);
136
/// Explicitly converts an <see cref="
NRange
"/> to a <see cref="Range"/>.
138
/// <param name="value"><see cref="
NRange
"/> to convert.</param>
139
public static explicit operator checked Range(
NRange
value) => new Range(checked((Index)value.Start), checked((Index)value.End));
142
/// Converts a <see cref="
NRange
"/> to a <see cref="Range"/>.
148
/// Converts a <see cref="
NRange
"/> to a <see cref="Range"/> without doing bounds checks.
System\Numerics\Tensors\netcore\IReadOnlyTensor_1.cs (4)
33
/// <inheritdoc cref="Slice(ReadOnlySpan{
NRange
})" />
34
TSelf this[params scoped ReadOnlySpan<
NRange
> ranges] { get; }
51
ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(params scoped ReadOnlySpan<
NRange
> ranges);
88
TSelf Slice(params scoped ReadOnlySpan<
NRange
> ranges);
System\Numerics\Tensors\netcore\ITensor_1.cs (2)
69
new TSelf this[params scoped ReadOnlySpan<
NRange
> ranges] { get; set; }
86
TensorSpan<T> AsTensorSpan(params scoped ReadOnlySpan<
NRange
> ranges);
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan_1.cs (6)
265
/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.this[ReadOnlySpan{
NRange
}]" />
266
public ReadOnlyTensorSpan<T> this[params scoped ReadOnlySpan<
NRange
> ranges]
405
/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.Slice(ReadOnlySpan{
NRange
})" />
406
public ReadOnlyTensorSpan<T> Slice(params scoped ReadOnlySpan<
NRange
> ranges)
408
TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange,
NRange
>(ranges, out nint linearOffset);
460
ReadOnlyTensorSpan<T> IReadOnlyTensor<ReadOnlyTensorSpan<T>, T>.AsReadOnlyTensorSpan(params scoped ReadOnlySpan<
NRange
> ranges) => Slice(ranges);
System\Numerics\Tensors\netcore\Tensor.cs (13)
253
Span<
NRange
> ranges = TensorOperation.RentedBuffer.CreateUninitialized(destination.Rank, out TensorOperation.RentedBuffer<
NRange
> rentedBuffer);
1745
Span<
NRange
> srcIndexes = TensorOperation.RentedBuffer.CreateUninitialized(tensor.Rank, out TensorOperation.RentedBuffer<
NRange
> srcIndexesRentedBuffer);
1746
Span<
NRange
> dstIndexes = TensorOperation.RentedBuffer.CreateUninitialized(tensor.Rank, out TensorOperation.RentedBuffer<
NRange
> dstIndexesRentedBuffer);
1750
srcIndexes[i] =
NRange
.All;
1751
dstIndexes[i] =
NRange
.All;
1801
public static Tensor<T> SetSlice<T>(this Tensor<T> tensor, in ReadOnlyTensorSpan<T> values, params ReadOnlySpan<
NRange
> ranges)
1813
public static ref readonly TensorSpan<T> SetSlice<T>(this in TensorSpan<T> tensor, scoped in ReadOnlyTensorSpan<T> values, params scoped ReadOnlySpan<
NRange
> ranges)
1850
scoped Span<
NRange
> sliceDims = TensorOperation.RentedBuffer.CreateUninitialized(tensor.Rank, out TensorOperation.RentedBuffer<
NRange
> lengthsRentedBuffer);
1853
sliceDims[i] =
NRange
.All;
System\Numerics\Tensors\netcore\Tensor_1.cs (9)
92
/// <inheritdoc cref="TensorSpan{T}.this[ReadOnlySpan{
NRange
}]" />
93
public Tensor<T> this[params ReadOnlySpan<
NRange
> ranges]
145
/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.AsReadOnlyTensorSpan(ReadOnlySpan{
NRange
})" />
146
public ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(params scoped ReadOnlySpan<
NRange
> ranges) => AsReadOnlyTensorSpan().Slice(ranges);
157
/// <inheritdoc cref="ITensor{TSelf, T}.AsTensorSpan(ReadOnlySpan{
NRange
})" />
158
public TensorSpan<T> AsTensorSpan(params scoped ReadOnlySpan<
NRange
> ranges) => AsTensorSpan().Slice(ranges);
238
/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.Slice(ReadOnlySpan{
NRange
})" />
239
public Tensor<T> Slice(params ReadOnlySpan<
NRange
> ranges)
241
TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange,
NRange
>(ranges, out nint linearOffset);
System\Numerics\Tensors\netcore\TensorShape.cs (5)
542
public static bool AdjustToNextIndex(Span<
NRange
> ranges, int dimension, ReadOnlySpan<nint> lengths)
544
NRange
curRange = ranges[dimension];
1256
public readonly struct GetOffsetAndLengthForNRange : IGetOffsetAndLength<
NRange
>
1258
public static nint GetOffset(
NRange
range, nint length)
1263
public static (nint Offset, nint Length) GetOffsetAndLength(
NRange
range, nint length)
System\Numerics\Tensors\netcore\TensorSpan_1.cs (8)
165
/// <inheritdoc cref="ITensor{TSelf, T}.this[ReadOnlySpan{
NRange
}]" />
166
public TensorSpan<T> this[params scoped ReadOnlySpan<
NRange
> ranges]
226
/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.AsReadOnlyTensorSpan(ReadOnlySpan{
NRange
})" />
227
public ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(params scoped ReadOnlySpan<
NRange
> ranges) => AsReadOnlyTensorSpan().Slice(ranges);
301
/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.Slice(ReadOnlySpan{
NRange
})" />
302
public TensorSpan<T> Slice(params scoped ReadOnlySpan<
NRange
> ranges)
304
TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange,
NRange
>(ranges, out nint linearOffset);
400
TensorSpan<T> ITensor<TensorSpan<T>, T>.AsTensorSpan(params scoped ReadOnlySpan<
NRange
> ranges) => Slice(ranges);