Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions include/mvPolynomial/index_comparer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,34 @@ 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;
}
}
return std::strong_ordering::equal;
}

/**
* \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;
}
}
Expand Down
7 changes: 3 additions & 4 deletions include/mvPolynomial/mvPolynomial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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; }

Expand Down Expand Up @@ -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!"));
}
}
Expand Down