Function navtk::utils::diff(const std::string&, const std::string&, const Matrix&, const Matrix&, double, double)
Defined in File human_readable.hpp
Function Documentation
-
std::string navtk::utils::diff(const std::string &before_name, const std::string &after_name, const Matrix &before, const Matrix &after, double rtol = 1e-05, double atol = 1e-08)
Returns a human-readable description of the difference between two matrices.
Returns an empty string if
xt::allclose(before, after, rtol, atol).In general, most code should use
xt::allcloseorxt::iscloseinstead. This function exists primarily for use from within gdb and unit tests.When possible, the output will also be valid c++ code, assigning the value of
beforetoafter, and then making changes to match the value ofafter. For example,diff("in", "out", xt::eye(3), xt::eye(3) * 2)will yield:out = in; out(0, 0) = 2; // in(0, 0) == 1 out(1, 1) = 2; // in(1, 1) == 1 out(2, 2) = 2; // in(2, 2) == 1
Special cases exist for transposes and mismatched dimensionality.
- Parameters
before_name – A name to use in describing the
beforematrix.after_name – A name to use in describing the
aftermatrix.before – Matrix supplying ‘expected’ data.
after – Matrix supplying ‘actual’ data.
rtol –
xt::isclose’s relative tolerance parameter (default 1e-05).atol –
xt::isclose’s absolute tolerance parameter (default 1e-08).
- Returns
Human-readable description of the difference between two matrices.