Skip to content

Commit

Permalink
Attempt to fix all_close in another way.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivorforce committed Nov 11, 2024
1 parent 74e50d5 commit 0ee99ce
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/vatensor/comparison.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
#include "xtensor/xmath.hpp" // for layout_type
#include "xtensor/xlayout.hpp" // for layout_type
#include "xtensor/xoperation.hpp" // for equal_to
// See below
#ifdef _WIN32
#include "xtensor_store.hpp"
#include "reduce.hpp"
#endif

using namespace va;

Expand Down Expand Up @@ -262,16 +267,8 @@ bool va::all_close(const VData& a, const VData& b, double rtol, double atol, boo

return ::all_close(a, b, rtol, atol, equal_nan);
#else
return va::vreduce<
Feature::all_close,
promote::common_in_nat_out,
bool
>(
[rtol, atol, equal_nan](auto&& a, auto&& b) -> bool {
return xt::all(xt::isclose(std::forward<decltype(a)>(a), std::forward<decltype(b)>(b), rtol, atol, equal_nan));
},
a,
b
);
std::shared_ptr<VArray> intermediate;
::is_close(va::store::default_allocator, &intermediate, a, b, rtol, atol, equal_nan);
return va::all(intermediate->data);
#endif
}

0 comments on commit 0ee99ce

Please sign in to comment.