9 instantiations of NRange
System.Numerics.Tensors (9)
System\Buffers\NRange.cs (4)
93public static NRange StartAt(NIndex start) => new NRange(start, NIndex.End); 96public static NRange EndAt(NIndex end) => new NRange(NIndex.Start, end); 99public static NRange All => new NRange(NIndex.Start, NIndex.End); 128public static implicit operator NRange(Range range) => new NRange(range.Start, range.End);
System\Numerics\Tensors\netcore\Tensor.cs (3)
1767srcIndexes[dimension] = new NRange(i - 1, i); 1768dstIndexes[dimension] = new NRange(tensor.Lengths[dimension] - i, tensor.Lengths[dimension] - i + 1); 1869sliceDims[(int)dimension] = new NRange(start, start + splitLength);
System\Numerics\Tensors\netcore\TensorShape.cs (2)
618ranges[dimension] = new NRange(curRange.Start.Value + 1, curRange.End.Value + 1); 627ranges[i - 1] = new NRange(ranges[i - 1].Start.Value + 1, ranges[i - 1].End.Value + 1);
73 references to NRange
System.Numerics.Tensors (73)
System\Buffers\NRange.cs (28)
19public 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> 49value is NRange r && 53/// <summary>Compares the current <see cref="NRange"/> object to another <see cref="NRange"/> object for equality.</summary> 55public 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> 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); 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"/>. 128public 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> 134public 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> 140public 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})" /> 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)
68new TSelf this[params scoped ReadOnlySpan<NRange> ranges] { get; set; } 85TensorSpan<T> AsTensorSpan(params scoped ReadOnlySpan<NRange> ranges);
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan_1.cs (5)
294/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.this[ReadOnlySpan{NRange}]" /> 295public ReadOnlyTensorSpan<T> this[params scoped ReadOnlySpan<NRange> ranges] 431/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.Slice(ReadOnlySpan{NRange})" /> 432public ReadOnlyTensorSpan<T> Slice(params scoped ReadOnlySpan<NRange> ranges) 434TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset);
System\Numerics\Tensors\netcore\Tensor.cs (13)
256Span<NRange> ranges = TensorOperation.RentedBuffer.CreateUninitialized(destination.Rank, out TensorOperation.RentedBuffer<NRange> rentedBuffer); 1756Span<NRange> srcIndexes = TensorOperation.RentedBuffer.CreateUninitialized(tensor.Rank, out TensorOperation.RentedBuffer<NRange> srcIndexesRentedBuffer); 1757Span<NRange> dstIndexes = TensorOperation.RentedBuffer.CreateUninitialized(tensor.Rank, out TensorOperation.RentedBuffer<NRange> dstIndexesRentedBuffer); 1761srcIndexes[i] = NRange.All; 1762dstIndexes[i] = NRange.All; 1812public static Tensor<T> SetSlice<T>(this Tensor<T> tensor, in ReadOnlyTensorSpan<T> values, params ReadOnlySpan<NRange> ranges) 1824public static ref readonly TensorSpan<T> SetSlice<T>(this in TensorSpan<T> tensor, scoped in ReadOnlyTensorSpan<T> values, params scoped ReadOnlySpan<NRange> ranges) 1861scoped Span<NRange> sliceDims = TensorOperation.RentedBuffer.CreateUninitialized(tensor.Rank, out TensorOperation.RentedBuffer<NRange> lengthsRentedBuffer); 1864sliceDims[i] = NRange.All;
System\Numerics\Tensors\netcore\Tensor_1.cs (9)
137/// <inheritdoc cref="TensorSpan{T}.this[ReadOnlySpan{NRange}]" /> 138public Tensor<T> this[params ReadOnlySpan<NRange> ranges] 190/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.AsReadOnlyTensorSpan(ReadOnlySpan{NRange})" /> 191public ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(params scoped ReadOnlySpan<NRange> ranges) => AsReadOnlyTensorSpan().Slice(ranges); 202/// <inheritdoc cref="ITensor{TSelf, T}.AsTensorSpan(ReadOnlySpan{NRange})" /> 203public TensorSpan<T> AsTensorSpan(params scoped ReadOnlySpan<NRange> ranges) => AsTensorSpan().Slice(ranges); 284/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.Slice(ReadOnlySpan{NRange})" /> 285public Tensor<T> Slice(params ReadOnlySpan<NRange> ranges) 287TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset);
System\Numerics\Tensors\netcore\TensorShape.cs (5)
615public static bool AdjustToNextIndex(Span<NRange> ranges, int dimension, ReadOnlySpan<nint> lengths) 617NRange curRange = ranges[dimension]; 1388public readonly struct GetOffsetAndLengthForNRange : IGetOffsetAndLength<NRange> 1390public static nint GetOffset(NRange range, nint length) 1395public static (nint Offset, nint Length) GetOffsetAndLength(NRange range, nint length)
System\Numerics\Tensors\netcore\TensorSpan_1.cs (7)
195/// <inheritdoc cref="ITensor{TSelf, T}.this[ReadOnlySpan{NRange}]" /> 196public TensorSpan<T> this[params scoped ReadOnlySpan<NRange> ranges] 253/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.AsReadOnlyTensorSpan(ReadOnlySpan{NRange})" /> 254public ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(params scoped ReadOnlySpan<NRange> ranges) => AsReadOnlyTensorSpan().Slice(ranges); 328/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.Slice(ReadOnlySpan{NRange})" /> 329public TensorSpan<T> Slice(params scoped ReadOnlySpan<NRange> ranges) 331TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset);