Skip to content

Commit 3e4f7b7

Browse files
committed
Shape.GetCoordinates: cleaned up and moved absolute offset conversion into own method
1 parent e74efba commit 3e4f7b7

File tree

4 files changed

+292
-105
lines changed

4 files changed

+292
-105
lines changed

src/NumSharp.Core/View/Shape.Unmanaged.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public unsafe int GetOffset(int* indices, int ndims)
4848
{
4949
// we are dealing with an unsliced recursively reshaped slice
5050
offset = GetOffset_IgnoreViewInfo(indices, ndims);
51-
var parent_coords = vi.ParentShape.GetCoordinates(offset, ignore_view_info: true);
51+
var parent_coords = vi.ParentShape.GetCoordinates(offset);
5252
return vi.ParentShape.GetOffset(parent_coords);
5353
}
5454

@@ -105,7 +105,7 @@ public unsafe int GetOffset(int* indices, int ndims)
105105
if (!IsRecursive)
106106
return offset;
107107
// we are dealing with a sliced recursively reshaped slice
108-
var parent_coords1 = vi.ParentShape.GetCoordinates(offset, ignore_view_info: true);
108+
var parent_coords1 = vi.ParentShape.GetCoordinates(offset);
109109
return vi.ParentShape.GetOffset(parent_coords1);
110110
}
111111

@@ -224,7 +224,7 @@ private unsafe int GetOffset_broadcasted(int* indices, int ndims)
224224
{
225225
// we are dealing with an unsliced recursively reshaped slice
226226
offset = GetOffset_IgnoreViewInfo(indices, ndims);
227-
var parent_coords = vi.ParentShape.GetCoordinates(offset, ignore_view_info: true);
227+
var parent_coords = vi.ParentShape.GetCoordinates(offset);
228228
return vi.ParentShape.GetOffset(parent_coords);
229229
}
230230

@@ -304,7 +304,7 @@ private unsafe int GetOffset_broadcasted(int* indices, int ndims)
304304
if (!IsRecursive)
305305
return offset;
306306
// we are dealing with a sliced recursively reshaped slice
307-
var parent_coords1 = vi.ParentShape.GetCoordinates(offset, ignore_view_info: true);
307+
var parent_coords1 = vi.ParentShape.GetCoordinates(offset);
308308
return vi.ParentShape.GetOffset(parent_coords1);
309309
}
310310

0 commit comments

Comments
 (0)