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 (5)
285ranges[dimension - 1] = new NRange(curRange.Start.Value + 1, curRange.End.Value + 1); 294ranges[i - 1] = new NRange(ranges[i - 1].Start.Value + 1, ranges[i - 1].End.Value + 1); 1784srcIndexes[dimension] = new NRange(i - 1, i); 1785dstIndexes[dimension] = new NRange(tensor.Lengths[dimension] - i, tensor.Lengths[dimension] - i + 1); 1886sliceDims[(int)dimension] = new NRange(start, start + splitLength);
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); 83TSelf 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)
293/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.this[ReadOnlySpan{NRange}]" /> 294public ReadOnlyTensorSpan<T> this[params scoped ReadOnlySpan<NRange> ranges] 427/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.Slice(ReadOnlySpan{NRange})" /> 428public ReadOnlyTensorSpan<T> Slice(params scoped ReadOnlySpan<NRange> ranges) 430TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset);
System\Numerics\Tensors\netcore\Tensor.cs (15)
256Span<NRange> ranges = TensorOperation.RentedBuffer.CreateUninitialized(destination.Rank, out TensorOperation.RentedBuffer<NRange> rentedBuffer); 282private static bool IncrementIndexes(Span<NRange> ranges, int dimension, ReadOnlySpan<nint> lengths) 284NRange curRange = ranges[dimension - 1]; 1773Span<NRange> srcIndexes = TensorOperation.RentedBuffer.CreateUninitialized(tensor.Rank, out TensorOperation.RentedBuffer<NRange> srcIndexesRentedBuffer); 1774Span<NRange> dstIndexes = TensorOperation.RentedBuffer.CreateUninitialized(tensor.Rank, out TensorOperation.RentedBuffer<NRange> dstIndexesRentedBuffer); 1778srcIndexes[i] = NRange.All; 1779dstIndexes[i] = NRange.All; 1829public static Tensor<T> SetSlice<T>(this Tensor<T> tensor, in ReadOnlyTensorSpan<T> values, params ReadOnlySpan<NRange> ranges) 1841public static ref readonly TensorSpan<T> SetSlice<T>(this in TensorSpan<T> tensor, scoped in ReadOnlyTensorSpan<T> values, params scoped ReadOnlySpan<NRange> ranges) 1878scoped Span<NRange> sliceDims = TensorOperation.RentedBuffer.CreateUninitialized(tensor.Rank, out TensorOperation.RentedBuffer<NRange> lengthsRentedBuffer); 1881sliceDims[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); 281/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.Slice(ReadOnlySpan{NRange})" /> 282public Tensor<T> Slice(params ReadOnlySpan<NRange> ranges) 284TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset);
System\Numerics\Tensors\netcore\TensorShape.cs (3)
1350public readonly struct GetOffsetAndLengthForNRange : IGetOffsetAndLength<NRange> 1352public static nint GetOffset(ReadOnlySpan<NRange> ranges, int rankIndex, nint previousLength) 1357public 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}]" /> 195public TensorSpan<T> this[params scoped ReadOnlySpan<NRange> ranges] 252/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.AsReadOnlyTensorSpan(ReadOnlySpan{NRange})" /> 253public ReadOnlyTensorSpan<T> AsReadOnlyTensorSpan(params scoped ReadOnlySpan<NRange> ranges) => AsReadOnlyTensorSpan().Slice(ranges); 324/// <inheritdoc cref="IReadOnlyTensor{TSelf, T}.Slice(ReadOnlySpan{NRange})" /> 325public TensorSpan<T> Slice(params scoped ReadOnlySpan<NRange> ranges) 327TensorShape shape = _shape.Slice<TensorShape.GetOffsetAndLengthForNRange, NRange>(ranges, out nint linearOffset);