Skip to content
Merged
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
15 changes: 4 additions & 11 deletions include/mvPolynomial/mvPolynomial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class MVPolynomial final {
: index2value_(std::move(m.index2value_), a) {}

MVPolynomial& operator=(std::initializer_list<value_type> l) {
index2value_.clear();
index2value_.insert(l.begin(), l.end());
CheckSelfIndexes();
return *this;
Expand Down Expand Up @@ -188,13 +189,6 @@ class MVPolynomial final {
mapped_type& operator[](const key_type& index) { return index2value_[index]; }
mapped_type& operator[](key_type&& index) { return index2value_[index]; }

const mapped_type& operator[](const key_type& index) const {
return const_cast<MVPolynomial*>(this)->operator[](index);
}
const mapped_type& operator[](key_type&& index) const {
return const_cast<MVPolynomial*>(this)->operator[](index);
}

mapped_type& at(const key_type& i) { return index2value_.at(i); }
const mapped_type& at(const key_type& i) const { return index2value_.at(i); }

Expand Down Expand Up @@ -371,10 +365,9 @@ class MVPolynomial final {

MVPolynomial& operator*=(mapped_type r) {
auto idx = index_type::Zero();
if (contains(idx)) {
(*this)[idx] *= r;
} else {
(*this)[idx] = r;
for (auto& index_and_coeff : *this) {
auto& coeff = index_and_coeff.second;
coeff *= 2;
}
return *this;
}
Expand Down