From 75deec271149687f0178859a23ea163b8b5d83b0 Mon Sep 17 00:00:00 2001 From: fintarin Date: Fri, 5 Apr 2024 00:57:37 +0400 Subject: [PATCH] Renaming --- include/fintamath/expressions/IExpression.hpp | 4 ++-- src/fintamath/expressions/Expression.cpp | 2 +- src/fintamath/expressions/IExpression.cpp | 10 +++++----- src/fintamath/expressions/binary/CompExpr.cpp | 4 ++-- src/fintamath/expressions/binary/LogExpr.cpp | 8 ++++---- src/fintamath/expressions/binary/LogExpr.hpp | 2 +- src/fintamath/expressions/binary/PowExpr.cpp | 12 ++++++------ src/fintamath/expressions/binary/PowExpr.hpp | 2 +- src/fintamath/expressions/unary/FloorCeilExpr.cpp | 6 +++--- src/fintamath/expressions/unary/FloorCeilExpr.hpp | 2 +- src/fintamath/expressions/unary/SignExpr.cpp | 6 +++--- src/fintamath/expressions/unary/SignExpr.hpp | 2 +- tests/src/expressions/IExpressionTests.cpp | 2 +- 13 files changed, 31 insertions(+), 31 deletions(-) diff --git a/include/fintamath/expressions/IExpression.hpp b/include/fintamath/expressions/IExpression.hpp index 5ab17d38e..21f47b3be 100644 --- a/include/fintamath/expressions/IExpression.hpp +++ b/include/fintamath/expressions/IExpression.hpp @@ -42,7 +42,7 @@ class IExpression : public IMathObject { virtual ArgumentPtr postSimplify() const; - virtual ArgumentPtr approximateSimplify() const; + virtual ArgumentPtr approximate() const; virtual ArgumentPtr setPrecision(unsigned precision, const Integer &maxInt) const; @@ -52,7 +52,7 @@ class IExpression : public IMathObject { static void postSimplifyChild(ArgumentPtr &child); - static void approximateSimplifyChild(ArgumentPtr &child); + static void approximateChild(ArgumentPtr &child); static void setPrecisionChild(ArgumentPtr &child, unsigned precision, const Integer &maxInt); diff --git a/src/fintamath/expressions/Expression.cpp b/src/fintamath/expressions/Expression.cpp index 34f99ace3..377f927c8 100644 --- a/src/fintamath/expressions/Expression.cpp +++ b/src/fintamath/expressions/Expression.cpp @@ -70,7 +70,7 @@ Expression approximate(const Expression &rhs, const unsigned precision) { }); Expression approxExpr = rhs; - Expression::approximateSimplifyChild(approxExpr.child); + Expression::approximateChild(approxExpr.child); Expression::setPrecisionChild(approxExpr.child, precision, cache[precision]); approxExpr.updateStringMutable(); diff --git a/src/fintamath/expressions/IExpression.cpp b/src/fintamath/expressions/IExpression.cpp index 182018937..5a358a5d4 100644 --- a/src/fintamath/expressions/IExpression.cpp +++ b/src/fintamath/expressions/IExpression.cpp @@ -133,12 +133,12 @@ void IExpression::postSimplifyChild(ArgumentPtr &child) { } } -void IExpression::approximateSimplifyChild(ArgumentPtr &child) { +void IExpression::approximateChild(ArgumentPtr &child) { if (const auto constChild = cast(child)) { child = (*constChild)(); } else if (const auto exprChild = cast(child)) { - child = exprChild->approximateSimplify(); + child = exprChild->approximate(); } } @@ -292,11 +292,11 @@ ArgumentPtr IExpression::postSimplify() const { return {}; } -ArgumentPtr IExpression::approximateSimplify() const { +ArgumentPtr IExpression::approximate() const { ArgumentPtr simpl = simplify(); if (!is(simpl)) { - approximateSimplifyChild(simpl); + approximateChild(simpl); return simpl; } @@ -307,7 +307,7 @@ ArgumentPtr IExpression::approximateSimplify() const { size_t numberChildrenCount = 0; for (auto &child : approxChildren) { - approximateSimplifyChild(child); + approximateChild(child); if (const auto childNum = cast(child)) { numberChildrenCount++; diff --git a/src/fintamath/expressions/binary/CompExpr.cpp b/src/fintamath/expressions/binary/CompExpr.cpp index e5e4c9126..e7f16fc07 100644 --- a/src/fintamath/expressions/binary/CompExpr.cpp +++ b/src/fintamath/expressions/binary/CompExpr.cpp @@ -229,7 +229,7 @@ ArgumentPtr CompExpr::rateSimplify(const IFunction &func, const ArgumentPtr &lhs ArgumentPtr newLhs = makePolynom(Add{}, std::move(children)); simplifyChild(newLhs); - approximateSimplifyChild(rate); + approximateChild(rate); if (isNegativeNumber(rate)) { return makeExpr(*cast(getOppositeFunction(func)), newLhs, rhs); } @@ -243,7 +243,7 @@ ArgumentPtr CompExpr::approxSimplify(const IFunction &func, const ArgumentPtr &l } ArgumentPtr approxLhs = lhs; - approximateSimplifyChild(approxLhs); + approximateChild(approxLhs); if (!is(approxLhs)) { return {}; } diff --git a/src/fintamath/expressions/binary/LogExpr.cpp b/src/fintamath/expressions/binary/LogExpr.cpp index 971ce1609..236174e10 100644 --- a/src/fintamath/expressions/binary/LogExpr.cpp +++ b/src/fintamath/expressions/binary/LogExpr.cpp @@ -46,13 +46,13 @@ const std::shared_ptr &LogExpr::getOutputFunction() const { return IBinaryExpression::getFunction(); } -ArgumentPtr LogExpr::approximateSimplify() const { +ArgumentPtr LogExpr::approximate() const { if (*lhsChild == E{}) { const auto approxExpr = cast(clone()); - approximateSimplifyChild(approxExpr->rhsChild); + approximateChild(approxExpr->rhsChild); if (is(approxExpr->rhsChild)) { - if (const auto res = cast(approxExpr->IBinaryExpression::approximateSimplify())) { + if (const auto res = cast(approxExpr->IBinaryExpression::approximate())) { return res; } } @@ -60,7 +60,7 @@ ArgumentPtr LogExpr::approximateSimplify() const { return approxExpr->simplify(); } - return IBinaryExpression::approximateSimplify(); + return IBinaryExpression::approximate(); } ArgumentPtr LogExpr::setPrecision(const unsigned precision, const Integer &maxInt) const { diff --git a/src/fintamath/expressions/binary/LogExpr.hpp b/src/fintamath/expressions/binary/LogExpr.hpp index 8fa11eb98..57bc9b178 100644 --- a/src/fintamath/expressions/binary/LogExpr.hpp +++ b/src/fintamath/expressions/binary/LogExpr.hpp @@ -22,7 +22,7 @@ class LogExpr final : public IBinaryExpressionCRTP { const std::shared_ptr &getOutputFunction() const override; protected: - ArgumentPtr approximateSimplify() const override; + ArgumentPtr approximate() const override; ArgumentPtr setPrecision(unsigned precision, const Integer &maxInt) const override; diff --git a/src/fintamath/expressions/binary/PowExpr.cpp b/src/fintamath/expressions/binary/PowExpr.cpp index fd7e1c866..647f8bbe7 100644 --- a/src/fintamath/expressions/binary/PowExpr.cpp +++ b/src/fintamath/expressions/binary/PowExpr.cpp @@ -96,19 +96,19 @@ const std::shared_ptr &PowExpr::getOutputFunction() const { return IBinaryExpression::getFunction(); } -ArgumentPtr PowExpr::approximateSimplify() const { +ArgumentPtr PowExpr::approximate() const { if (const auto ratRhsChild = cast(rhsChild); ratRhsChild && ratRhsChild->denominator() <= maxPreciseRoot) { auto approxExpr = cast(clone()); - approximateSimplifyChild(approxExpr->lhsChild); + approximateChild(approxExpr->lhsChild); if (is(approxExpr->lhsChild)) { - return approxExpr->IBinaryExpression::approximateSimplify(); + return approxExpr->IBinaryExpression::approximate(); } return approxExpr; } - return IBinaryExpression::approximateSimplify(); + return IBinaryExpression::approximate(); } ArgumentPtr PowExpr::setPrecision(const unsigned precision, const Integer &maxInt) const { @@ -251,7 +251,7 @@ ArgumentPtr PowExpr::constSimplify(const IFunction & /*func*/, const ArgumentPtr if (!containsVariable(lhs)) { ArgumentPtr approxLhs = lhs; - approximateSimplifyChild(approxLhs); + approximateChild(approxLhs); if (const auto lhsNum = cast(approxLhs)) { if (lhsNum->isComplex()) { @@ -300,7 +300,7 @@ ArgumentPtr PowExpr::constSimplify(const IFunction & /*func*/, const ArgumentPtr if (is(lhs) || is(lhs)) { if (!containsVariable(rhs)) { ArgumentPtr approxRhs = rhs; - approximateSimplifyChild(approxRhs); + approximateChild(approxRhs); if (const auto rhsComplex = cast(approxRhs)) { if (rhsComplex->real() == Integer(0)) { diff --git a/src/fintamath/expressions/binary/PowExpr.hpp b/src/fintamath/expressions/binary/PowExpr.hpp index 41b69e567..d271c4dad 100644 --- a/src/fintamath/expressions/binary/PowExpr.hpp +++ b/src/fintamath/expressions/binary/PowExpr.hpp @@ -23,7 +23,7 @@ class PowExpr final : public IBinaryExpressionCRTP { const std::shared_ptr &getOutputFunction() const override; protected: - ArgumentPtr approximateSimplify() const override; + ArgumentPtr approximate() const override; ArgumentPtr setPrecision(unsigned precision, const Integer &maxInt) const override; diff --git a/src/fintamath/expressions/unary/FloorCeilExpr.cpp b/src/fintamath/expressions/unary/FloorCeilExpr.cpp index 5896a8fde..b8cf1d472 100644 --- a/src/fintamath/expressions/unary/FloorCeilExpr.cpp +++ b/src/fintamath/expressions/unary/FloorCeilExpr.cpp @@ -27,18 +27,18 @@ FloorCeilExpr::FloorCeilExpr(const IFunction &inFunc, ArgumentPtr inChild) FloorCeilExpr::SimplifyFunctionVector FloorCeilExpr::getFunctionsForPostSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { &FloorCeilExpr::negSimplify, - &FloorCeilExpr::intApproximateSimplify, + &FloorCeilExpr::intapproximate, }; return simplifyFunctions; } -ArgumentPtr FloorCeilExpr::intApproximateSimplify(const IFunction &func, const ArgumentPtr &rhs) { +ArgumentPtr FloorCeilExpr::intapproximate(const IFunction &func, const ArgumentPtr &rhs) { if (containsVariable(rhs)) { return {}; } ArgumentPtr approx = rhs->clone(); - approximateSimplifyChild(approx); + approximateChild(approx); if (auto res = cast(callFunction(func, {approx}))) { return res; diff --git a/src/fintamath/expressions/unary/FloorCeilExpr.hpp b/src/fintamath/expressions/unary/FloorCeilExpr.hpp index 3b1058bef..e6ae04015 100644 --- a/src/fintamath/expressions/unary/FloorCeilExpr.hpp +++ b/src/fintamath/expressions/unary/FloorCeilExpr.hpp @@ -21,7 +21,7 @@ class FloorCeilExpr final : public IUnaryExpressionCRTP { SimplifyFunctionVector getFunctionsForPostSimplify() const override; private: - static ArgumentPtr intApproximateSimplify(const IFunction &func, const ArgumentPtr &rhs); + static ArgumentPtr intapproximate(const IFunction &func, const ArgumentPtr &rhs); static ArgumentPtr negSimplify(const IFunction &func, const ArgumentPtr &rhs); diff --git a/src/fintamath/expressions/unary/SignExpr.cpp b/src/fintamath/expressions/unary/SignExpr.cpp index 3f8fa2e16..8f9718b02 100644 --- a/src/fintamath/expressions/unary/SignExpr.cpp +++ b/src/fintamath/expressions/unary/SignExpr.cpp @@ -26,7 +26,7 @@ SignExpr::SimplifyFunctionVector SignExpr::getFunctionsForPostSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { &SignExpr::constSimplify, &SignExpr::negSimplify, - &SignExpr::intApproximateSimplify, + &SignExpr::intapproximate, }; return simplifyFunctions; } @@ -47,13 +47,13 @@ ArgumentPtr SignExpr::constSimplify(const IFunction & /*func*/, const ArgumentPt return {}; } -ArgumentPtr SignExpr::intApproximateSimplify(const IFunction &func, const ArgumentPtr &rhs) { +ArgumentPtr SignExpr::intapproximate(const IFunction &func, const ArgumentPtr &rhs) { if (containsVariable(rhs)) { return {}; } ArgumentPtr approx = rhs->clone(); - approximateSimplifyChild(approx); + approximateChild(approx); if (const auto approxNum = cast(approx); approxNum && !approxNum->isComplex()) { return callFunction(func, {approx}); diff --git a/src/fintamath/expressions/unary/SignExpr.hpp b/src/fintamath/expressions/unary/SignExpr.hpp index 46c492f71..839f1eea1 100644 --- a/src/fintamath/expressions/unary/SignExpr.hpp +++ b/src/fintamath/expressions/unary/SignExpr.hpp @@ -19,7 +19,7 @@ class SignExpr final : public IUnaryExpressionCRTP { private: static ArgumentPtr constSimplify(const IFunction &func, const ArgumentPtr &rhs); - static ArgumentPtr intApproximateSimplify(const IFunction &func, const ArgumentPtr &rhs); + static ArgumentPtr intapproximate(const IFunction &func, const ArgumentPtr &rhs); static ArgumentPtr negSimplify(const IFunction &func, const ArgumentPtr &rhs); }; diff --git a/tests/src/expressions/IExpressionTests.cpp b/tests/src/expressions/IExpressionTests.cpp index 20e5552c8..66651c2cf 100644 --- a/tests/src/expressions/IExpressionTests.cpp +++ b/tests/src/expressions/IExpressionTests.cpp @@ -42,7 +42,7 @@ class TestExpression final : public IExpressionCRTP { return clone(); } - ArgumentPtr approximateSimplify() const override { + ArgumentPtr approximate() const override { return clone(); } };