New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic matrixcompare functionality #631
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that looks very useful!
Why is the message method called panic_message
at some places? I guess this does not panic, so would it make more sense to call this something like failure_message?
Or perhaps compare_matrices
could return a Result<(), MatrixComparisonFailure>
, where MatrixComparisonFailure
would have its Match
variant removed, and would implement Display
and Error
?
Thanks for having a look! You're right, EDIT: Also thanks for your suggestion about copy instead of clone. I somehow switched around the name in the commit messages though, oops. Will fix this later too. |
@sebcrozet: I finally managed to revisit this PR. I made the changes you suggested earlier, and matrixcompare has now been released on
The I'm not sure how to really do it with features etc. I added a "compare" feature which would toggle the I see that the CI fails for |
Thank you for this PR! The CI failure when targeting |
Thanks! |
Note: this is not ready for merging. I'm posting it here for some initial feedback.Update: This is in principle finalized and ready for merging (barring minor issues, see below).
This PR provides
matrixcompare
functionality fornalgebra
.matrixcompare
is a crate which aims to provide generic functionality for debug comparisons of matrices. A consumer crate likenalgebra
only needs to define how many rows/columns a matrix has and how to fetch coefficients. Macros likeassert_matrix_eq!
then makes it easy to compare matrices with different kinds of comparators (absolute tolerance, relative tolerance etc.), which significantly simplifies debugging when writing unit tests involving linear algebra code.matrixcompare
is the result of extracting, rewriting and generalizing similar functionality found in therulinalg
crate (and also originally contributed by me).Note that
matrixcompare
is currently not published, and is also not complete. Obviously, this will have to be remedied before this PR can be merged. I open it now so that I can perhaps have some initial feedback (including CI runs).Below is an excerpt from one of the new tests.
And this is the output (format subject to change) at the time of writing: