9 instantiations of NRange
System.Numerics.Tensors (9)
System\Buffers\NRange.cs (4)
93
public static NRange StartAt(NIndex start) => new
NRange
(start, NIndex.End);
96
public static NRange EndAt(NIndex end) => new
NRange
(NIndex.Start, end);
99
public static NRange All => new
NRange
(NIndex.Start, NIndex.End);
128
public static implicit operator NRange(Range range) => new
NRange
(range.Start, range.End);
System\Numerics\Tensors\netcore\Tensor.cs (5)
285
ranges[dimension - 1] = new
NRange
(curRange.Start.Value + 1, curRange.End.Value + 1);
294
ranges[i - 1] = new
NRange
(ranges[i - 1].Start.Value + 1, ranges[i - 1].End.Value + 1);
1784
srcIndexes[dimension] = new
NRange
(i - 1, i);
1785
dstIndexes[dimension] = new
NRange
(tensor.Lengths[dimension] - i, tensor.Lengths[dimension] - i + 1);
1886
sliceDims[(int)dimension] = new
NRange
(start, start + splitLength);
73 references to NRange
System.Numerics.Tensors (73)
System\Buffers\NRange.cs (28)
19
public readonly struct NRange : IEquatable<
NRange
>
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>
37
/// Constructs an <see cref="
NRange
"/> object using a <see cref="Range"/>.
46
/// <summary>Compares the current <see cref="
NRange
"/> object to another object of the same type for equality.</summary>
49
value is
NRange
r &&
53
/// <summary>Compares the current <see cref="
NRange
"/> object to another <see cref="
NRange
"/> object for equality.</summary>
55
public bool Equals(
NRange
other) => other.Start.Equals(Start) && other.End.Equals(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);
101
/// <summary>Calculates the start offset and length of the <see cref="
NRange
"/> object using a collection length.</summary>
102
/// <param name="length">The length of the collection that the <see cref="
NRange
"/> will be used with. Must be a positive value.</param>
106
/// The <see cref="
NRange
"/> is validated to be inside the length scope, however.
125
/// Implicitly converts a <see cref="Range"/> to an <see cref="
NRange
"/>.
128
public static implicit operator
NRange
(Range range) => new NRange(range.Start, range.End);
131
/// Explicitly converts an <see cref="
NRange
"/> to a <see cref="Range"/> without doing bounds checks.
133
/// <param name="value"><see cref="
NRange
"/> to convert.</param>
134
public static explicit operator Range(
NRange
value) => new Range((Index)value.Start, (Index)value.End);
137
/// Explicitly converts an <see cref="
NRange
"/> to a <see cref="Range"/>.
139
/// <param name="value"><see cref="
NRange
"/> to convert.</param>
140
public static explicit operator checked Range(
NRange
value) => new Range(checked((Index)value.Start), checked((Index)value.End));
143
/// Converts a <see cref="
NRange
"/> to a <see cref="Range"/>.
149
/// 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);
83
TSelf Slice(params scoped ReadOnlySpan<
NRange
> ranges);
System\Numerics\Tensors\netcore\ITensor_1.cs (2)
68
new TSelf this[params scoped ReadOnlySpan<
NRange
> ranges] { get; set; }
85
TensorSpan<T> AsTensorSpan(params scoped ReadOnlySpan<
NRange
> ranges);
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan_1.cs (5)
293
/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.this[ReadOnlySpan{
NRange
}]" />
294
public ReadOnlyTensorSpan<T> this[params scoped ReadOnlySpan<
NRange
> ranges]
427
/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.Slice(ReadOnlySpan{
NRange
})" />
428
public ReadOnlyTensorSpan<T> Slice(params scoped ReadOnlySpan<
NRange
> ranges)
430
TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange,
NRange
>(ranges, out nint linearOffset);
System\Numerics\Tensors\netcore\Tensor.cs (15)
256
Span<
NRange
> ranges = TensorOperation.RentedBuffer.CreateUninitialized(destination.Rank, out TensorOperation.RentedBuffer<
NRange
> rentedBuffer);
282
private static bool IncrementIndexes(Span<
NRange
> ranges, int dimension, ReadOnlySpan<nint> lengths)
284
NRange
curRange = ranges[dimension - 1];
1773
Span<
NRange
> srcIndexes = TensorOperation.RentedBuffer.CreateUninitialized(tensor.Rank, out TensorOperation.RentedBuffer<
NRange
> srcIndexesRentedBuffer);
1774
Span<
NRange
> dstIndexes = TensorOperation.RentedBuffer.CreateUninitialized(tensor.Rank, out TensorOperation.RentedBuffer<
NRange
> dstIndexesRentedBuffer);
1778
srcIndexes[i] =
NRange
.All;
1779
dstIndexes[i] =
NRange
.All;
1829
public static Tensor<T> SetSlice<T>(this Tensor<T> tensor, in ReadOnlyTensorSpan<T> values, params ReadOnlySpan<
NRange
> ranges)
1841
public static ref readonly TensorSpan<T> SetSlice<T>(this in TensorSpan<T> tensor, scoped in ReadOnlyTensorSpan<T> values, params scoped ReadOnlySpan<
NRange
> ranges)
1878
scoped Span<
NRange
> sliceDims = TensorOperation.RentedBuffer.CreateUninitialized(tensor.Rank, out TensorOperation.RentedBuffer<
NRange
> lengthsRentedBuffer);
1881
sliceDims[i] =
NRange
.All;
System\Numerics\Tensors\netcore\Tensor_1.cs (9)
137
/// <inheritdoc cref="TensorSpan{T}.this[ReadOnlySpan{
NRange
}]" />
138
public Tensor<T> this[params ReadOnlySpan<
NRange
> ranges]
190
/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.AsReadOnlyTensorSpan(ReadOnlySpan{
NRange
})" />
191
public ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(params scoped ReadOnlySpan<
NRange
> ranges) => AsReadOnlyTensorSpan().Slice(ranges);
202
/// <inheritdoc cref="ITensor{TSelf, T}.AsTensorSpan(ReadOnlySpan{
NRange
})" />
203
public TensorSpan<T> AsTensorSpan(params scoped ReadOnlySpan<
NRange
> ranges) => AsTensorSpan().Slice(ranges);
281
/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.Slice(ReadOnlySpan{
NRange
})" />
282
public Tensor<T> Slice(params ReadOnlySpan<
NRange
> ranges)
284
TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange,
NRange
>(ranges, out nint linearOffset);
System\Numerics\Tensors\netcore\TensorShape.cs (3)
1350
public readonly struct GetOffsetAndLengthForNRange : IGetOffsetAndLength<
NRange
>
1352
public static nint GetOffset(ReadOnlySpan<
NRange
> ranges, int rankIndex, nint previousLength)
1357
public static (nint Offset, nint Length) GetOffsetAndLength(ReadOnlySpan<
NRange
> ranges, int rankIndex, nint previousLength)
System\Numerics\Tensors\netcore\TensorSpan.cs (7)
194
/// <inheritdoc cref="ITensor{TSelf, T}.this[ReadOnlySpan{
NRange
}]" />
195
public TensorSpan<T> this[params scoped ReadOnlySpan<
NRange
> ranges]
252
/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.AsReadOnlyTensorSpan(ReadOnlySpan{
NRange
})" />
253
public ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(params scoped ReadOnlySpan<
NRange
> ranges) => AsReadOnlyTensorSpan().Slice(ranges);
324
/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.Slice(ReadOnlySpan{
NRange
})" />
325
public TensorSpan<T> Slice(params scoped ReadOnlySpan<
NRange
> ranges)
327
TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange,
NRange
>(ranges, out nint linearOffset);