256 references to Rank
System.Numerics.Tensors (256)
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan.cs (37)
328
if (indexes.Length !=
Rank
)
351
if (indexes.Length !=
Rank
)
374
if (ranges.Length !=
Rank
)
421
left.
Rank
== right.
Rank
&&
486
_curIndexes = new nint[_span.
Rank
];
487
_curIndexes[_span.
Rank
- 1] = -1;
494
TensorSpanHelpers.AdjustIndexes(_span.
Rank
- 1, 1, _curIndexes, _span.Lengths);
545
if (
Rank
> TensorShape.MaxInlineRank)
564
int indexToAdjust = srcSlice.Strides[^1] == 1 && TensorHelpers.IsContiguousAndDense(srcSlice) ? srcSlice.
Rank
- 2 : srcSlice.
Rank
- 1;
601
if (
Rank
> TensorShape.MaxInlineRank)
620
int indexToAdjust = srcSlice.Strides[^1] == 1 && TensorHelpers.IsContiguousAndDense(srcSlice) ? srcSlice.
Rank
- 2 : srcSlice.
Rank
- 1;
696
if (
Rank
> TensorShape.MaxInlineRank)
698
lengthsArray = ArrayPool<nint>.Shared.Rent(
Rank
);
699
lengths = lengthsArray.AsSpan(0,
Rank
);
701
offsetsArray = ArrayPool<nint>.Shared.Rent(
Rank
);
702
offsets = offsetsArray.AsSpan(0,
Rank
);
706
lengths = stackalloc nint[
Rank
];
707
offsets = stackalloc nint[
Rank
];
756
if (
Rank
> TensorShape.MaxInlineRank)
758
curIndexesArray = ArrayPool<nint>.Shared.Rent(
Rank
);
759
curIndexes = curIndexesArray.AsSpan(0,
Rank
);
764
curIndexes = stackalloc nint[
Rank
];
771
TensorSpanHelpers.Memmove(destination.Slice(checked((int)copiedValues)), ref Unsafe.Add(ref _reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides, Lengths)), Lengths[
Rank
- 1]);
772
TensorSpanHelpers.AdjustIndexes(
Rank
- 2, 1, curIndexes, _shape.Lengths);
773
copiedValues += Lengths[
Rank
- 1];
797
if (
Rank
> TensorShape.MaxInlineRank)
799
curIndexesArray = ArrayPool<nint>.Shared.Rent(
Rank
);
800
curIndexes = curIndexesArray.AsSpan(0,
Rank
);
805
curIndexes = stackalloc nint[
Rank
];
812
if (Strides[
Rank
- 1] == 0)
814
destination.Slice(checked((int)copiedValues), (int)Lengths[
Rank
- 1]).Fill(Unsafe.Add(ref _reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides, Lengths)));
818
TensorSpanHelpers.Memmove(destination.Slice(checked((int)copiedValues)), ref Unsafe.Add(ref _reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, Strides, Lengths)), Lengths[
Rank
- 1]);
820
TensorSpanHelpers.AdjustIndexes(
Rank
- 2, 1, curIndexes, _shape.Lengths);
821
copiedValues += Lengths[
Rank
- 1];
System\Numerics\Tensors\netcore\TensorExtensions.cs (215)
559
if (x.
Rank
> TensorShape.MaxInlineRank)
561
curIndexArray = ArrayPool<nint>.Shared.Rent(x.
Rank
);
562
curIndex = curIndexArray.AsSpan(0, x.
Rank
);
567
curIndex = stackalloc nint[x.
Rank
];
574
TensorSpanHelpers.AdjustIndexes(x.
Rank
- 1, 1, curIndex, x.Lengths);
604
if (broadcastedLeft.
Rank
> TensorShape.MaxInlineRank)
606
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Rank
);
607
curIndex = curIndexArray.AsSpan(0, broadcastedRight.
Rank
);
612
curIndex = stackalloc nint[broadcastedRight.
Rank
];
620
TensorSpanHelpers.AdjustIndexes(broadcastedRight.
Rank
- 1, 1, curIndex, broadcastedRight.Lengths);
643
if (x.
Rank
> TensorShape.MaxInlineRank)
645
curIndexArray = ArrayPool<nint>.Shared.Rent(x.
Rank
);
646
curIndex = curIndexArray.AsSpan(0, x.
Rank
);
651
curIndex = stackalloc nint[x.
Rank
];
659
TensorSpanHelpers.AdjustIndexes(x.
Rank
- 1, 1, curIndex, x.Lengths);
688
if (broadcastedRight.
Rank
> TensorShape.MaxInlineRank)
691
curIndex = curIndexArray.AsSpan(0, broadcastedRight.
Rank
);
704
TensorSpanHelpers.AdjustIndexes(broadcastedRight.
Rank
- 1, 1, curIndex, broadcastedRight.Lengths);
727
if (x.
Rank
> TensorShape.MaxInlineRank)
729
curIndexArray = ArrayPool<nint>.Shared.Rent(x.
Rank
);
730
curIndex = curIndexArray.AsSpan(0, x.
Rank
);
735
curIndex = stackalloc nint[x.
Rank
];
743
TensorSpanHelpers.AdjustIndexes(x.
Rank
- 1, 1, curIndex, x.Lengths);
790
if (values.
Rank
!= 1)
934
if (x.
Rank
> TensorShape.MaxInlineRank)
936
curIndexArray = ArrayPool<nint>.Shared.Rent(x.
Rank
);
937
curIndex = curIndexArray.AsSpan(0, x.
Rank
);
942
curIndex = stackalloc nint[x.
Rank
];
949
TensorSpanHelpers.AdjustIndexes(x.
Rank
- 1, 1, curIndex, x.Lengths);
994
if (y.
Rank
> TensorShape.MaxInlineRank)
996
curIndexArray = ArrayPool<nint>.Shared.Rent(y.
Rank
);
997
curIndex = curIndexArray.AsSpan(0, y.
Rank
);
1002
curIndex = stackalloc nint[y.
Rank
];
1009
TensorSpanHelpers.AdjustIndexes(y.
Rank
- 1, 1, curIndex, y.Lengths);
1143
if (x.
Rank
> TensorShape.MaxInlineRank)
1145
curIndexArray = ArrayPool<nint>.Shared.Rent(x.
Rank
);
1146
curIndex = curIndexArray.AsSpan(0, x.
Rank
);
1151
curIndex = stackalloc nint[x.
Rank
];
1158
TensorSpanHelpers.AdjustIndexes(x.
Rank
- 1, 1, curIndex, x.Lengths);
1203
if (y.
Rank
> TensorShape.MaxInlineRank)
1205
curIndexArray = ArrayPool<nint>.Shared.Rent(y.
Rank
);
1206
curIndex = curIndexArray.AsSpan(0, y.
Rank
);
1211
curIndex = stackalloc nint[y.
Rank
];
1218
TensorSpanHelpers.AdjustIndexes(y.
Rank
- 1, 1, curIndex, y.Lengths);
1247
if (broadcastedRight.
Rank
> TensorShape.MaxInlineRank)
1250
curIndex = curIndexArray.AsSpan(0, broadcastedRight.
Rank
);
1263
TensorSpanHelpers.AdjustIndexes(broadcastedRight.
Rank
- 1, 1, curIndex, broadcastedRight.Lengths);
1286
if (x.
Rank
> TensorShape.MaxInlineRank)
1288
curIndexArray = ArrayPool<nint>.Shared.Rent(x.
Rank
);
1289
curIndex = curIndexArray.AsSpan(0, x.
Rank
);
1294
curIndex = stackalloc nint[x.
Rank
];
1302
TensorSpanHelpers.AdjustIndexes(x.
Rank
- 1, 1, curIndex, x.Lengths);
1325
if (y.
Rank
> TensorShape.MaxInlineRank)
1327
curIndexArray = ArrayPool<nint>.Shared.Rent(y.
Rank
);
1328
curIndex = curIndexArray.AsSpan(0, y.
Rank
);
1333
curIndex = stackalloc nint[y.
Rank
];
1341
TensorSpanHelpers.AdjustIndexes(y.
Rank
- 1, 1, curIndex, y.Lengths);
1370
if (broadcastedRight.
Rank
> TensorShape.MaxInlineRank)
1373
curIndex = curIndexArray.AsSpan(0, broadcastedRight.
Rank
);
1386
TensorSpanHelpers.AdjustIndexes(broadcastedRight.
Rank
- 1, 1, curIndex, broadcastedRight.Lengths);
1409
if (x.
Rank
> TensorShape.MaxInlineRank)
1411
curIndexArray = ArrayPool<nint>.Shared.Rent(x.
Rank
);
1412
curIndex = curIndexArray.AsSpan(0, x.
Rank
);
1417
curIndex = stackalloc nint[x.
Rank
];
1425
TensorSpanHelpers.AdjustIndexes(x.
Rank
- 1, 1, curIndex, x.Lengths);
1448
if (y.
Rank
> TensorShape.MaxInlineRank)
1450
curIndexArray = ArrayPool<nint>.Shared.Rent(y.
Rank
);
1451
curIndex = curIndexArray.AsSpan(0, y.
Rank
);
1456
curIndex = stackalloc nint[y.
Rank
];
1464
TensorSpanHelpers.AdjustIndexes(y.
Rank
- 1, 1, curIndex, y.Lengths);
1494
if (broadcastedLeft.
Rank
> TensorShape.MaxInlineRank)
1496
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Rank
);
1497
curIndex = curIndexArray.AsSpan(0, broadcastedRight.
Rank
);
1502
curIndex = stackalloc nint[broadcastedRight.
Rank
];
1510
TensorSpanHelpers.AdjustIndexes(broadcastedRight.
Rank
- 1, 1, curIndex, broadcastedRight.Lengths);
1533
if (x.
Rank
> TensorShape.MaxInlineRank)
1535
curIndexArray = ArrayPool<nint>.Shared.Rent(x.
Rank
);
1536
curIndex = curIndexArray.AsSpan(0, x.
Rank
);
1541
curIndex = stackalloc nint[x.
Rank
];
1549
TensorSpanHelpers.AdjustIndexes(x.
Rank
- 1, 1, curIndex, x.Lengths);
1572
if (y.
Rank
> TensorShape.MaxInlineRank)
1574
curIndexArray = ArrayPool<nint>.Shared.Rent(y.
Rank
);
1575
curIndex = curIndexArray.AsSpan(0, y.
Rank
);
1580
curIndex = stackalloc nint[y.
Rank
];
1588
TensorSpanHelpers.AdjustIndexes(y.
Rank
- 1, 1, curIndex, y.Lengths);
1618
if (broadcastedLeft.
Rank
> TensorShape.MaxInlineRank)
1620
curIndexArray = ArrayPool<nint>.Shared.Rent(broadcastedRight.
Rank
);
1621
curIndex = curIndexArray.AsSpan(0, broadcastedRight.
Rank
);
1626
curIndex = stackalloc nint[broadcastedRight.
Rank
];
1634
TensorSpanHelpers.AdjustIndexes(broadcastedRight.
Rank
- 1, 1, curIndex, broadcastedRight.Lengths);
1657
if (x.
Rank
> TensorShape.MaxInlineRank)
1659
curIndexArray = ArrayPool<nint>.Shared.Rent(x.
Rank
);
1660
curIndex = curIndexArray.AsSpan(0, x.
Rank
);
1665
curIndex = stackalloc nint[x.
Rank
];
1673
TensorSpanHelpers.AdjustIndexes(x.
Rank
- 1, 1, curIndex, x.Lengths);
1696
if (y.
Rank
> TensorShape.MaxInlineRank)
1698
curIndexArray = ArrayPool<nint>.Shared.Rent(y.
Rank
);
1699
curIndex = curIndexArray.AsSpan(0, y.
Rank
);
1704
curIndex = stackalloc nint[y.
Rank
];
1712
TensorSpanHelpers.AdjustIndexes(y.
Rank
- 1, 1, curIndex, y.Lengths);
1846
if (x.
Rank
> TensorShape.MaxInlineRank)
1848
curIndexArray = ArrayPool<nint>.Shared.Rent(x.
Rank
);
1849
curIndex = curIndexArray.AsSpan(0, x.
Rank
);
1854
curIndex = stackalloc nint[x.
Rank
];
1861
TensorSpanHelpers.AdjustIndexes(x.
Rank
- 1, 1, curIndex, x.Lengths);
1906
if (y.
Rank
> TensorShape.MaxInlineRank)
1908
curIndexArray = ArrayPool<nint>.Shared.Rent(y.
Rank
);
1909
curIndex = curIndexArray.AsSpan(0, y.
Rank
);
1914
curIndex = stackalloc nint[y.
Rank
];
1921
TensorSpanHelpers.AdjustIndexes(y.
Rank
- 1, 1, curIndex, y.Lengths);
2055
if (x.
Rank
> TensorShape.MaxInlineRank)
2057
curIndexArray = ArrayPool<nint>.Shared.Rent(x.
Rank
);
2058
curIndex = curIndexArray.AsSpan(0, x.
Rank
);
2063
curIndex = stackalloc nint[x.
Rank
];
2070
TensorSpanHelpers.AdjustIndexes(x.
Rank
- 1, 1, curIndex, x.Lengths);
2115
if (y.
Rank
> TensorShape.MaxInlineRank)
2117
curIndexArray = ArrayPool<nint>.Shared.Rent(y.
Rank
);
2118
curIndex = curIndexArray.AsSpan(0, y.
Rank
);
2123
curIndex = stackalloc nint[y.
Rank
];
2130
TensorSpanHelpers.AdjustIndexes(y.
Rank
- 1, 1, curIndex, y.Lengths);
2160
if (broadcastedRight.
Rank
> TensorShape.MaxInlineRank)
2163
curIndex = curIndexArray.AsSpan(0, broadcastedRight.
Rank
);
2176
TensorSpanHelpers.AdjustIndexes(broadcastedRight.
Rank
- 1, 1, curIndex, broadcastedRight.Lengths);
2199
if (x.
Rank
> TensorShape.MaxInlineRank)
2201
curIndexArray = ArrayPool<nint>.Shared.Rent(x.
Rank
);
2202
curIndex = curIndexArray.AsSpan(0, x.
Rank
);
2207
curIndex = stackalloc nint[x.
Rank
];
2215
TensorSpanHelpers.AdjustIndexes(x.
Rank
- 1, 1, curIndex, x.Lengths);
2238
if (y.
Rank
> TensorShape.MaxInlineRank)
2240
curIndexArray = ArrayPool<nint>.Shared.Rent(y.
Rank
);
2241
curIndex = curIndexArray.AsSpan(0, y.
Rank
);
2246
curIndex = stackalloc nint[y.
Rank
];
2254
TensorSpanHelpers.AdjustIndexes(y.
Rank
- 1, 1, curIndex, y.Lengths);
2284
if (broadcastedRight.
Rank
> TensorShape.MaxInlineRank)
2287
curIndex = curIndexArray.AsSpan(0, broadcastedRight.
Rank
);
2300
TensorSpanHelpers.AdjustIndexes(broadcastedRight.
Rank
- 1, 1, curIndex, broadcastedRight.Lengths);
2323
if (x.
Rank
> TensorShape.MaxInlineRank)
2325
curIndexArray = ArrayPool<nint>.Shared.Rent(x.
Rank
);
2326
curIndex = curIndexArray.AsSpan(0, x.
Rank
);
2331
curIndex = stackalloc nint[x.
Rank
];
2339
TensorSpanHelpers.AdjustIndexes(x.
Rank
- 1, 1, curIndex, x.Lengths);
2362
if (y.
Rank
> TensorShape.MaxInlineRank)
2364
curIndexArray = ArrayPool<nint>.Shared.Rent(y.
Rank
);
2365
curIndex = curIndexArray.AsSpan(0, y.
Rank
);
2370
curIndex = stackalloc nint[y.
Rank
];
2378
TensorSpanHelpers.AdjustIndexes(y.
Rank
- 1, 1, curIndex, y.Lengths);
2407
if (broadcastedRight.
Rank
> TensorShape.MaxInlineRank)
2410
curIndex = curIndexArray.AsSpan(0, broadcastedRight.
Rank
);
2423
TensorSpanHelpers.AdjustIndexes(broadcastedRight.
Rank
- 1, 1, curIndex, broadcastedRight.Lengths);
2446
if (x.
Rank
> TensorShape.MaxInlineRank)
2448
curIndexArray = ArrayPool<nint>.Shared.Rent(x.
Rank
);
2449
curIndex = curIndexArray.AsSpan(0, x.
Rank
);
2454
curIndex = stackalloc nint[x.
Rank
];
2462
TensorSpanHelpers.AdjustIndexes(x.
Rank
- 1, 1, curIndex, x.Lengths);
2485
if (y.
Rank
> TensorShape.MaxInlineRank)
2487
curIndexArray = ArrayPool<nint>.Shared.Rent(y.
Rank
);
2488
curIndex = curIndexArray.AsSpan(0, y.
Rank
);
2493
curIndex = stackalloc nint[y.
Rank
];
2501
TensorSpanHelpers.AdjustIndexes(y.
Rank
- 1, 1, curIndex, y.Lengths);
2530
if (broadcastedRight.
Rank
> TensorShape.MaxInlineRank)
2533
curIndex = curIndexArray.AsSpan(0, broadcastedRight.
Rank
);
2546
TensorSpanHelpers.AdjustIndexes(broadcastedRight.
Rank
- 1, 1, curIndex, broadcastedRight.Lengths);
2569
if (x.
Rank
> TensorShape.MaxInlineRank)
2571
curIndexArray = ArrayPool<nint>.Shared.Rent(x.
Rank
);
2572
curIndex = curIndexArray.AsSpan(0, x.
Rank
);
2577
curIndex = stackalloc nint[x.
Rank
];
2585
TensorSpanHelpers.AdjustIndexes(x.
Rank
- 1, 1, curIndex, x.Lengths);
2608
if (y.
Rank
> TensorShape.MaxInlineRank)
2610
curIndexArray = ArrayPool<nint>.Shared.Rent(y.
Rank
);
2611
curIndex = curIndexArray.AsSpan(0, y.
Rank
);
2616
curIndex = stackalloc nint[y.
Rank
];
2624
TensorSpanHelpers.AdjustIndexes(y.
Rank
- 1, 1, curIndex, y.Lengths);
2910
if (lengthOffset < tensor.
Rank
&& arrLengths[i] == tensor.Lengths[lengthOffset])
2914
if (lengthOffset == tensor.
Rank
)
3073
if (tensor.
Rank
> 6)
3075
oIndicesArray = ArrayPool<nint>.Shared.Rent(tensor.
Rank
);
3076
oIndices = oIndicesArray.AsSpan(0, tensor.
Rank
);
3079
iIndicesArray = ArrayPool<nint>.Shared.Rent(tensor.
Rank
);
3080
iIndices = iIndicesArray.AsSpan(0, tensor.
Rank
);
3086
oIndices = stackalloc nint[tensor.
Rank
];
3088
iIndices = stackalloc nint[tensor.
Rank
];
3213
if (tensor.
Rank
> 6)
3215
oIndicesArray = ArrayPool<nint>.Shared.Rent(tensor.
Rank
);
3216
oIndices = oIndicesArray.AsSpan(0, tensor.
Rank
);
3219
iIndicesArray = ArrayPool<nint>.Shared.Rent(tensor.
Rank
);
3220
iIndices = iIndicesArray.AsSpan(0, tensor.
Rank
);
3226
oIndices = stackalloc nint[tensor.
Rank
];
3228
iIndices = stackalloc nint[tensor.
Rank
];
3392
if (dimension >= tensor.
Rank
)
3563
if (maximumLengths.Length != tensor.
Rank
)
3568
if (tensor.
Rank
> 6)
3570
curIndexesArray = ArrayPool<nint>.Shared.Rent(tensor.
Rank
);
3571
curIndexes = curIndexesArray.AsSpan(0, tensor.
Rank
);
3577
curIndexes = stackalloc nint[tensor.
Rank
];
3582
T[] values = new T[tensor.Lengths[tensor.
Rank
- 1]];
3585
var sp = new ReadOnlyTensorSpan<T>(ref Unsafe.Add(ref tensor._reference, TensorSpanHelpers.ComputeLinearIndex(curIndexes, tensor.Strides, tensor.Lengths)), [tensor.Lengths[tensor.
Rank
- 1]], [1], tensor.Lengths[tensor.
Rank
- 1]);
3591
TensorSpanHelpers.AdjustIndexes(tensor.
Rank
- 2, 1, curIndexes, tensor.Lengths);
3592
copiedValues += tensor.Lengths[tensor.
Rank
- 1];
3758
dimension = tensor.
Rank
- dimension;
3770
if (dimension == tensor.
Rank
)
4660
if (x.
Rank
!= 2)
4663
if (y.
Rank
!= 2)
4690
if (x.
Rank
!= 2)
4693
if (y.
Rank
!= 2)
6944
curIndex = curIndexArray.AsSpan(0, input.
Rank
);
6962
TensorSpanHelpers.AdjustIndexes(input.
Rank
- 2, 1, curIndex, input.Lengths);
6996
curIndex = curIndexArray.AsSpan(0, input.
Rank
);
7014
TensorSpanHelpers.AdjustIndexes(input.
Rank
- 2, 1, curIndex, input.Lengths);
7048
curIndex = curIndexArray.AsSpan(0, input.
Rank
);
7066
TensorSpanHelpers.AdjustIndexes(input.
Rank
- 2, 1, curIndex, input.Lengths);
7134
TensorSpanHelpers.AdjustIndexes(broadcastedLeft.
Rank
- 2, 1, curIndex, broadcastedLeft.Lengths);
7147
TensorSpanHelpers.AdjustIndexes(broadcastedLeft.
Rank
- 2, 1, curIndex, broadcastedLeft.Lengths);
7160
TensorSpanHelpers.AdjustIndexes(broadcastedLeft.
Rank
- 2, 1, curIndex, broadcastedLeft.Lengths);
7174
TensorSpanHelpers.AdjustIndexes(broadcastedLeft.
Rank
- 2, 1, curIndex, broadcastedLeft.Lengths);
System\Numerics\Tensors\netcore\TensorSpan.cs (4)
593
int indexToAdjust = srcSlice.Strides[^1] == 1 && TensorHelpers.IsContiguousAndDense(srcSlice) ? srcSlice.
Rank
- 2 : srcSlice.
Rank
- 1;
647
int indexToAdjust = srcSlice.Strides[^1] == 1 && TensorHelpers.IsContiguousAndDense(srcSlice) ? srcSlice.
Rank
- 2 : srcSlice.
Rank
- 1;