Skip to content

Checking equality on array with different layout #1202

Answered by jturner314
zkrzyzanowski asked this question in Q&A
Discussion options

You must be logged in to vote

To clarify, my comment on #1198 was specifically about the text "CFcf" in the debug-formatted string being an implementation detail, not the layout itself. The layout itself can be important and is not just an implementation detail. While the memory layout of an array doesn't affect the results of most methods, it does affect performance (iterating over an array is fastest in memory order) and it does affect the results of a few methods, such as as_slice_memory_order.

To answer your question -- similar to how arithmetic operations work elementwise, comparisons also operate on the corresponding elements of the arrays (i.e. those at the same n-D index), regardless of layout. (PartialEq is i…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by zkrzyzanowski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants