9 instantiations of NRange
System.Numerics.Tensors (9)
System\Buffers\NRange.cs (4)
92public static NRange StartAt(NIndex start) => new NRange(start, NIndex.End); 95public static NRange EndAt(NIndex end) => new NRange(NIndex.Start, end); 98public static NRange All => new NRange(NIndex.Start, NIndex.End); 127public static implicit operator NRange(Range range) => new NRange(range.Start, range.End);
System\Numerics\Tensors\netcore\Tensor.cs (3)
1756srcIndexes[dimension] = new NRange(i - 1, i); 1757dstIndexes[dimension] = new NRange(tensor.Lengths[dimension] - i, tensor.Lengths[dimension] - i + 1); 1858sliceDims[(int)dimension] = new NRange(start, start + splitLength);
System\Numerics\Tensors\netcore\TensorShape.cs (2)
545ranges[dimension] = new NRange(curRange.Start.Value + 1, curRange.End.Value + 1); 558ranges[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)
18public 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> 48value is NRange r && 52/// <summary>Compares the current <see cref="NRange"/> object to another <see cref="NRange"/> object for equality.</summary> 54public 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> 92public 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> 95public static NRange EndAt(NIndex end) => new NRange(NIndex.Start, end); 98public 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"/>. 127public 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> 133public 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> 139public 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})" /> 34TSelf this[params scoped ReadOnlySpan<NRange> ranges] { get; } 51ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(params scoped ReadOnlySpan<NRange> ranges); 88TSelf Slice(params scoped ReadOnlySpan<NRange> ranges);
System\Numerics\Tensors\netcore\ITensor_1.cs (2)
69new TSelf this[params scoped ReadOnlySpan<NRange> ranges] { get; set; } 86TensorSpan<T> AsTensorSpan(params scoped ReadOnlySpan<NRange> ranges);
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan_1.cs (6)
265/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.this[ReadOnlySpan{NRange}]" /> 266public ReadOnlyTensorSpan<T> this[params scoped ReadOnlySpan<NRange> ranges] 405/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.Slice(ReadOnlySpan{NRange})" /> 406public ReadOnlyTensorSpan<T> Slice(params scoped ReadOnlySpan<NRange> ranges) 408TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset); 460ReadOnlyTensorSpan<T> IReadOnlyTensor<ReadOnlyTensorSpan<T>, T>.AsReadOnlyTensorSpan(params scoped ReadOnlySpan<NRange> ranges) => Slice(ranges);
System\Numerics\Tensors\netcore\Tensor.cs (13)
253Span<NRange> ranges = TensorOperation.RentedBuffer.CreateUninitialized(destination.Rank, out TensorOperation.RentedBuffer<NRange> rentedBuffer); 1745Span<NRange> srcIndexes = TensorOperation.RentedBuffer.CreateUninitialized(tensor.Rank, out TensorOperation.RentedBuffer<NRange> srcIndexesRentedBuffer); 1746Span<NRange> dstIndexes = TensorOperation.RentedBuffer.CreateUninitialized(tensor.Rank, out TensorOperation.RentedBuffer<NRange> dstIndexesRentedBuffer); 1750srcIndexes[i] = NRange.All; 1751dstIndexes[i] = NRange.All; 1801public static Tensor<T> SetSlice<T>(this Tensor<T> tensor, in ReadOnlyTensorSpan<T> values, params ReadOnlySpan<NRange> ranges) 1813public static ref readonly TensorSpan<T> SetSlice<T>(this in TensorSpan<T> tensor, scoped in ReadOnlyTensorSpan<T> values, params scoped ReadOnlySpan<NRange> ranges) 1850scoped Span<NRange> sliceDims = TensorOperation.RentedBuffer.CreateUninitialized(tensor.Rank, out TensorOperation.RentedBuffer<NRange> lengthsRentedBuffer); 1853sliceDims[i] = NRange.All;
System\Numerics\Tensors\netcore\Tensor_1.cs (9)
92/// <inheritdoc cref="TensorSpan{T}.this[ReadOnlySpan{NRange}]" /> 93public Tensor<T> this[params ReadOnlySpan<NRange> ranges] 145/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.AsReadOnlyTensorSpan(ReadOnlySpan{NRange})" /> 146public ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(params scoped ReadOnlySpan<NRange> ranges) => AsReadOnlyTensorSpan().Slice(ranges); 157/// <inheritdoc cref="ITensor{TSelf, T}.AsTensorSpan(ReadOnlySpan{NRange})" /> 158public TensorSpan<T> AsTensorSpan(params scoped ReadOnlySpan<NRange> ranges) => AsTensorSpan().Slice(ranges); 238/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.Slice(ReadOnlySpan{NRange})" /> 239public Tensor<T> Slice(params ReadOnlySpan<NRange> ranges) 241TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset);
System\Numerics\Tensors\netcore\TensorShape.cs (5)
542public static bool AdjustToNextIndex(Span<NRange> ranges, int dimension, ReadOnlySpan<nint> lengths) 544NRange curRange = ranges[dimension]; 1256public readonly struct GetOffsetAndLengthForNRange : IGetOffsetAndLength<NRange> 1258public static nint GetOffset(NRange range, nint length) 1263public 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}]" /> 166public TensorSpan<T> this[params scoped ReadOnlySpan<NRange> ranges] 226/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.AsReadOnlyTensorSpan(ReadOnlySpan{NRange})" /> 227public ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(params scoped ReadOnlySpan<NRange> ranges) => AsReadOnlyTensorSpan().Slice(ranges); 301/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.Slice(ReadOnlySpan{NRange})" /> 302public TensorSpan<T> Slice(params scoped ReadOnlySpan<NRange> ranges) 304TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset); 400TensorSpan<T> ITensor<TensorSpan<T>, T>.AsTensorSpan(params scoped ReadOnlySpan<NRange> ranges) => Slice(ranges);