You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
y is multiplied by both width and depth, x is only multiplied by depth, and z isn't multiplied by anything.
The indexing of get is consistent with set, which is why it hasn't been caught until now. The problem comes when you try to index after a reshape, which is how I discovered the problem. If you reshape a 3D array into a 2D array, you can't get results that make sense.
since that is consistent with the existing indexing order for 2D arrays.
Has anyone ever decided whether integer_array_t stores data in row-major or column-major order? The indexing for 2D arrays suggests column-major, but that goes against C and Python. It seems like that is something that should be documented and guaranteed.
The text was updated successfully, but these errors were encountered:
The indexing order for the 3D version of
integer_array_t
doesn't make any sense. You can see the code forget
here:vunit/vunit/vhdl/data_types/src/integer_array_pkg-body.vhd
Line 219 in 3032da0
y
is multiplied by bothwidth
anddepth
,x
is only multiplied bydepth
, andz
isn't multiplied by anything.The indexing of
get
is consistent withset
, which is why it hasn't been caught until now. The problem comes when you try to index after areshape
, which is how I discovered the problem. If you reshape a 3D array into a 2D array, you can't get results that make sense.The "obvious" solution would be
But this solution would end up inconsistent with the 2D version of
get
:vunit/vunit/vhdl/data_types/src/integer_array_pkg-body.vhd
Line 208 in 3032da0
I'm not really sure what to do here. It seems like the change that would be least likely to break existing code would be
since that is consistent with the existing indexing order for 2D arrays.
Has anyone ever decided whether
integer_array_t
stores data in row-major or column-major order? The indexing for 2D arrays suggests column-major, but that goes against C and Python. It seems like that is something that should be documented and guaranteed.The text was updated successfully, but these errors were encountered: