From d942e0a5cf7f8577f91d9c0fc0a7fc41f80bc937 Mon Sep 17 00:00:00 2001 From: Ted Turocy Date: Fri, 3 Jan 2025 16:17:58 +0000 Subject: [PATCH] Formatting --- src/solvers/enumpoly/gpartltr.imp | 15 ++++++--------- src/solvers/enumpoly/gpoly.imp | 25 ++++++++++++++++--------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/solvers/enumpoly/gpartltr.imp b/src/solvers/enumpoly/gpartltr.imp index fa7a3b5ca..1c9be7703 100644 --- a/src/solvers/enumpoly/gpartltr.imp +++ b/src/solvers/enumpoly/gpartltr.imp @@ -29,8 +29,7 @@ using namespace Gambit; //--------------------------------------------------------------- /// Recursive generation of all partial derivatives of the root polynomial -template -void TreeOfPartials::BuildTree(Node &n) +template void TreeOfPartials::BuildTree(Node &n) { if (n.data.Degree() >= 1) { for (int i = 1; i <= n.data.GetDimension(); i++) { @@ -50,10 +49,9 @@ T TreeOfPartials::ValueOfPartialOfRootPoly(const int coord, const Vector & } template -T TreeOfPartials::MaximalNonconstantContribution(const Node &n, - const Vector &p, - const Vector &halvesoflengths, - Vector &wrtos) const +T TreeOfPartials::MaximalNonconstantContribution(const Node &n, const Vector &p, + const Vector &halvesoflengths, + Vector &wrtos) const { T answer = static_cast(0); int i = 1; @@ -97,9 +95,8 @@ template bool TreeOfPartials::PolyHasNoRootsIn(const Rectangle & template bool TreeOfPartials::MultiaffinePolyHasNoRootsIn(const Rectangle &r) const { - T sign = (m_treeroot.data.Evaluate(r.Center()) > static_cast(0)) - ? static_cast(1) - : static_cast(-1); + T sign = (m_treeroot.data.Evaluate(r.Center()) > static_cast(0)) ? static_cast(1) + : static_cast(-1); Array zeros(GetDimension()); std::fill(zeros.begin(), zeros.end(), 0); diff --git a/src/solvers/enumpoly/gpoly.imp b/src/solvers/enumpoly/gpoly.imp index 43d1f5a72..199fefd64 100644 --- a/src/solvers/enumpoly/gpoly.imp +++ b/src/solvers/enumpoly/gpoly.imp @@ -33,7 +33,8 @@ //------------------------------------------------------------- template -List> Polynomial::Adder(const List> &One, const List> &Two) const +List> Polynomial::Adder(const List> &One, + const List> &Two) const { if (One.empty()) { return Two; @@ -78,7 +79,8 @@ List> Polynomial::Adder(const List> &One, const List< } template -List> Polynomial::Mult(const List> &One, const List> &Two) const +List> Polynomial::Mult(const List> &One, + const List> &Two) const { List> answer; @@ -165,7 +167,8 @@ template Polynomial Polynomial::DivideByPolynomial(const Polynom while (remainder != zero) { Polynomial quot = remainder.LeadingCoefficient(last) / den.LeadingCoefficient(last); - Polynomial power_of_last(Space, last, remainder.DegreeOfVar(last) - den.DegreeOfVar(last)); + Polynomial power_of_last(Space, last, + remainder.DegreeOfVar(last) - den.DegreeOfVar(last)); result += quot * power_of_last; remainder -= quot * power_of_last * den; } @@ -203,14 +206,15 @@ template Polynomial Polynomial::LeadingCoefficient(int varnumber for (size_t j = 1; j <= Terms.size(); j++) { if (Terms[j].ExpV()[varnumber] == degree) { newPoly.Terms.push_back( - Monomial(Terms[j].Coef(), Terms[j].ExpV().WithZeroExponent(varnumber))); + Monomial(Terms[j].Coef(), Terms[j].ExpV().WithZeroExponent(varnumber))); } } return newPoly; } template -Polynomial Polynomial::TranslateOfMono(const Monomial &m, const Vector &new_origin) const +Polynomial Polynomial::TranslateOfMono(const Monomial &m, + const Vector &new_origin) const { Polynomial answer(GetSpace(), static_cast(1)); for (int i = 1; i <= GetDimension(); i++) { @@ -236,7 +240,8 @@ template Polynomial Polynomial::TranslateOfPoly(const Vector } template -Polynomial Polynomial::MonoInNewCoordinates(const Monomial &m, const SquareMatrix &M) const +Polynomial Polynomial::MonoInNewCoordinates(const Monomial &m, + const SquareMatrix &M) const { Polynomial answer(Space, static_cast(1)); @@ -256,7 +261,8 @@ Polynomial Polynomial::MonoInNewCoordinates(const Monomial &m, const Sq return answer; } -template Polynomial Polynomial::PolyInNewCoordinates(const SquareMatrix &M) const +template +Polynomial Polynomial::PolyInNewCoordinates(const SquareMatrix &M) const { Polynomial answer(Space); for (const auto &term : Terms) { @@ -279,8 +285,9 @@ template T Polynomial::MaximalValueOfNonlinearPart(const T &radius) template Polynomial Polynomial::Normalize() const { auto maxcoeff = - std::max_element(Terms.begin(), Terms.end(), - [](const Monomial &a, const Monomial &b) { return a.Coef() < b.Coef(); }); + std::max_element(Terms.begin(), Terms.end(), [](const Monomial &a, const Monomial &b) { + return a.Coef() < b.Coef(); + }); if (maxcoeff->Coef() < static_cast(0.000000001)) { return *this; }