Skip to content

Commit

Permalink
Balance Polynomial Coefficients for grade > 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ohhmm committed Feb 3, 2024
1 parent 1bafafb commit 59a5490
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions omnn/math/Sum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1361,10 +1361,23 @@ namespace
}

if (grade > 2) {
auto lcm = constants::one;
OptimizeOn oo;
for (auto& c : coefficients) {
c.optimize();
if (c.IsFraction()) {
auto& f = c.as<Fraction>();
auto& dn = f.getDenominator();
if (dn != constants::one) {
lcm.lcm(dn);
}
}
}
if (lcm != constants::one) {
for (auto& c : coefficients) {
c *= lcm;
}
}
}

return grade;
Expand Down Expand Up @@ -1874,6 +1887,10 @@ namespace
}
}

if (lcm != constants::one) {
LOG_AND_IMPLEMENT("Coefficients meant to be balanced before solving");
}

if(GetView() != View::Solving && GetView() != View::Equation) {
// auto
}
Expand Down

0 comments on commit 59a5490

Please sign in to comment.