diff --git a/CMakeLists.txt b/CMakeLists.txt index f36d95b..f32a570 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,7 @@ list(APPEND extra_libs fmt::fmt) FetchContent_Declare( platanus GIT_REPOSITORY https://github.com/sukeya/platanus.git - GIT_TAG 23a9ba9cd6bfe38b01fd7e87e28ae42dd8b2744f # origin/main + GIT_TAG 0a0f3c93a637263c0479a398d54564a74c9ad694 # origin/main ) FetchContent_MakeAvailable(platanus) list(APPEND extra_libs platanus) diff --git a/include/mvPolynomial/index_comparer.hpp b/include/mvPolynomial/index_comparer.hpp index e24df20..130b635 100644 --- a/include/mvPolynomial/index_comparer.hpp +++ b/include/mvPolynomial/index_comparer.hpp @@ -24,17 +24,17 @@ class IndexComparer final { static constexpr int dim = D; /** - * \brief If lhd[i] == rhd[i] for i = 0, ..., N - 1 and lhd[N] > rhd[N], - * return greater: if lhd[N] < rhd[N], return less: otherwise, return equal. + * \brief If lhd[i] == rhd[i] for i = 0, ..., N - 1 and lhd[N] < rhd[N], + * return greater: if lhd[N] > rhd[N], return less: otherwise, return equal. * \param[in] lhd an index * \param[in] rhd an index */ static constexpr std::strong_ordering Compare(const Index& lhd, const Index& rhd) { for (std::size_t i = 0; i < lhd.size(); ++i) { auto comp = lhd[i] <=> rhd[i]; - if (comp > 0) { + if (comp < 0) { return std::strong_ordering::greater; - } else if (comp < 0) { + } else if (comp > 0) { return std::strong_ordering::less; } } @@ -42,16 +42,16 @@ class IndexComparer final { } /** - * \brief If lhd[i] == rhd[i] for i = 0, ..., N - 1 and lhd[N] > rhd[N], + * \brief If lhd[i] == rhd[i] for i = 0, ..., N - 1 and lhd[N] < rhd[N], * return true: otherwise, false. * \param[in] lhd an index * \param[in] rhd an index */ bool operator()(const Index& lhd, const Index& rhd) const { for (std::size_t i = 0; i < lhd.size(); ++i) { - if (lhd[i] > rhd[i]) { + if (lhd[i] < rhd[i]) { return true; - } else if (lhd[i] < rhd[i]) { + } else if (lhd[i] > rhd[i]) { return false; } } diff --git a/include/mvPolynomial/mvPolynomial.hpp b/include/mvPolynomial/mvPolynomial.hpp index 5803a87..3d19832 100644 --- a/include/mvPolynomial/mvPolynomial.hpp +++ b/include/mvPolynomial/mvPolynomial.hpp @@ -50,7 +50,6 @@ auto OfImpl(Iterator begin, Iterator end, int dim, int axis, const Coord& x) { return pair.first[axis] == first_index[axis]; } ); - const auto& [p_index, p_coeff] = *partition_point; sum += OfImpl(begin, partition_point, dim, axis + 1, x); if (partition_point == end) { // The calculation ends. @@ -259,7 +258,7 @@ class MVPolynomial final { return index2value_.upper_bound(i); } - R operator()(const coord_type& x) const { return OfImpl(cbegin(), cend(), dim, 0, x); } + R operator()(const coord_type& x) const { return OfImpl(crbegin(), crend(), dim, 0, x); } MVPolynomial operator+() const { return *this; } @@ -352,9 +351,9 @@ class MVPolynomial final { private: void CheckSelfIndexes() const { - // The last index is the lowest index of all index, + // The first index is the lowest index of all index, // so I only have to check if each of its elements is non-negative. - if ((std::prev(index2value_.end())->first < 0).any()) { + if ((index2value_.begin()->first < 0).any()) { throw std::invalid_argument(fmt::format("Negative index not supported!")); } }