Skip to content

Conversation

@PaulXiCao
Copy link
Contributor

Closes #1566 .

The method Matrix::abs_diff_eq did not assert the matrix shapes before comparing entries via the zipped iterator loop. The shape assertion is done via assert!() as done in similar functions, e.g. Matrix::relative_eq.

Added tests for one standard usage case as well as non-matching shapes (asserting the panic).

@Ralith
Copy link
Collaborator

Ralith commented Nov 2, 2025

Wouldn't it make more sense to return false? It's not obvious to me that comparing dynamically-sized matrices of different size is necessarily a bug.

@PaulXiCao
Copy link
Contributor Author

PaulXiCao commented Nov 3, 2025

@Ralith I also think so that returning false instead of panicking would be a nicer behavior. But for consistency I stayed with panicking.

Should we use panicking in this mr and create a followup case to discuss switching from panicking to returning boolean false for all relevant functions?

@Ralith
Copy link
Collaborator

Ralith commented Nov 3, 2025

That makes sense to me!

@Ralith Ralith merged commit 57b83b8 into dimforge:main Nov 3, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Comparison of vectors with abs_diff_eq does not take length into account

2 participants