Skip to content

Commit

Permalink
Product::operator<
Browse files Browse the repository at this point in the history
  • Loading branch information
ohhmm committed Oct 6, 2024
1 parent bdf7026 commit 0f78625
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion omnn/math/Product.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,10 @@ namespace math {
}
}

bool Product::operator<(const Product& v) const {
LOG_AND_IMPLEMENT(*this << " < " << v);
}

bool Product::operator<(const Valuable& v) const{
auto beg = begin();
if (members.size() == 1) {
Expand All @@ -1124,7 +1128,13 @@ namespace math {
if(!isLess){
if (sign > vSign) {
} else { // same signs
LOG_AND_IMPLEMENT(*this << " < " << v);
if (v.IsProduct()) {
isLess = operator<(v.as<Product>());
} else if (Has(v)) {
isLess = *this / v < constants::one;
} else {
LOG_AND_IMPLEMENT(*this << " < " << v);
}
}
}
} else {
Expand Down
1 change: 1 addition & 0 deletions omnn/math/Product.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class Product
Valuable& operator ^=(const Valuable& v) override;
bool operator ==(const Product& v) const;
bool operator ==(const Valuable& v) const override;
bool operator<(const Product& v) const;
bool operator<(const Valuable& v) const override;
Valuable Sign() const override;
Valuable ToBool() const override;
Expand Down

0 comments on commit 0f78625

Please sign in to comment.