From 91cd7c6109eefea15f5b4cae1a08114c8c56ebd8 Mon Sep 17 00:00:00 2001 From: fintarin Date: Sat, 24 Feb 2024 17:24:22 +0300 Subject: [PATCH] Rename expressions --- include/fintamath/core/MathObjectType.hpp | 38 ++--- src/fintamath/config/ExpressionConfig.cpp | 132 +++++++++--------- .../{CompExpression.cpp => CompExpr.cpp} | 44 +++--- .../{CompExpression.hpp => CompExpr.hpp} | 6 +- ...ativeExpression.cpp => DerivativeExpr.cpp} | 68 ++++----- ...ativeExpression.hpp => DerivativeExpr.hpp} | 6 +- .../binary/{DivExpression.cpp => DivExpr.cpp} | 108 +++++++------- .../binary/{DivExpression.hpp => DivExpr.hpp} | 6 +- ...ntegralExpression.cpp => IntegralExpr.cpp} | 10 +- ...ntegralExpression.hpp => IntegralExpr.hpp} | 6 +- .../binary/{LogExpression.cpp => LogExpr.cpp} | 34 ++--- .../binary/{LogExpression.hpp => LogExpr.hpp} | 6 +- .../binary/{PowExpression.cpp => PowExpr.cpp} | 44 +++--- .../binary/{PowExpression.hpp => PowExpr.hpp} | 6 +- .../functions/ExpressionFunctionSolve.cpp | 6 +- .../interfaces/IPolynomExpression.cpp | 2 +- .../{AddExpression.cpp => AddExpr.cpp} | 48 +++---- .../{AddExpression.hpp => AddExpr.hpp} | 6 +- .../{AndExpression.cpp => AndExpr.cpp} | 32 ++--- .../{AndExpression.hpp => AndExpr.hpp} | 6 +- .../{MinMaxExpression.cpp => MinMaxExpr.cpp} | 4 +- .../{MinMaxExpression.hpp => MinMaxExpr.hpp} | 6 +- .../{MulExpression.cpp => MulExpr.cpp} | 42 +++--- .../{MulExpression.hpp => MulExpr.hpp} | 6 +- .../{OrExpression.cpp => OrExpr.cpp} | 40 +++--- .../{OrExpression.hpp => OrExpr.hpp} | 6 +- .../unary/{AbsExpression.cpp => AbsExpr.cpp} | 14 +- .../unary/{AbsExpression.hpp => AbsExpr.hpp} | 6 +- ...orCeilExpression.cpp => FloorCeilExpr.cpp} | 16 +-- ...orCeilExpression.hpp => FloorCeilExpr.hpp} | 6 +- .../{HyperbExpression.cpp => HyperbExpr.cpp} | 24 ++-- .../{HyperbExpression.hpp => HyperbExpr.hpp} | 6 +- ...HyperbExpression.cpp => InvHyperbExpr.cpp} | 4 +- ...HyperbExpression.hpp => InvHyperbExpr.hpp} | 6 +- ...{InvTrigExpression.cpp => InvTrigExpr.cpp} | 24 ++-- ...{InvTrigExpression.hpp => InvTrigExpr.hpp} | 6 +- .../unary/{NotExpression.cpp => NotExpr.cpp} | 22 +-- .../unary/{NotExpression.hpp => NotExpr.hpp} | 6 +- .../{SignExpression.cpp => SignExpr.cpp} | 18 +-- .../{SignExpression.hpp => SignExpr.hpp} | 6 +- .../{TrigExpression.cpp => TrigExpr.cpp} | 40 +++--- .../{TrigExpression.hpp => TrigExpr.hpp} | 6 +- ...pExpressionTests.cpp => CompExprTests.cpp} | 4 +- ...ssionTests.cpp => DerivativeExprTests.cpp} | 4 +- ...ivExpressionTests.cpp => DivExprTests.cpp} | 4 +- ...ressionTests.cpp => IntegralExprTests.cpp} | 4 +- ...ogExpressionTests.cpp => LogExprTests.cpp} | 4 +- ...owExpressionTests.cpp => PowExprTests.cpp} | 4 +- ...ddExpressionTests.cpp => AddExprTests.cpp} | 4 +- ...ndExpressionTests.cpp => AndExprTests.cpp} | 4 +- ...xpressionTests.cpp => MinMaxExprTests.cpp} | 4 +- ...ulExpressionTests.cpp => MulExprTests.cpp} | 4 +- ...{OrExpressionTests.cpp => OrExprTests.cpp} | 4 +- ...bsExpressionTests.cpp => AbsExprTests.cpp} | 4 +- ...essionTests.cpp => FloorCeilExprTests.cpp} | 4 +- ...xpressionTests.cpp => HyperbExprTests.cpp} | 4 +- ...essionTests.cpp => InvHyperbExprTests.cpp} | 4 +- ...pressionTests.cpp => InvTrigExprTests.cpp} | 4 +- ...otExpressionTests.cpp => NotExprTests.cpp} | 4 +- ...nExpressionTests.cpp => SignExprTests.cpp} | 4 +- ...gExpressionTests.cpp => TrigExprTests.cpp} | 4 +- 61 files changed, 502 insertions(+), 502 deletions(-) rename src/fintamath/expressions/binary/{CompExpression.cpp => CompExpr.cpp} (79%) rename src/fintamath/expressions/binary/{CompExpression.hpp => CompExpr.hpp} (84%) rename src/fintamath/expressions/binary/{DerivativeExpression.cpp => DerivativeExpr.cpp} (73%) rename src/fintamath/expressions/binary/{DerivativeExpression.hpp => DerivativeExpr.hpp} (94%) rename src/fintamath/expressions/binary/{DivExpression.cpp => DivExpr.cpp} (79%) rename src/fintamath/expressions/binary/{DivExpression.hpp => DivExpr.hpp} (93%) rename src/fintamath/expressions/binary/{IntegralExpression.cpp => IntegralExpr.cpp} (53%) rename src/fintamath/expressions/binary/{IntegralExpression.hpp => IntegralExpr.hpp} (68%) rename src/fintamath/expressions/binary/{LogExpression.cpp => LogExpr.cpp} (72%) rename src/fintamath/expressions/binary/{LogExpression.hpp => LogExpr.hpp} (84%) rename src/fintamath/expressions/binary/{PowExpression.cpp => PowExpr.cpp} (86%) rename src/fintamath/expressions/binary/{PowExpression.hpp => PowExpr.hpp} (88%) rename src/fintamath/expressions/polynomial/{AddExpression.cpp => AddExpr.cpp} (86%) rename src/fintamath/expressions/polynomial/{AddExpression.hpp => AddExpr.hpp} (90%) rename src/fintamath/expressions/polynomial/{AndExpression.cpp => AndExpr.cpp} (65%) rename src/fintamath/expressions/polynomial/{AndExpression.hpp => AndExpr.hpp} (83%) rename src/fintamath/expressions/polynomial/{MinMaxExpression.cpp => MinMaxExpr.cpp} (64%) rename src/fintamath/expressions/polynomial/{MinMaxExpression.hpp => MinMaxExpr.hpp} (57%) rename src/fintamath/expressions/polynomial/{MulExpression.cpp => MulExpr.cpp} (83%) rename src/fintamath/expressions/polynomial/{MulExpression.hpp => MulExpr.hpp} (87%) rename src/fintamath/expressions/polynomial/{OrExpression.cpp => OrExpr.cpp} (79%) rename src/fintamath/expressions/polynomial/{OrExpression.hpp => OrExpr.hpp} (86%) rename src/fintamath/expressions/unary/{AbsExpression.cpp => AbsExpr.cpp} (61%) rename src/fintamath/expressions/unary/{AbsExpression.hpp => AbsExpr.hpp} (76%) rename src/fintamath/expressions/unary/{FloorCeilExpression.cpp => FloorCeilExpr.cpp} (68%) rename src/fintamath/expressions/unary/{FloorCeilExpression.hpp => FloorCeilExpr.hpp} (74%) rename src/fintamath/expressions/unary/{HyperbExpression.cpp => HyperbExpr.cpp} (79%) rename src/fintamath/expressions/unary/{HyperbExpression.hpp => HyperbExpr.hpp} (79%) rename src/fintamath/expressions/unary/{InvHyperbExpression.cpp => InvHyperbExpr.cpp} (64%) rename src/fintamath/expressions/unary/{InvHyperbExpression.hpp => InvHyperbExpr.hpp} (57%) rename src/fintamath/expressions/unary/{InvTrigExpression.cpp => InvTrigExpr.cpp} (88%) rename src/fintamath/expressions/unary/{InvTrigExpression.hpp => InvTrigExpr.hpp} (81%) rename src/fintamath/expressions/unary/{NotExpression.cpp => NotExpr.cpp} (76%) rename src/fintamath/expressions/unary/{NotExpression.hpp => NotExpr.hpp} (80%) rename src/fintamath/expressions/unary/{SignExpression.cpp => SignExpr.cpp} (68%) rename src/fintamath/expressions/unary/{SignExpression.hpp => SignExpr.hpp} (78%) rename src/fintamath/expressions/unary/{TrigExpression.cpp => TrigExpr.cpp} (84%) rename src/fintamath/expressions/unary/{TrigExpression.hpp => TrigExpr.hpp} (86%) rename tests/src/expressions/binary/{CompExpressionTests.cpp => CompExprTests.cpp} (73%) rename tests/src/expressions/binary/{DerivativeExpressionTests.cpp => DerivativeExprTests.cpp} (68%) rename tests/src/expressions/binary/{DivExpressionTests.cpp => DivExprTests.cpp} (73%) rename tests/src/expressions/binary/{IntegralExpressionTests.cpp => IntegralExprTests.cpp} (69%) rename tests/src/expressions/binary/{LogExpressionTests.cpp => LogExprTests.cpp} (73%) rename tests/src/expressions/binary/{PowExpressionTests.cpp => PowExprTests.cpp} (73%) rename tests/src/expressions/polynomial/{AddExpressionTests.cpp => AddExprTests.cpp} (73%) rename tests/src/expressions/polynomial/{AndExpressionTests.cpp => AndExprTests.cpp} (73%) rename tests/src/expressions/polynomial/{MinMaxExpressionTests.cpp => MinMaxExprTests.cpp} (71%) rename tests/src/expressions/polynomial/{MulExpressionTests.cpp => MulExprTests.cpp} (73%) rename tests/src/expressions/polynomial/{OrExpressionTests.cpp => OrExprTests.cpp} (74%) rename tests/src/expressions/unary/{AbsExpressionTests.cpp => AbsExprTests.cpp} (69%) rename tests/src/expressions/unary/{RoundExpressionTests.cpp => FloorCeilExprTests.cpp} (65%) rename tests/src/expressions/unary/{HyperbExpressionTests.cpp => HyperbExprTests.cpp} (72%) rename tests/src/expressions/unary/{InvHyperbExpressionTests.cpp => InvHyperbExprTests.cpp} (70%) rename tests/src/expressions/unary/{InvTrigExpressionTests.cpp => InvTrigExprTests.cpp} (72%) rename tests/src/expressions/unary/{NotExpressionTests.cpp => NotExprTests.cpp} (76%) rename tests/src/expressions/unary/{SignExpressionTests.cpp => SignExprTests.cpp} (68%) rename tests/src/expressions/unary/{TrigExpressionTests.cpp => TrigExprTests.cpp} (74%) diff --git a/include/fintamath/core/MathObjectType.hpp b/include/fintamath/core/MathObjectType.hpp index 807e51db7..7b297e62d 100644 --- a/include/fintamath/core/MathObjectType.hpp +++ b/include/fintamath/core/MathObjectType.hpp @@ -22,31 +22,31 @@ struct MathObjectType final { IUnaryExpression = 3000, - NotExpression, - TrigExpression, - InvTrigExpression, - HyperbExpression, - InvHyperbExpression, - FloorCeilExpression, - AbsExpression, - SignExpression, + NotExpr, + TrigExpr, + InvTrigExpr, + HyperbExpr, + InvHyperbExpr, + FloorCeilExpr, + AbsExpr, + SignExpr, IBinaryExpression = 4000, - PowExpression, - DivExpression, - LogExpression, - CompExpression, - DerivativeExpression, - IntegralExpression, + PowExpr, + DivExpr, + LogExpr, + CompExpr, + DerivativeExpr, + IntegralExpr, IPolynomExpression = 5000, - AddExpression, - MulExpression, - AndExpression, - OrExpression, - MinMaxExpression, + AddExpr, + MulExpr, + AndExpr, + OrExpr, + MinMaxExpr, IComparable = 6000, diff --git a/src/fintamath/config/ExpressionConfig.cpp b/src/fintamath/config/ExpressionConfig.cpp index 33f7728da..623ddc51d 100644 --- a/src/fintamath/config/ExpressionConfig.cpp +++ b/src/fintamath/config/ExpressionConfig.cpp @@ -6,25 +6,25 @@ #include "fintamath/core/CoreUtils.hpp" #include "fintamath/core/Tokenizer.hpp" #include "fintamath/expressions/Expression.hpp" -#include "fintamath/expressions/binary/CompExpression.hpp" -#include "fintamath/expressions/binary/DerivativeExpression.hpp" -#include "fintamath/expressions/binary/DivExpression.hpp" -#include "fintamath/expressions/binary/IntegralExpression.hpp" -#include "fintamath/expressions/binary/LogExpression.hpp" -#include "fintamath/expressions/binary/PowExpression.hpp" -#include "fintamath/expressions/polynomial/AddExpression.hpp" -#include "fintamath/expressions/polynomial/AndExpression.hpp" -#include "fintamath/expressions/polynomial/MinMaxExpression.hpp" -#include "fintamath/expressions/polynomial/MulExpression.hpp" -#include "fintamath/expressions/polynomial/OrExpression.hpp" -#include "fintamath/expressions/unary/AbsExpression.hpp" -#include "fintamath/expressions/unary/FloorCeilExpression.hpp" -#include "fintamath/expressions/unary/HyperbExpression.hpp" -#include "fintamath/expressions/unary/InvHyperbExpression.hpp" -#include "fintamath/expressions/unary/InvTrigExpression.hpp" -#include "fintamath/expressions/unary/NotExpression.hpp" -#include "fintamath/expressions/unary/SignExpression.hpp" -#include "fintamath/expressions/unary/TrigExpression.hpp" +#include "fintamath/expressions/binary/CompExpr.hpp" +#include "fintamath/expressions/binary/DerivativeExpr.hpp" +#include "fintamath/expressions/binary/DivExpr.hpp" +#include "fintamath/expressions/binary/IntegralExpr.hpp" +#include "fintamath/expressions/binary/LogExpr.hpp" +#include "fintamath/expressions/binary/PowExpr.hpp" +#include "fintamath/expressions/polynomial/AddExpr.hpp" +#include "fintamath/expressions/polynomial/AndExpr.hpp" +#include "fintamath/expressions/polynomial/MinMaxExpr.hpp" +#include "fintamath/expressions/polynomial/MulExpr.hpp" +#include "fintamath/expressions/polynomial/OrExpr.hpp" +#include "fintamath/expressions/unary/AbsExpr.hpp" +#include "fintamath/expressions/unary/FloorCeilExpr.hpp" +#include "fintamath/expressions/unary/HyperbExpr.hpp" +#include "fintamath/expressions/unary/InvHyperbExpr.hpp" +#include "fintamath/expressions/unary/InvTrigExpr.hpp" +#include "fintamath/expressions/unary/NotExpr.hpp" +#include "fintamath/expressions/unary/SignExpr.hpp" +#include "fintamath/expressions/unary/TrigExpr.hpp" #include "fintamath/functions/FunctionArguments.hpp" #include "fintamath/functions/IFunction.hpp" #include "fintamath/functions/arithmetic/Abs.hpp" @@ -135,7 +135,7 @@ void registerTermParsers() { void registerFunctionExpressionMakers() { Expression::registerFunctionExpressionMaker([](ArgumentPtrVector &&args) { - return AddExpression(std::move(args)).clone(); + return AddExpr(std::move(args)).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { @@ -144,15 +144,15 @@ void registerFunctionExpressionMakers() { ArgumentPtr negRhs = negExpr(std::move(rhs)); - return AddExpression({std::move(lhs), std::move(negRhs)}).clone(); + return AddExpr({std::move(lhs), std::move(negRhs)}).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector &&args) { - return MulExpression(std::move(args)).clone(); + return MulExpr(std::move(args)).clone(); }); Expression::registerFunctionExpressionMaker
([](ArgumentPtrVector args) { - return DivExpression(std::move(args.front()), std::move(args.back())).clone(); + return DivExpr(std::move(args.front()), std::move(args.back())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector &&args) { @@ -168,15 +168,15 @@ void registerFunctionExpressionMakers() { }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector &&args) { - return AndExpression(std::move(args)).clone(); + return AndExpr(std::move(args)).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector &&args) { - return OrExpression(std::move(args)).clone(); + return OrExpr(std::move(args)).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return PowExpression(std::move(args.front()), std::move(args.back())).clone(); + return PowExpr(std::move(args.front()), std::move(args.back())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector &&args) { @@ -184,27 +184,27 @@ void registerFunctionExpressionMakers() { }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return CompExpression(Eqv{}, std::move(args.front()), std::move(args.back())).clone(); + return CompExpr(Eqv{}, std::move(args.front()), std::move(args.back())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return CompExpression(Neqv{}, std::move(args.front()), std::move(args.back())).clone(); + return CompExpr(Neqv{}, std::move(args.front()), std::move(args.back())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return CompExpression(Less{}, std::move(args.front()), std::move(args.back())).clone(); + return CompExpr(Less{}, std::move(args.front()), std::move(args.back())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return CompExpression(More{}, std::move(args.front()), std::move(args.back())).clone(); + return CompExpr(More{}, std::move(args.front()), std::move(args.back())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return CompExpression(LessEqv{}, std::move(args.front()), std::move(args.back())).clone(); + return CompExpr(LessEqv{}, std::move(args.front()), std::move(args.back())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return CompExpression(MoreEqv{}, std::move(args.front()), std::move(args.back())).clone(); + return CompExpr(MoreEqv{}, std::move(args.front()), std::move(args.back())).clone(); }); Expression::registerFunctionExpressionMaker([](const ArgumentPtrVector &args) { @@ -265,19 +265,19 @@ void registerFunctionExpressionMakers() { }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return NotExpression(std::move(args.front())).clone(); + return NotExpr(std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return DerivativeExpression(std::move(args.front()), std::move(args.back())).clone(); + return DerivativeExpr(std::move(args.front()), std::move(args.back())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return IntegralExpression(std::move(args.front()), std::move(args.back())).clone(); + return IntegralExpr(std::move(args.front()), std::move(args.back())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return LogExpression(std::move(args.front()), std::move(args.back())).clone(); + return LogExpr(std::move(args.front()), std::move(args.back())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { @@ -306,11 +306,11 @@ void registerFunctionExpressionMakers() { }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector &&args) { - return MinMaxExpression(Min{}, std::move(args)).clone(); + return MinMaxExpr(Min{}, std::move(args)).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector &&args) { - return MinMaxExpression(Max{}, std::move(args)).clone(); + return MinMaxExpr(Max{}, std::move(args)).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { @@ -338,99 +338,99 @@ void registerFunctionExpressionMakers() { }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return TrigExpression(Sin{}, std::move(args.front())).clone(); + return TrigExpr(Sin{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return TrigExpression(Cos{}, std::move(args.front())).clone(); + return TrigExpr(Cos{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return TrigExpression(Tan{}, std::move(args.front())).clone(); + return TrigExpr(Tan{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return TrigExpression(Cot{}, std::move(args.front())).clone(); + return TrigExpr(Cot{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return TrigExpression(Sec{}, std::move(args.front())).clone(); + return TrigExpr(Sec{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return TrigExpression(Csc{}, std::move(args.front())).clone(); + return TrigExpr(Csc{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return InvTrigExpression(Asin{}, std::move(args.front())).clone(); + return InvTrigExpr(Asin{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return InvTrigExpression(Acos{}, std::move(args.front())).clone(); + return InvTrigExpr(Acos{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return InvTrigExpression(Atan{}, std::move(args.front())).clone(); + return InvTrigExpr(Atan{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return InvTrigExpression(Acot{}, std::move(args.front())).clone(); + return InvTrigExpr(Acot{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return InvTrigExpression(Asec{}, std::move(args.front())).clone(); + return InvTrigExpr(Asec{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return InvTrigExpression(Acsc{}, std::move(args.front())).clone(); + return InvTrigExpr(Acsc{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return HyperbExpression(Sinh{}, std::move(args.front())).clone(); + return HyperbExpr(Sinh{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return HyperbExpression(Cosh{}, std::move(args.front())).clone(); + return HyperbExpr(Cosh{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return HyperbExpression(Tanh{}, std::move(args.front())).clone(); + return HyperbExpr(Tanh{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return HyperbExpression(Coth{}, std::move(args.front())).clone(); + return HyperbExpr(Coth{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return HyperbExpression(Sech{}, std::move(args.front())).clone(); + return HyperbExpr(Sech{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return HyperbExpression(Csch{}, std::move(args.front())).clone(); + return HyperbExpr(Csch{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return InvHyperbExpression(Asinh{}, std::move(args.front())).clone(); + return InvHyperbExpr(Asinh{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return InvHyperbExpression(Acosh{}, std::move(args.front())).clone(); + return InvHyperbExpr(Acosh{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return InvHyperbExpression(Atanh{}, std::move(args.front())).clone(); + return InvHyperbExpr(Atanh{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return InvHyperbExpression(Acoth{}, std::move(args.front())).clone(); + return InvHyperbExpr(Acoth{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return InvHyperbExpression(Asech{}, std::move(args.front())).clone(); + return InvHyperbExpr(Asech{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return InvHyperbExpression(Acsch{}, std::move(args.front())).clone(); + return InvHyperbExpr(Acsch{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { @@ -439,19 +439,19 @@ void registerFunctionExpressionMakers() { }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return FloorCeilExpression(Floor{}, std::move(args.front())).clone(); + return FloorCeilExpr(Floor{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return FloorCeilExpression(Ceil{}, std::move(args.front())).clone(); + return FloorCeilExpr(Ceil{}, std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return AbsExpression(std::move(args.front())).clone(); + return AbsExpr(std::move(args.front())).clone(); }); Expression::registerFunctionExpressionMaker([](ArgumentPtrVector args) { - return SignExpression(std::move(args.front())).clone(); + return SignExpr(std::move(args.front())).clone(); }); } diff --git a/src/fintamath/expressions/binary/CompExpression.cpp b/src/fintamath/expressions/binary/CompExpr.cpp similarity index 79% rename from src/fintamath/expressions/binary/CompExpression.cpp rename to src/fintamath/expressions/binary/CompExpr.cpp index 31845dac9..1da787184 100644 --- a/src/fintamath/expressions/binary/CompExpression.cpp +++ b/src/fintamath/expressions/binary/CompExpr.cpp @@ -1,4 +1,4 @@ -#include "fintamath/expressions/binary/CompExpression.hpp" +#include "fintamath/expressions/binary/CompExpr.hpp" #include #include @@ -36,11 +36,11 @@ namespace fintamath { using namespace detail; -CompExpression::CompExpression(const IOperator &inOper, ArgumentPtr inLhsChild, ArgumentPtr inRhsChild) +CompExpr::CompExpr(const IOperator &inOper, ArgumentPtr inLhsChild, ArgumentPtr inRhsChild) : IBinaryExpressionCRTP(inOper, std::move(inLhsChild), std::move(inRhsChild)) { } -std::string CompExpression::toString() const { +std::string CompExpr::toString() const { if (isSolution) { if (const auto lhsExpr = cast(lhsChild); lhsExpr && @@ -52,7 +52,7 @@ std::string CompExpression::toString() const { if (is(solLhs)) { sumChildren.erase(sumChildren.begin()); ArgumentPtr solRhs = detail::negate(makePolynom(Add{}, std::move(sumChildren))); - return CompExpression(cast(*func), std::move(solLhs), std::move(solRhs)).toString(); + return CompExpr(cast(*func), std::move(solLhs), std::move(solRhs)).toString(); } } } @@ -60,10 +60,10 @@ std::string CompExpression::toString() const { return IBinaryExpression::toString(); } -ArgumentPtr CompExpression::preSimplify() const { +ArgumentPtr CompExpr::preSimplify() const { auto simpl = IBinaryExpression::preSimplify(); - if (const auto simplExpr = cast(simpl)) { + if (const auto simplExpr = cast(simpl)) { if (!simplExpr->isSolution && (!is(simplExpr->rhsChild) || *simplExpr->rhsChild != Integer(0))) { @@ -77,7 +77,7 @@ ArgumentPtr CompExpression::preSimplify() const { if (!containsInfinity(simplExpr->lhsChild) && !containsInfinity(simplExpr->rhsChild)) { ArgumentPtr resLhs = subExpr(simplExpr->lhsChild, simplExpr->rhsChild); preSimplifyChild(resLhs); - return CompExpression(cast(*func), resLhs, Integer(0).clone()).clone(); + return CompExpr(cast(*func), resLhs, Integer(0).clone()).clone(); } } } @@ -85,29 +85,29 @@ ArgumentPtr CompExpression::preSimplify() const { return simpl; } -CompExpression::SimplifyFunctionVector CompExpression::getFunctionsForPreSimplify() const { +CompExpr::SimplifyFunctionVector CompExpr::getFunctionsForPreSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &CompExpression::constSimplify, + &CompExpr::constSimplify, }; return simplifyFunctions; } -CompExpression::SimplifyFunctionVector CompExpression::getFunctionsForPostSimplify() const { +CompExpr::SimplifyFunctionVector CompExpr::getFunctionsForPostSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &CompExpression::constSimplify, - &CompExpression::divSimplify, - &CompExpression::negSimplify, - &CompExpression::rateSimplify, - &CompExpression::approxSimplify, + &CompExpr::constSimplify, + &CompExpr::divSimplify, + &CompExpr::negSimplify, + &CompExpr::rateSimplify, + &CompExpr::approxSimplify, }; return simplifyFunctions; } -void CompExpression::markAsSolution() { +void CompExpr::markAsSolution() { isSolution = true; } -std::shared_ptr CompExpression::getOppositeFunction(const IFunction &function) { +std::shared_ptr CompExpr::getOppositeFunction(const IFunction &function) { static const std::unordered_map> nameToOppositeFuncMap = { {Eqv{}.toString(), std::make_shared()}, {Neqv{}.toString(), std::make_shared()}, @@ -119,7 +119,7 @@ std::shared_ptr CompExpression::getOppositeFunction(const IFunction & return nameToOppositeFuncMap.at(function.toString()); } -ArgumentPtr CompExpression::constSimplify(const IFunction &func, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr CompExpr::constSimplify(const IFunction &func, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (is(lhs) || is(rhs)) { // TODO: return LogicUndefined return makeExpr(func, Undefined(), Undefined()); @@ -161,7 +161,7 @@ ArgumentPtr CompExpression::constSimplify(const IFunction &func, const ArgumentP return {}; } -ArgumentPtr CompExpression::divSimplify(const IFunction &func, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr CompExpr::divSimplify(const IFunction &func, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (const auto lhsExpr = cast(lhs); lhsExpr && is
(lhsExpr->getFunction())) { return makeExpr(func, lhsExpr->getChildren().front(), rhs); } @@ -169,7 +169,7 @@ ArgumentPtr CompExpression::divSimplify(const IFunction &func, const ArgumentPtr return {}; } -ArgumentPtr CompExpression::negSimplify(const IFunction &func, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr CompExpr::negSimplify(const IFunction &func, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (*rhs != Integer(0)) { return {}; } @@ -182,7 +182,7 @@ ArgumentPtr CompExpression::negSimplify(const IFunction &func, const ArgumentPtr return {}; } -ArgumentPtr CompExpression::rateSimplify(const IFunction &func, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr CompExpr::rateSimplify(const IFunction &func, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (*rhs != Integer(0)) { return {}; } @@ -237,7 +237,7 @@ ArgumentPtr CompExpression::rateSimplify(const IFunction &func, const ArgumentPt return makeExpr(func, newLhs, rhs); } -ArgumentPtr CompExpression::approxSimplify(const IFunction &func, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr CompExpr::approxSimplify(const IFunction &func, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (*rhs != Integer(0) || containsVariable(lhs)) { return {}; } diff --git a/src/fintamath/expressions/binary/CompExpression.hpp b/src/fintamath/expressions/binary/CompExpr.hpp similarity index 84% rename from src/fintamath/expressions/binary/CompExpression.hpp rename to src/fintamath/expressions/binary/CompExpr.hpp index 26d357ad5..a653e5522 100644 --- a/src/fintamath/expressions/binary/CompExpression.hpp +++ b/src/fintamath/expressions/binary/CompExpr.hpp @@ -12,16 +12,16 @@ namespace fintamath { class IOperator; -class CompExpression final : public IBinaryExpressionCRTP { +class CompExpr final : public IBinaryExpressionCRTP { public: - CompExpression(const IOperator &inOper, ArgumentPtr inLhsChild, ArgumentPtr inRhsChild); + CompExpr(const IOperator &inOper, ArgumentPtr inLhsChild, ArgumentPtr inRhsChild); std::string toString() const override; void markAsSolution(); static constexpr MathObjectType getTypeStatic() { - return {MathObjectType::CompExpression, "CompExpression"}; + return {MathObjectType::CompExpr, "CompExpr"}; } protected: diff --git a/src/fintamath/expressions/binary/DerivativeExpression.cpp b/src/fintamath/expressions/binary/DerivativeExpr.cpp similarity index 73% rename from src/fintamath/expressions/binary/DerivativeExpression.cpp rename to src/fintamath/expressions/binary/DerivativeExpr.cpp index 5c281bdd8..93197ba3c 100644 --- a/src/fintamath/expressions/binary/DerivativeExpression.cpp +++ b/src/fintamath/expressions/binary/DerivativeExpr.cpp @@ -1,4 +1,4 @@ -#include "fintamath/expressions/binary/DerivativeExpression.hpp" +#include "fintamath/expressions/binary/DerivativeExpr.hpp" #include #include @@ -62,18 +62,18 @@ using NameToSimplifyFunctionMap = std::unordered_map< std::function &var)>>; -DerivativeExpression::DerivativeExpression(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild) +DerivativeExpr::DerivativeExpr(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild) : IBinaryExpressionCRTP(Derivative{}, std::move(inLhsChild), std::move(inRhsChild)) { } -DerivativeExpression::SimplifyFunctionVector DerivativeExpression::getFunctionsForPostSimplify() const { +DerivativeExpr::SimplifyFunctionVector DerivativeExpr::getFunctionsForPostSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &DerivativeExpression::derivativeSimplify, + &DerivativeExpr::derivativeSimplify, }; return simplifyFunctions; } -ArgumentPtr DerivativeExpression::derivativeSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr DerivativeExpr::derivativeSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { const auto var = cast(rhs); if (const auto lhsExpr = cast(lhs)) { @@ -91,7 +91,7 @@ ArgumentPtr DerivativeExpression::derivativeSimplify(const IFunction & /*func*/, return {}; } -ArgumentPtr DerivativeExpression::exprSimplify(const std::shared_ptr &expr, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::exprSimplify(const std::shared_ptr &expr, const std::shared_ptr &var) { static const NameToSimplifyFunctionMap nameToSimplifyFunctionMap = [] { static const NameToSimplifyFunctionMap map = { {Add{}.toString(), &addSimplify}, @@ -136,7 +136,7 @@ ArgumentPtr DerivativeExpression::exprSimplify(const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::addSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { ArgumentPtrVector newChildren = children; stdr::transform(newChildren, newChildren.begin(), [&var](const ArgumentPtr &child) { @@ -146,7 +146,7 @@ ArgumentPtr DerivativeExpression::addSimplify(const ArgumentPtrVector &children, return addExpr(std::move(newChildren)); } -ArgumentPtr DerivativeExpression::mulSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::mulSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const auto childrenSizeDiv2 = static_cast(children.size() / 2); auto lhsChildren = ArgumentPtrVector(children.begin(), children.begin() + childrenSizeDiv2); @@ -160,7 +160,7 @@ ArgumentPtr DerivativeExpression::mulSimplify(const ArgumentPtrVector &children, mulExpr(derivativeExpr(rhs, var), lhs)); } -ArgumentPtr DerivativeExpression::divSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::divSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &lhs = children.front(); const ArgumentPtr &rhs = children.back(); @@ -173,7 +173,7 @@ ArgumentPtr DerivativeExpression::divSimplify(const ArgumentPtrVector &children, return divExpr(std::move(numerator), std::move(denominator)); } -ArgumentPtr DerivativeExpression::powSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::powSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &lhs = children.front(); const ArgumentPtr &rhs = children.back(); @@ -186,7 +186,7 @@ ArgumentPtr DerivativeExpression::powSimplify(const ArgumentPtrVector &children, return mulExpr(std::move(mulFirst), std::move(mulSecond)); } -ArgumentPtr DerivativeExpression::logSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::logSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &lhs = children.front(); const ArgumentPtr &rhs = children.back(); @@ -201,19 +201,19 @@ ArgumentPtr DerivativeExpression::logSimplify(const ArgumentPtrVector &children, return subExpr(std::move(subLhs), std::move(subRhs)); } -ArgumentPtr DerivativeExpression::sinSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::sinSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); return mulExpr(cosExpr(rhs), derivativeExpr(rhs, var)); } -ArgumentPtr DerivativeExpression::cosSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::cosSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); return mulExpr(negExpr(sinExpr(rhs)), derivativeExpr(rhs, var)); } -ArgumentPtr DerivativeExpression::tanSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::tanSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); ArgumentPtr denominator = sqrExpr(cosExpr(rhs)); @@ -221,7 +221,7 @@ ArgumentPtr DerivativeExpression::tanSimplify(const ArgumentPtrVector &children, return divExpr(derivativeExpr(rhs, var), std::move(denominator)); } -ArgumentPtr DerivativeExpression::cotSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::cotSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); ArgumentPtr denominator = sqrExpr(sinExpr(rhs)); @@ -229,7 +229,7 @@ ArgumentPtr DerivativeExpression::cotSimplify(const ArgumentPtrVector &children, return divExpr(negExpr(derivativeExpr(rhs, var)), std::move(denominator)); } -ArgumentPtr DerivativeExpression::secSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::secSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); return mulExpr( @@ -238,7 +238,7 @@ ArgumentPtr DerivativeExpression::secSimplify(const ArgumentPtrVector &children, derivativeExpr(rhs, var)); } -ArgumentPtr DerivativeExpression::cscSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::cscSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); return negExpr(mulExpr( @@ -247,7 +247,7 @@ ArgumentPtr DerivativeExpression::cscSimplify(const ArgumentPtrVector &children, derivativeExpr(rhs, var))); } -ArgumentPtr DerivativeExpression::asinSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::asinSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); ArgumentPtr denominator = sqrtExpr(subExpr(Integer(1).clone(), sqrExpr(rhs))); @@ -255,7 +255,7 @@ ArgumentPtr DerivativeExpression::asinSimplify(const ArgumentPtrVector &children return divExpr(derivativeExpr(rhs, var), std::move(denominator)); } -ArgumentPtr DerivativeExpression::acosSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::acosSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); ArgumentPtr denominator = sqrtExpr(subExpr(Integer(1).clone(), sqrExpr(rhs))); @@ -263,7 +263,7 @@ ArgumentPtr DerivativeExpression::acosSimplify(const ArgumentPtrVector &children return divExpr(negExpr(derivativeExpr(rhs, var)), std::move(denominator)); } -ArgumentPtr DerivativeExpression::atanSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::atanSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); ArgumentPtr denominator = addExpr(sqrExpr(rhs), Integer(1).clone()); @@ -271,7 +271,7 @@ ArgumentPtr DerivativeExpression::atanSimplify(const ArgumentPtrVector &children return divExpr(derivativeExpr(rhs, var), std::move(denominator)); } -ArgumentPtr DerivativeExpression::acotSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::acotSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); ArgumentPtr denominator = addExpr(sqrExpr(rhs), Integer(1).clone()); @@ -279,7 +279,7 @@ ArgumentPtr DerivativeExpression::acotSimplify(const ArgumentPtrVector &children return divExpr(negExpr(derivativeExpr(rhs, var)), std::move(denominator)); } -ArgumentPtr DerivativeExpression::asecSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::asecSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); ArgumentPtr denominatorMulFirst = sqrtExpr( @@ -293,7 +293,7 @@ ArgumentPtr DerivativeExpression::asecSimplify(const ArgumentPtrVector &children return divExpr(derivativeExpr(rhs, var), std::move(denominator)); } -ArgumentPtr DerivativeExpression::acscSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::acscSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); ArgumentPtr denominatorMulFirst = sqrtExpr( @@ -307,19 +307,19 @@ ArgumentPtr DerivativeExpression::acscSimplify(const ArgumentPtrVector &children return divExpr(negExpr(derivativeExpr(rhs, var)), std::move(denominator)); } -ArgumentPtr DerivativeExpression::sinhSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::sinhSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); return mulExpr(coshExpr(rhs), derivativeExpr(rhs, var)); } -ArgumentPtr DerivativeExpression::coshSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::coshSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); return mulExpr(sinhExpr(rhs), derivativeExpr(rhs, var)); } -ArgumentPtr DerivativeExpression::tanhSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::tanhSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); ArgumentPtr denominator = powExpr(coshExpr(rhs), Integer(2).clone()); @@ -327,7 +327,7 @@ ArgumentPtr DerivativeExpression::tanhSimplify(const ArgumentPtrVector &children return divExpr(derivativeExpr(rhs, var), std::move(denominator)); } -ArgumentPtr DerivativeExpression::cothSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::cothSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); ArgumentPtr denominator = powExpr(sinhExpr(rhs), Integer(2).clone()); @@ -335,7 +335,7 @@ ArgumentPtr DerivativeExpression::cothSimplify(const ArgumentPtrVector &children return divExpr(negExpr(derivativeExpr(rhs, var)), std::move(denominator)); } -ArgumentPtr DerivativeExpression::sechSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::sechSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); return negExpr(mulExpr( @@ -344,7 +344,7 @@ ArgumentPtr DerivativeExpression::sechSimplify(const ArgumentPtrVector &children derivativeExpr(rhs, var))); } -ArgumentPtr DerivativeExpression::cschSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::cschSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); return negExpr(mulExpr( @@ -353,7 +353,7 @@ ArgumentPtr DerivativeExpression::cschSimplify(const ArgumentPtrVector &children derivativeExpr(rhs, var))); } -ArgumentPtr DerivativeExpression::asinhSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::asinhSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); ArgumentPtr denominator = sqrtExpr(addExpr(sqrExpr(rhs), Integer(1).clone())); @@ -361,7 +361,7 @@ ArgumentPtr DerivativeExpression::asinhSimplify(const ArgumentPtrVector &childre return divExpr(derivativeExpr(rhs, var), std::move(denominator)); } -ArgumentPtr DerivativeExpression::acoshSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::acoshSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); ArgumentPtr denominator = mulExpr( @@ -371,7 +371,7 @@ ArgumentPtr DerivativeExpression::acoshSimplify(const ArgumentPtrVector &childre return divExpr(derivativeExpr(rhs, var), std::move(denominator)); } -ArgumentPtr DerivativeExpression::atanhSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::atanhSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); ArgumentPtr denominator = subExpr(Integer(1).clone(), sqrExpr(rhs)); @@ -379,7 +379,7 @@ ArgumentPtr DerivativeExpression::atanhSimplify(const ArgumentPtrVector &childre return divExpr(derivativeExpr(rhs, var), std::move(denominator)); } -ArgumentPtr DerivativeExpression::asechSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::asechSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); ArgumentPtr denominatorMulFirst = sqrtExpr( @@ -399,7 +399,7 @@ ArgumentPtr DerivativeExpression::asechSimplify(const ArgumentPtrVector &childre return divExpr(negExpr(derivativeExpr(rhs, var)), std::move(denominator)); } -ArgumentPtr DerivativeExpression::acschSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { +ArgumentPtr DerivativeExpr::acschSimplify(const ArgumentPtrVector &children, const std::shared_ptr &var) { const ArgumentPtr &rhs = children.front(); ArgumentPtr denominatorMulFirst = sqrtExpr( diff --git a/src/fintamath/expressions/binary/DerivativeExpression.hpp b/src/fintamath/expressions/binary/DerivativeExpr.hpp similarity index 94% rename from src/fintamath/expressions/binary/DerivativeExpression.hpp rename to src/fintamath/expressions/binary/DerivativeExpr.hpp index 70e7ef58c..1a864c12a 100644 --- a/src/fintamath/expressions/binary/DerivativeExpression.hpp +++ b/src/fintamath/expressions/binary/DerivativeExpr.hpp @@ -11,12 +11,12 @@ namespace fintamath { -class DerivativeExpression final : public IBinaryExpressionCRTP { +class DerivativeExpr final : public IBinaryExpressionCRTP { public: - explicit DerivativeExpression(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild); + explicit DerivativeExpr(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild); static constexpr MathObjectType getTypeStatic() { - return {MathObjectType::DerivativeExpression, "DerivativeExpression"}; + return {MathObjectType::DerivativeExpr, "DerivativeExpr"}; } protected: diff --git a/src/fintamath/expressions/binary/DivExpression.cpp b/src/fintamath/expressions/binary/DivExpr.cpp similarity index 79% rename from src/fintamath/expressions/binary/DivExpression.cpp rename to src/fintamath/expressions/binary/DivExpr.cpp index 5ceeb9b0d..20cf88dda 100644 --- a/src/fintamath/expressions/binary/DivExpression.cpp +++ b/src/fintamath/expressions/binary/DivExpr.cpp @@ -1,4 +1,4 @@ -#include "fintamath/expressions/binary/DivExpression.hpp" +#include "fintamath/expressions/binary/DivExpr.hpp" #include #include @@ -41,11 +41,11 @@ namespace fintamath { using namespace detail; -DivExpression::DivExpression(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild) +DivExpr::DivExpr(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild) : IBinaryExpressionCRTP(Div{}, std::move(inLhsChild), std::move(inRhsChild)) { } -std::string DivExpression::toString() const { +std::string DivExpr::toString() const { if (isNegated(lhsChild)) { return negExpr(divExpr(detail::negate(lhsChild), rhsChild))->toString(); } @@ -53,30 +53,30 @@ std::string DivExpression::toString() const { return IBinaryExpression::toString(); } -DivExpression::SimplifyFunctionVector DivExpression::getFunctionsForPreSimplify() const { +DivExpr::SimplifyFunctionVector DivExpr::getFunctionsForPreSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &DivExpression::divSimplify, - &DivExpression::mulPreSimplify, + &DivExpr::divSimplify, + &DivExpr::mulPreSimplify, }; return simplifyFunctions; } -DivExpression::SimplifyFunctionVector DivExpression::getFunctionsForPostSimplify() const { +DivExpr::SimplifyFunctionVector DivExpr::getFunctionsForPostSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &DivExpression::constSimplify, - &DivExpression::negSimplify, - &DivExpression::numSimplify, - &DivExpression::divSimplify, - &DivExpression::mulPostSimplify, - &DivExpression::nestedRationalSimplify, - &DivExpression::gcdSimplify, - &DivExpression::sumSimplify, - &DivExpression::mulSecCscSimplify, + &DivExpr::constSimplify, + &DivExpr::negSimplify, + &DivExpr::numSimplify, + &DivExpr::divSimplify, + &DivExpr::mulPostSimplify, + &DivExpr::nestedRationalSimplify, + &DivExpr::gcdSimplify, + &DivExpr::sumSimplify, + &DivExpr::mulSecCscSimplify, }; return simplifyFunctions; } -ArgumentPtr DivExpression::constSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr DivExpr::constSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if ((*lhs == Integer(0) && *rhs == Integer(0)) || (isMulInfinity(lhs) && isMulInfinity(rhs))) { @@ -102,7 +102,7 @@ ArgumentPtr DivExpression::constSimplify(const IFunction & /*func*/, const Argum return {}; } -ArgumentPtr DivExpression::numSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr DivExpr::numSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { static const Integer one = 1; if (*rhs != Integer(0) && Div{}.doArgsMatch({one, *rhs})) { @@ -113,7 +113,7 @@ ArgumentPtr DivExpression::numSimplify(const IFunction & /*func*/, const Argumen return {}; } -ArgumentPtr DivExpression::divSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr DivExpr::divSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (containsDivTrigFunction(lhs) || containsDivTrigFunction(rhs)) { return {}; } @@ -121,27 +121,27 @@ ArgumentPtr DivExpression::divSimplify(const IFunction & /*func*/, const Argumen ArgumentPtrVector numeratorChildren; ArgumentPtrVector denominatorChildren; - bool containsDivExpression = false; + bool containsDivExpr = false; - if (const auto lhsDivExpr = cast(lhs)) { + if (const auto lhsDivExpr = cast(lhs)) { numeratorChildren.emplace_back(lhsDivExpr->getChildren().front()); denominatorChildren.emplace_back(lhsDivExpr->getChildren().back()); - containsDivExpression = true; + containsDivExpr = true; } else { numeratorChildren.emplace_back(lhs); } - if (const auto rhsDivExpr = cast(rhs)) { + if (const auto rhsDivExpr = cast(rhs)) { denominatorChildren.emplace_back(rhsDivExpr->getChildren().front()); numeratorChildren.emplace_back(rhsDivExpr->getChildren().back()); - containsDivExpression = true; + containsDivExpr = true; } else { denominatorChildren.emplace_back(rhs); } - if (!containsDivExpression) { + if (!containsDivExpr) { return {}; } @@ -152,34 +152,34 @@ ArgumentPtr DivExpression::divSimplify(const IFunction & /*func*/, const Argumen return res; } -ArgumentPtr DivExpression::mulPreSimplify(const IFunction &func, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr DivExpr::mulPreSimplify(const IFunction &func, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { static const SimplifyFunctionVector simplifyFunctions = { - &DivExpression::powSimplify, + &DivExpr::powSimplify, }; return mulSimplify(simplifyFunctions, func, lhs, rhs); } -ArgumentPtr DivExpression::mulPostSimplify(const IFunction &func, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr DivExpr::mulPostSimplify(const IFunction &func, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { static const SimplifyFunctionVector simplifyFunctions = { - &DivExpression::constSimplify, - &DivExpression::equalSimplify, - &DivExpression::powSimplify, - &DivExpression::tanCotSimplify, + &DivExpr::constSimplify, + &DivExpr::equalSimplify, + &DivExpr::powSimplify, + &DivExpr::tanCotSimplify, }; return mulSimplify(simplifyFunctions, func, lhs, rhs); } -ArgumentPtr DivExpression::mulSecCscSimplify(const IFunction &func, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr DivExpr::mulSecCscSimplify(const IFunction &func, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { static const SimplifyFunctionVector simplifyFunctions = { - &DivExpression::secCscSimplify, + &DivExpr::secCscSimplify, }; return mulSimplify(simplifyFunctions, func, lhs, rhs); } -ArgumentPtr DivExpression::mulSimplify(const SimplifyFunctionVector &simplFuncs, - const IFunction &func, - const ArgumentPtr &lhs, - const ArgumentPtr &rhs) { +ArgumentPtr DivExpr::mulSimplify(const SimplifyFunctionVector &simplFuncs, + const IFunction &func, + const ArgumentPtr &lhs, + const ArgumentPtr &rhs) { ArgumentPtrVector lhsChildren = getPolynomChildren(Mul{}, lhs); ArgumentPtrVector rhsChildren = getPolynomChildren(Mul{}, rhs); @@ -227,7 +227,7 @@ ArgumentPtr DivExpression::mulSimplify(const SimplifyFunctionVector &simplFuncs, return {}; } -ArgumentPtr DivExpression::negSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr DivExpr::negSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (isNegated(rhs)) { ArgumentPtr res = divExpr(negExpr(lhs), negExpr(rhs)); return res; @@ -236,7 +236,7 @@ ArgumentPtr DivExpression::negSimplify(const IFunction & /*func*/, const Argumen return {}; } -ArgumentPtr DivExpression::sumSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr DivExpr::sumSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (auto [result, remainder] = mulSumSimplify(lhs, rhs); result) { return remainder ? addExpr(std::move(result), std::move(remainder)) @@ -266,7 +266,7 @@ ArgumentPtr DivExpression::sumSimplify(const IFunction & /*func*/, const Argumen return {}; } -std::pair DivExpression::sumSumSimplify(const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +std::pair DivExpr::sumSumSimplify(const ArgumentPtr &lhs, const ArgumentPtr &rhs) { ArgumentPtrVector lhsChildren; ArgumentPtrVector rhsChildren; @@ -290,7 +290,7 @@ std::pair DivExpression::sumSumSimplify(const Argument resultVect.emplace_back(result); if (remainder) { - const auto remainderDiv = cast(remainder); + const auto remainderDiv = cast(remainder); remainderVect.emplace_back(remainderDiv->getChildren().front()); } } @@ -311,7 +311,7 @@ std::pair DivExpression::sumSumSimplify(const Argument return {std::move(result), std::move(remainder)}; } -std::pair DivExpression::sumMulSimplify(const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +std::pair DivExpr::sumMulSimplify(const ArgumentPtr &lhs, const ArgumentPtr &rhs) { ArgumentPtrVector lhsChildren; if (const auto lhsExpr = cast(lhs); lhsExpr && is(lhsExpr->getFunction())) { @@ -364,7 +364,7 @@ std::pair DivExpression::sumMulSimplify(const Argument return {std::move(result), std::move(remainder)}; } -std::pair DivExpression::mulSumSimplify(const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +std::pair DivExpr::mulSumSimplify(const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (!containsVariable(rhs)) { return {}; } @@ -388,7 +388,7 @@ std::pair DivExpression::mulSumSimplify(const Argument ArgumentPtr result = divExpr(lhs, rhsChildren.front()); simplifyChild(result); - if (containsDivTrigFunction(result) || is(result)) { + if (containsDivTrigFunction(result) || is(result)) { return {}; } @@ -412,7 +412,7 @@ std::pair DivExpression::mulSumSimplify(const Argument return {std::move(result), std::move(remainder)}; } -ArgumentPtr DivExpression::equalSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr DivExpr::equalSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (*lhs == *rhs && !containsInfinity(lhs)) { return Integer(1).clone(); } @@ -420,7 +420,7 @@ ArgumentPtr DivExpression::equalSimplify(const IFunction & /*func*/, const Argum return {}; } -ArgumentPtr DivExpression::powSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr DivExpr::powSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { auto [lhsChildBase, lhsChildRate] = splitPowExpr(lhs); auto [rhsChildBase, rhsChildRate] = splitPowExpr(rhs); @@ -451,7 +451,7 @@ ArgumentPtr DivExpression::powSimplify(const IFunction & /*func*/, const Argumen return {}; } -ArgumentPtr DivExpression::nestedRationalSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr DivExpr::nestedRationalSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { const ArgumentPtrVector lhsChildren = getPolynomChildren(Mul{}, lhs); if (auto res = nestedNumeratorRationalSimplify(lhsChildren, rhs)) { @@ -461,7 +461,7 @@ ArgumentPtr DivExpression::nestedRationalSimplify(const IFunction & /*func*/, co return {}; } -ArgumentPtr DivExpression::gcdSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr DivExpr::gcdSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { const ArgumentPtrVector lhsChildren = getPolynomChildren(Add{}, lhs); const ArgumentPtrVector rhsChildren = getPolynomChildren(Add{}, rhs); @@ -487,7 +487,7 @@ ArgumentPtr DivExpression::gcdSimplify(const IFunction & /*func*/, const Argumen return divExpr(numerator, denominator); } -Integer DivExpression::getGcd(const ArgumentPtrVector &children) { +Integer DivExpr::getGcd(const ArgumentPtrVector &children) { Integer gcdNum; for (auto child : children) { @@ -507,7 +507,7 @@ Integer DivExpression::getGcd(const ArgumentPtrVector &children) { return gcdNum; } -ArgumentPtr DivExpression::nestedNumeratorRationalSimplify(const ArgumentPtrVector &lhsChildren, const ArgumentPtr &rhs) { +ArgumentPtr DivExpr::nestedNumeratorRationalSimplify(const ArgumentPtrVector &lhsChildren, const ArgumentPtr &rhs) { ArgumentPtrVector numeratorChildren; ArgumentPtrVector denominatorChildren; @@ -535,7 +535,7 @@ ArgumentPtr DivExpression::nestedNumeratorRationalSimplify(const ArgumentPtrVect return {}; } -ArgumentPtr DivExpression::tanCotSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr DivExpr::tanCotSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { auto [lhsChildBase, lhsChildRate] = splitPowExpr(lhs); auto [rhsChildBase, rhsChildRate] = splitPowExpr(rhs); @@ -569,7 +569,7 @@ ArgumentPtr DivExpression::tanCotSimplify(const IFunction & /*func*/, const Argu return {}; } -ArgumentPtr DivExpression::secCscSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr DivExpr::secCscSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { auto [rhsChildBase, rhsChildRate] = splitPowExpr(rhs); if (const auto rhsChildValueExpr = cast(rhsChildBase)) { @@ -593,7 +593,7 @@ ArgumentPtr DivExpression::secCscSimplify(const IFunction & /*func*/, const Argu return {}; } -bool DivExpression::containsDivTrigFunction(const ArgumentPtr &arg) { +bool DivExpr::containsDivTrigFunction(const ArgumentPtr &arg) { static const std::unordered_set functionStrings = { Tan{}.toString(), Cot{}.toString(), diff --git a/src/fintamath/expressions/binary/DivExpression.hpp b/src/fintamath/expressions/binary/DivExpr.hpp similarity index 93% rename from src/fintamath/expressions/binary/DivExpression.hpp rename to src/fintamath/expressions/binary/DivExpr.hpp index 008ac8ea6..c67984720 100644 --- a/src/fintamath/expressions/binary/DivExpression.hpp +++ b/src/fintamath/expressions/binary/DivExpr.hpp @@ -11,14 +11,14 @@ namespace fintamath { -class DivExpression final : public IBinaryExpressionCRTP { +class DivExpr final : public IBinaryExpressionCRTP { public: - explicit DivExpression(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild); + explicit DivExpr(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild); std::string toString() const override; static constexpr MathObjectType getTypeStatic() { - return {MathObjectType::DivExpression, "DivExpression"}; + return {MathObjectType::DivExpr, "DivExpr"}; } protected: diff --git a/src/fintamath/expressions/binary/IntegralExpression.cpp b/src/fintamath/expressions/binary/IntegralExpr.cpp similarity index 53% rename from src/fintamath/expressions/binary/IntegralExpression.cpp rename to src/fintamath/expressions/binary/IntegralExpr.cpp index 35c73d768..cdcea0afb 100644 --- a/src/fintamath/expressions/binary/IntegralExpression.cpp +++ b/src/fintamath/expressions/binary/IntegralExpr.cpp @@ -1,4 +1,4 @@ -#include "fintamath/expressions/binary/IntegralExpression.hpp" +#include "fintamath/expressions/binary/IntegralExpr.hpp" #include @@ -9,18 +9,18 @@ namespace fintamath { -IntegralExpression::IntegralExpression(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild) +IntegralExpr::IntegralExpr(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild) : IBinaryExpressionCRTP(Integral{}, std::move(inLhsChild), std::move(inRhsChild)) { } -IntegralExpression::SimplifyFunctionVector IntegralExpression::getFunctionsForPostSimplify() const { +IntegralExpr::SimplifyFunctionVector IntegralExpr::getFunctionsForPostSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &IntegralExpression::integralSimplify, + &IntegralExpr::integralSimplify, }; return simplifyFunctions; } -ArgumentPtr IntegralExpression::integralSimplify(const IFunction & /*func*/, const ArgumentPtr & /*lhs*/, const ArgumentPtr & /*rhs*/) { +ArgumentPtr IntegralExpr::integralSimplify(const IFunction & /*func*/, const ArgumentPtr & /*lhs*/, const ArgumentPtr & /*rhs*/) { // TODO: implement integral simplify return {}; } diff --git a/src/fintamath/expressions/binary/IntegralExpression.hpp b/src/fintamath/expressions/binary/IntegralExpr.hpp similarity index 68% rename from src/fintamath/expressions/binary/IntegralExpression.hpp rename to src/fintamath/expressions/binary/IntegralExpr.hpp index f5db08753..2c67b0d90 100644 --- a/src/fintamath/expressions/binary/IntegralExpression.hpp +++ b/src/fintamath/expressions/binary/IntegralExpr.hpp @@ -7,12 +7,12 @@ namespace fintamath { -class IntegralExpression final : public IBinaryExpressionCRTP { +class IntegralExpr final : public IBinaryExpressionCRTP { public: - explicit IntegralExpression(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild); + explicit IntegralExpr(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild); static constexpr MathObjectType getTypeStatic() { - return {MathObjectType::IntegralExpression, "IntegralExpression"}; + return {MathObjectType::IntegralExpr, "IntegralExpr"}; } protected: diff --git a/src/fintamath/expressions/binary/LogExpression.cpp b/src/fintamath/expressions/binary/LogExpr.cpp similarity index 72% rename from src/fintamath/expressions/binary/LogExpression.cpp rename to src/fintamath/expressions/binary/LogExpr.cpp index fa676ecf0..3cc9e5548 100644 --- a/src/fintamath/expressions/binary/LogExpression.cpp +++ b/src/fintamath/expressions/binary/LogExpr.cpp @@ -1,4 +1,4 @@ -#include "fintamath/expressions/binary/LogExpression.hpp" +#include "fintamath/expressions/binary/LogExpr.hpp" #include #include @@ -24,11 +24,11 @@ namespace fintamath { using namespace detail; -LogExpression::LogExpression(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild) +LogExpr::LogExpr(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild) : IBinaryExpressionCRTP(Log{}, std::move(inLhsChild), std::move(inRhsChild)) { } -std::string LogExpression::toString() const { +std::string LogExpr::toString() const { if (*lhsChild == E{}) { return functionToString(Ln{}, {rhsChild}); } @@ -36,7 +36,7 @@ std::string LogExpression::toString() const { return IBinaryExpression::toString(); } -const std::shared_ptr &LogExpression::getOutputFunction() const { +const std::shared_ptr &LogExpr::getOutputFunction() const { static const std::shared_ptr ln = std::make_shared(); if (*lhsChild == E{}) { @@ -46,9 +46,9 @@ const std::shared_ptr &LogExpression::getOutputFunction() const { return IBinaryExpression::getFunction(); } -ArgumentPtr LogExpression::approximateSimplify() const { +ArgumentPtr LogExpr::approximateSimplify() const { if (*lhsChild == E{}) { - const auto approxExpr = cast(clone()); + const auto approxExpr = cast(clone()); approximateSimplifyChild(approxExpr->rhsChild); if (is(approxExpr->rhsChild)) { @@ -63,9 +63,9 @@ ArgumentPtr LogExpression::approximateSimplify() const { return IBinaryExpression::approximateSimplify(); } -ArgumentPtr LogExpression::setPrecision(const unsigned precision, const Integer &maxInt) const { +ArgumentPtr LogExpr::setPrecision(const unsigned precision, const Integer &maxInt) const { if (*lhsChild == E{}) { - const auto approxExpr = cast(clone()); + const auto approxExpr = cast(clone()); setPrecisionChild(approxExpr->rhsChild, precision, maxInt); return approxExpr->simplify(); } @@ -73,23 +73,23 @@ ArgumentPtr LogExpression::setPrecision(const unsigned precision, const Integer return IBinaryExpression::setPrecision(precision, maxInt); } -LogExpression::SimplifyFunctionVector LogExpression::getFunctionsForPreSimplify() const { +LogExpr::SimplifyFunctionVector LogExpr::getFunctionsForPreSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &LogExpression::powSimplify, + &LogExpr::powSimplify, }; return simplifyFunctions; } -LogExpression::SimplifyFunctionVector LogExpression::getFunctionsForPostSimplify() const { +LogExpr::SimplifyFunctionVector LogExpr::getFunctionsForPostSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &LogExpression::constSimplify, - &LogExpression::powSimplify, - &LogExpression::equalSimplify, + &LogExpr::constSimplify, + &LogExpr::powSimplify, + &LogExpr::equalSimplify, }; return simplifyFunctions; } -ArgumentPtr LogExpression::constSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr LogExpr::constSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if ((*lhs == Integer(0) || isMulInfinity(lhs)) && (*rhs == Integer(0) || isMulInfinity(rhs))) { @@ -111,7 +111,7 @@ ArgumentPtr LogExpression::constSimplify(const IFunction & /*func*/, const Argum return {}; } -ArgumentPtr LogExpression::equalSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr LogExpr::equalSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (*lhs == *rhs && !containsInfinity(lhs)) { return Integer(1).clone(); } @@ -119,7 +119,7 @@ ArgumentPtr LogExpression::equalSimplify(const IFunction & /*func*/, const Argum return {}; } -ArgumentPtr LogExpression::powSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr LogExpr::powSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { ArgumentPtr res; if (const auto rhsExpr = cast(rhs); rhsExpr && is(rhsExpr->getFunction())) { diff --git a/src/fintamath/expressions/binary/LogExpression.hpp b/src/fintamath/expressions/binary/LogExpr.hpp similarity index 84% rename from src/fintamath/expressions/binary/LogExpression.hpp rename to src/fintamath/expressions/binary/LogExpr.hpp index 4e50b9413..ec73f0374 100644 --- a/src/fintamath/expressions/binary/LogExpression.hpp +++ b/src/fintamath/expressions/binary/LogExpr.hpp @@ -11,16 +11,16 @@ namespace fintamath { -class LogExpression final : public IBinaryExpressionCRTP { +class LogExpr final : public IBinaryExpressionCRTP { public: - explicit LogExpression(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild); + explicit LogExpr(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild); std::string toString() const override; const std::shared_ptr &getOutputFunction() const override; static constexpr MathObjectType getTypeStatic() { - return {MathObjectType::LogExpression, "LogExpression"}; + return {MathObjectType::LogExpr, "LogExpr"}; } protected: diff --git a/src/fintamath/expressions/binary/PowExpression.cpp b/src/fintamath/expressions/binary/PowExpr.cpp similarity index 86% rename from src/fintamath/expressions/binary/PowExpression.cpp rename to src/fintamath/expressions/binary/PowExpr.cpp index 2da8788ba..32a2d7e99 100644 --- a/src/fintamath/expressions/binary/PowExpression.cpp +++ b/src/fintamath/expressions/binary/PowExpr.cpp @@ -1,4 +1,4 @@ -#include "fintamath/expressions/binary/PowExpression.hpp" +#include "fintamath/expressions/binary/PowExpr.hpp" #include #include @@ -39,11 +39,11 @@ using namespace detail; constexpr int64_t maxPreciseRoot = 9; -PowExpression::PowExpression(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild) +PowExpr::PowExpr(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild) : IBinaryExpressionCRTP(Pow{}, std::move(inLhsChild), std::move(inRhsChild)) { } -std::string PowExpression::toString() const { +std::string PowExpr::toString() const { if (const auto rhsChildRat = cast(rhsChild)) { const Integer &numerator = rhsChildRat->numerator(); const Integer &denominator = rhsChildRat->denominator(); @@ -68,7 +68,7 @@ std::string PowExpression::toString() const { return IBinaryExpression::toString(); } -const std::shared_ptr &PowExpression::getOutputFunction() const { +const std::shared_ptr &PowExpr::getOutputFunction() const { static const std::shared_ptr sqrt = std::make_shared(); static const std::shared_ptr root = std::make_shared(); @@ -96,9 +96,9 @@ const std::shared_ptr &PowExpression::getOutputFunction() const { return IBinaryExpression::getFunction(); } -ArgumentPtr PowExpression::approximateSimplify() const { +ArgumentPtr PowExpr::approximateSimplify() const { if (const auto ratRhsChild = cast(rhsChild); ratRhsChild && ratRhsChild->denominator() <= maxPreciseRoot) { - auto approxExpr = cast(clone()); + auto approxExpr = cast(clone()); approximateSimplifyChild(approxExpr->lhsChild); if (is(approxExpr->lhsChild)) { @@ -111,9 +111,9 @@ ArgumentPtr PowExpression::approximateSimplify() const { return IBinaryExpression::approximateSimplify(); } -ArgumentPtr PowExpression::setPrecision(const unsigned precision, const Integer &maxInt) const { +ArgumentPtr PowExpr::setPrecision(const unsigned precision, const Integer &maxInt) const { if (const auto ratRhsChild = cast(rhsChild); ratRhsChild && ratRhsChild->denominator() <= maxPreciseRoot) { - auto approxExpr = cast(clone()); + auto approxExpr = cast(clone()); setPrecisionChild(approxExpr->lhsChild, precision, maxInt); return approxExpr; } @@ -121,11 +121,11 @@ ArgumentPtr PowExpression::setPrecision(const unsigned precision, const Integer return IBinaryExpression::setPrecision(precision, maxInt); } -PowExpression::SimplifyFunctionVector PowExpression::getFunctionsForPostSimplify() const { +PowExpr::SimplifyFunctionVector PowExpr::getFunctionsForPostSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &PowExpression::constSimplify, - &PowExpression::polynomSimplify, - &PowExpression::powSimplify, + &PowExpr::constSimplify, + &PowExpr::polynomSimplify, + &PowExpr::powSimplify, }; return simplifyFunctions; } @@ -134,7 +134,7 @@ PowExpression::SimplifyFunctionVector PowExpression::getFunctionsForPostSimplify // https://en.wikipedia.org/wiki/Stars_and_bars_(combinatorics) // https://en.wikipedia.org/wiki/Partition_(number_theory) // This method generate first bit number in sequence of numbers for each partition -Integer PowExpression::generateFirstNum(const Integer &countOfOne) { +Integer PowExpr::generateFirstNum(const Integer &countOfOne) { Integer n = 0; for ([[maybe_unused]] const auto _ : stdv::iota(0U, countOfOne)) { @@ -148,13 +148,13 @@ Integer PowExpression::generateFirstNum(const Integer &countOfOne) { // Uses algorithm for generating next number in sequence of partitions. // https://en.wikipedia.org/wiki/Partition_(number_theory) // https://en.wikipedia.org/wiki/Combinatorial_number_system#Applications -Integer PowExpression::generateNextNumber(const Integer &n) { +Integer PowExpr::generateNextNumber(const Integer &n) { const Integer u = n & -n; const Integer v = u + n; return v + (((v ^ n) / u) >> 2); } -std::vector PowExpression::getPartition(Integer bitNumber, const Integer &variableCount) { +std::vector PowExpr::getPartition(Integer bitNumber, const Integer &variableCount) { std::vector result; Integer counter = 0; @@ -176,7 +176,7 @@ std::vector PowExpression::getPartition(Integer bitNumber, const Intege // Uses multinomial theorem for exponentiation of sum. // https://en.wikipedia.org/wiki/Multinomial_theorem -ArgumentPtr PowExpression::sumPolynomSimplify(const ArgumentPtr &expr, const Integer &power) { +ArgumentPtr PowExpr::sumPolynomSimplify(const ArgumentPtr &expr, const Integer &power) { const auto sumExpr = cast(expr); ArgumentPtrVector polynom; @@ -212,7 +212,7 @@ ArgumentPtr PowExpression::sumPolynomSimplify(const ArgumentPtr &expr, const Int return addExpr(std::move(newChildren)); } -ArgumentPtr PowExpression::powSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr PowExpr::powSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (const auto lhsExpr = cast(lhs); lhsExpr && is(lhsExpr->getFunction())) { const ArgumentPtr &lhsExprLhsChild = lhsExpr->getChildren().front(); const ArgumentPtr &lhsExprRhsChild = lhsExpr->getChildren().back(); @@ -235,7 +235,7 @@ ArgumentPtr PowExpression::powSimplify(const IFunction & /*func*/, const Argumen return {}; } -ArgumentPtr PowExpression::constSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr PowExpr::constSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (is(rhs)) { return Undefined{}.clone(); } @@ -350,7 +350,7 @@ ArgumentPtr PowExpression::constSimplify(const IFunction & /*func*/, const Argum return {}; } -ArgumentPtr PowExpression::polynomSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr PowExpr::polynomSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (auto res = mulSimplify(lhs, rhs)) { return res; } @@ -366,7 +366,7 @@ ArgumentPtr PowExpression::polynomSimplify(const IFunction & /*func*/, const Arg return {}; } -ArgumentPtr PowExpression::mulSimplify(const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr PowExpr::mulSimplify(const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (!is(rhs)) { return {}; } @@ -386,7 +386,7 @@ ArgumentPtr PowExpression::mulSimplify(const ArgumentPtr &lhs, const ArgumentPtr return res; } -ArgumentPtr PowExpression::divSimplify(const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr PowExpr::divSimplify(const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (!is(rhs)) { return {}; } @@ -402,7 +402,7 @@ ArgumentPtr PowExpression::divSimplify(const ArgumentPtr &lhs, const ArgumentPtr return res; } -ArgumentPtr PowExpression::sumSimplify(const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr PowExpr::sumSimplify(const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (const auto rhsInt = cast(rhs)) { if (auto sumExpr = sumPolynomSimplify(lhs, *rhsInt)) { return sumExpr; diff --git a/src/fintamath/expressions/binary/PowExpression.hpp b/src/fintamath/expressions/binary/PowExpr.hpp similarity index 88% rename from src/fintamath/expressions/binary/PowExpression.hpp rename to src/fintamath/expressions/binary/PowExpr.hpp index 76ff7d829..922782cb5 100644 --- a/src/fintamath/expressions/binary/PowExpression.hpp +++ b/src/fintamath/expressions/binary/PowExpr.hpp @@ -12,16 +12,16 @@ namespace fintamath { -class PowExpression final : public IBinaryExpressionCRTP { +class PowExpr final : public IBinaryExpressionCRTP { public: - explicit PowExpression(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild); + explicit PowExpr(ArgumentPtr inLhsChild, ArgumentPtr inRhsChild); std::string toString() const override; const std::shared_ptr &getOutputFunction() const override; static constexpr MathObjectType getTypeStatic() { - return {MathObjectType::PowExpression, "PowExpression"}; + return {MathObjectType::PowExpr, "PowExpr"}; } protected: diff --git a/src/fintamath/expressions/functions/ExpressionFunctionSolve.cpp b/src/fintamath/expressions/functions/ExpressionFunctionSolve.cpp index a5e6d33ed..771281980 100644 --- a/src/fintamath/expressions/functions/ExpressionFunctionSolve.cpp +++ b/src/fintamath/expressions/functions/ExpressionFunctionSolve.cpp @@ -8,7 +8,7 @@ #include "fintamath/expressions/Expression.hpp" #include "fintamath/expressions/ExpressionUtils.hpp" #include "fintamath/expressions/IExpression.hpp" -#include "fintamath/expressions/binary/CompExpression.hpp" +#include "fintamath/expressions/binary/CompExpr.hpp" #include "fintamath/functions/FunctionArguments.hpp" #include "fintamath/functions/arithmetic/Add.hpp" #include "fintamath/functions/arithmetic/Div.hpp" @@ -36,7 +36,7 @@ ArgumentPtrVector solveLinearEquation(const ArgumentPtrVector &coeffAtPow); } Expression solve(const Expression &rhs) { - const auto compExpr = cast(rhs.getChildren().front()->clone()); + const auto compExpr = cast(rhs.getChildren().front()->clone()); if (!compExpr || compExpr->getVariables().size() != 1) { return rhs; @@ -81,7 +81,7 @@ Expression solve(const Expression &rhs) { ArgumentPtrVector answers; for (auto &root : roots) { - auto rootAnswer = std::make_shared(Eqv{}, var.clone(), root); + auto rootAnswer = std::make_shared(Eqv{}, var.clone(), root); rootAnswer->markAsSolution(); answers.emplace_back(rootAnswer); } diff --git a/src/fintamath/expressions/interfaces/IPolynomExpression.cpp b/src/fintamath/expressions/interfaces/IPolynomExpression.cpp index ec8a3978f..e819a0624 100644 --- a/src/fintamath/expressions/interfaces/IPolynomExpression.cpp +++ b/src/fintamath/expressions/interfaces/IPolynomExpression.cpp @@ -12,7 +12,7 @@ #include "fintamath/core/CoreUtils.hpp" #include "fintamath/expressions/ExpressionComparator.hpp" #include "fintamath/expressions/ExpressionUtils.hpp" -#include "fintamath/expressions/binary/CompExpression.hpp" +#include "fintamath/expressions/binary/CompExpr.hpp" #include "fintamath/functions/FunctionArguments.hpp" #include "fintamath/functions/FunctionUtils.hpp" #include "fintamath/functions/IFunction.hpp" diff --git a/src/fintamath/expressions/polynomial/AddExpression.cpp b/src/fintamath/expressions/polynomial/AddExpr.cpp similarity index 86% rename from src/fintamath/expressions/polynomial/AddExpression.cpp rename to src/fintamath/expressions/polynomial/AddExpr.cpp index babb21fce..82630599d 100644 --- a/src/fintamath/expressions/polynomial/AddExpression.cpp +++ b/src/fintamath/expressions/polynomial/AddExpr.cpp @@ -1,4 +1,4 @@ -#include "fintamath/expressions/polynomial/AddExpression.hpp" +#include "fintamath/expressions/polynomial/AddExpr.hpp" #include #include @@ -35,11 +35,11 @@ namespace fintamath { using namespace detail; -AddExpression::AddExpression(ArgumentPtrVector inChildren) +AddExpr::AddExpr(ArgumentPtrVector inChildren) : IPolynomExpressionCRTP(Add{}, std::move(inChildren)) { } -std::string AddExpression::childToString(const IOperator &oper, const ArgumentPtr &inChild, const ArgumentPtr &prevChild) const { +std::string AddExpr::childToString(const IOperator &oper, const ArgumentPtr &inChild, const ArgumentPtr &prevChild) const { std::string result = operatorChildToString(oper, inChild); bool isChildNegated = false; @@ -70,7 +70,7 @@ std::string AddExpression::childToString(const IOperator &oper, const ArgumentPt return result; } -std::strong_ordering AddExpression::compare(const ArgumentPtr &lhs, const ArgumentPtr &rhs) const { +std::strong_ordering AddExpr::compare(const ArgumentPtr &lhs, const ArgumentPtr &rhs) const { const auto lhsExpr = cast(lhs); const auto rhsExpr = cast(rhs); @@ -91,29 +91,29 @@ std::strong_ordering AddExpression::compare(const ArgumentPtr &lhs, const Argume return IPolynomExpression::compare(lhs, rhs); } -AddExpression::SimplifyFunctionVector AddExpression::getFunctionsForPreSimplify() const { +AddExpr::SimplifyFunctionVector AddExpr::getFunctionsForPreSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &AddExpression::divSimplify, - &AddExpression::constSimplify, - &AddExpression::mulSimplify, - &AddExpression::logSimplify, - &AddExpression::mulLogSimplify, + &AddExpr::divSimplify, + &AddExpr::constSimplify, + &AddExpr::mulSimplify, + &AddExpr::logSimplify, + &AddExpr::mulLogSimplify, }; return simplifyFunctions; } -AddExpression::SimplifyFunctionVector AddExpression::getFunctionsForPostSimplify() const { +AddExpr::SimplifyFunctionVector AddExpr::getFunctionsForPostSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &AddExpression::constSimplify, - &AddExpression::mulSimplify, - &AddExpression::logSimplify, - &AddExpression::mulLogSimplify, - &AddExpression::trigSimplify, + &AddExpr::constSimplify, + &AddExpr::mulSimplify, + &AddExpr::logSimplify, + &AddExpr::mulLogSimplify, + &AddExpr::trigSimplify, }; return simplifyFunctions; } -ArgumentPtr AddExpression::constSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr AddExpr::constSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (*lhs == Integer(0)) { return rhs; } @@ -145,7 +145,7 @@ ArgumentPtr AddExpression::constSimplify(const IFunction & /*func*/, const Argum return {}; } -ArgumentPtr AddExpression::logSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr AddExpr::logSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { const auto lhsExpr = cast(lhs); const auto rhsExpr = cast(rhs); @@ -167,7 +167,7 @@ ArgumentPtr AddExpression::logSimplify(const IFunction & /*func*/, const Argumen return {}; } -ArgumentPtr AddExpression::mulLogSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr AddExpr::mulLogSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { const auto lhsExpr = cast(lhs); const auto rhsExpr = cast(rhs); @@ -233,7 +233,7 @@ ArgumentPtr AddExpression::mulLogSimplify(const IFunction & /*func*/, const Argu return {}; } -std::vector AddExpression::findLogarithms(const ArgumentPtrVector &children) { +std::vector AddExpr::findLogarithms(const ArgumentPtrVector &children) { std::vector indices; for (const auto i : stdv::iota(0U, children.size())) { @@ -247,7 +247,7 @@ std::vector AddExpression::findLogarithms(const ArgumentPtrVector &child return indices; } -std::shared_ptr AddExpression::mulToLogarithm(const ArgumentPtrVector &children, const size_t i) { +std::shared_ptr AddExpr::mulToLogarithm(const ArgumentPtrVector &children, const size_t i) { ArgumentPtrVector mulChildren = children; const auto logExprChild = cast(mulChildren[i]); @@ -259,7 +259,7 @@ std::shared_ptr AddExpression::mulToLogarithm(const ArgumentP return cast(logExpr(logExprChild->getChildren().front(), logRhsChild)); } -ArgumentPtr AddExpression::mulSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr AddExpr::mulSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { { auto [lhsChildRate, lhsChildValue] = splitMulExpr(lhs, false); auto [rhsChildRate, rhsChildValue] = splitMulExpr(rhs, false); @@ -281,7 +281,7 @@ ArgumentPtr AddExpression::mulSimplify(const IFunction & /*func*/, const Argumen return {}; } -ArgumentPtr AddExpression::divSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr AddExpr::divSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { const auto lhsExpr = cast(lhs); auto rhsExpr = cast(rhs); @@ -335,7 +335,7 @@ ArgumentPtr AddExpression::divSimplify(const IFunction & /*func*/, const Argumen return res; } -ArgumentPtr AddExpression::trigSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr AddExpr::trigSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { auto [lhsMulRate, lhsMulValue] = splitMulExpr(lhs, false); auto [rhsMulRate, rhsMulValue] = splitMulExpr(rhs, false); diff --git a/src/fintamath/expressions/polynomial/AddExpression.hpp b/src/fintamath/expressions/polynomial/AddExpr.hpp similarity index 90% rename from src/fintamath/expressions/polynomial/AddExpression.hpp rename to src/fintamath/expressions/polynomial/AddExpr.hpp index b12edae46..1e1403633 100644 --- a/src/fintamath/expressions/polynomial/AddExpression.hpp +++ b/src/fintamath/expressions/polynomial/AddExpr.hpp @@ -14,12 +14,12 @@ namespace fintamath { -class AddExpression final : public IPolynomExpressionCRTP { +class AddExpr final : public IPolynomExpressionCRTP { public: - explicit AddExpression(ArgumentPtrVector inChildren); + explicit AddExpr(ArgumentPtrVector inChildren); static constexpr MathObjectType getTypeStatic() { - return {MathObjectType::AddExpression, "AddExpression"}; + return {MathObjectType::AddExpr, "AddExpr"}; } protected: diff --git a/src/fintamath/expressions/polynomial/AndExpression.cpp b/src/fintamath/expressions/polynomial/AndExpr.cpp similarity index 65% rename from src/fintamath/expressions/polynomial/AndExpression.cpp rename to src/fintamath/expressions/polynomial/AndExpr.cpp index a5e04499d..4f707493b 100644 --- a/src/fintamath/expressions/polynomial/AndExpression.cpp +++ b/src/fintamath/expressions/polynomial/AndExpr.cpp @@ -1,4 +1,4 @@ -#include "fintamath/expressions/polynomial/AndExpression.hpp" +#include "fintamath/expressions/polynomial/AndExpr.hpp" #include @@ -14,34 +14,34 @@ namespace fintamath { -AndExpression::AndExpression(ArgumentPtrVector inChildren) +AndExpr::AndExpr(ArgumentPtrVector inChildren) : IPolynomExpressionCRTP(And{}, std::move(inChildren)) { } -AndExpression::SimplifyFunctionVector AndExpression::getFunctionsForPreSimplify() const { +AndExpr::SimplifyFunctionVector AndExpr::getFunctionsForPreSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &AndExpression::boolSimplify, - &AndExpression::equalSimplify, - &AndExpression::notSimplify, + &AndExpr::boolSimplify, + &AndExpr::equalSimplify, + &AndExpr::notSimplify, }; return simplifyFunctions; } -AndExpression::SimplifyFunctionVector AndExpression::getFunctionsForPostSimplify() const { +AndExpr::SimplifyFunctionVector AndExpr::getFunctionsForPostSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &AndExpression::orSimplify, - &AndExpression::boolSimplify, - &AndExpression::equalSimplify, - &AndExpression::notSimplify, + &AndExpr::orSimplify, + &AndExpr::boolSimplify, + &AndExpr::equalSimplify, + &AndExpr::notSimplify, }; return simplifyFunctions; } -bool AndExpression::isComparableOrderInversed() const { +bool AndExpr::isComparableOrderInversed() const { return true; } -ArgumentPtr AndExpression::boolSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr AndExpr::boolSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (const auto lhsBool = cast(lhs)) { return *lhsBool ? rhs : lhs; } @@ -53,7 +53,7 @@ ArgumentPtr AndExpression::boolSimplify(const IFunction & /*func*/, const Argume return {}; } -ArgumentPtr AndExpression::equalSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr AndExpr::equalSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (*lhs == *rhs) { return lhs; } @@ -61,7 +61,7 @@ ArgumentPtr AndExpression::equalSimplify(const IFunction & /*func*/, const Argum return {}; } -ArgumentPtr AndExpression::notSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr AndExpr::notSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (const auto rhsExpr = cast(rhs); rhsExpr && is(rhsExpr->getFunction()) && @@ -73,7 +73,7 @@ ArgumentPtr AndExpression::notSimplify(const IFunction & /*func*/, const Argumen return {}; } -ArgumentPtr AndExpression::orSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr AndExpr::orSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { const auto lhsExpr = cast(lhs); const auto rhsExpr = cast(rhs); diff --git a/src/fintamath/expressions/polynomial/AndExpression.hpp b/src/fintamath/expressions/polynomial/AndExpr.hpp similarity index 83% rename from src/fintamath/expressions/polynomial/AndExpression.hpp rename to src/fintamath/expressions/polynomial/AndExpr.hpp index 5a3f8a0d6..e60e8e1ea 100644 --- a/src/fintamath/expressions/polynomial/AndExpression.hpp +++ b/src/fintamath/expressions/polynomial/AndExpr.hpp @@ -7,12 +7,12 @@ namespace fintamath { -class AndExpression final : public IPolynomExpressionCRTP { +class AndExpr final : public IPolynomExpressionCRTP { public: - explicit AndExpression(ArgumentPtrVector inChildren); + explicit AndExpr(ArgumentPtrVector inChildren); static constexpr MathObjectType getTypeStatic() { - return {MathObjectType::AndExpression, "AndExpression"}; + return {MathObjectType::AndExpr, "AndExpr"}; } protected: diff --git a/src/fintamath/expressions/polynomial/MinMaxExpression.cpp b/src/fintamath/expressions/polynomial/MinMaxExpr.cpp similarity index 64% rename from src/fintamath/expressions/polynomial/MinMaxExpression.cpp rename to src/fintamath/expressions/polynomial/MinMaxExpr.cpp index e6b68fce6..db25af23e 100644 --- a/src/fintamath/expressions/polynomial/MinMaxExpression.cpp +++ b/src/fintamath/expressions/polynomial/MinMaxExpr.cpp @@ -1,4 +1,4 @@ -#include "fintamath/expressions/polynomial/MinMaxExpression.hpp" +#include "fintamath/expressions/polynomial/MinMaxExpr.hpp" #include @@ -8,7 +8,7 @@ namespace fintamath { -MinMaxExpression::MinMaxExpression(const IFunction &inFunc, ArgumentPtrVector inChildren) +MinMaxExpr::MinMaxExpr(const IFunction &inFunc, ArgumentPtrVector inChildren) : IPolynomExpressionCRTP(inFunc, std::move(inChildren)) { } diff --git a/src/fintamath/expressions/polynomial/MinMaxExpression.hpp b/src/fintamath/expressions/polynomial/MinMaxExpr.hpp similarity index 57% rename from src/fintamath/expressions/polynomial/MinMaxExpression.hpp rename to src/fintamath/expressions/polynomial/MinMaxExpr.hpp index d2694d61e..a4be0740f 100644 --- a/src/fintamath/expressions/polynomial/MinMaxExpression.hpp +++ b/src/fintamath/expressions/polynomial/MinMaxExpr.hpp @@ -7,12 +7,12 @@ namespace fintamath { -class MinMaxExpression final : public IPolynomExpressionCRTP { +class MinMaxExpr final : public IPolynomExpressionCRTP { public: - explicit MinMaxExpression(const IFunction &inFunc, ArgumentPtrVector inChildren); + explicit MinMaxExpr(const IFunction &inFunc, ArgumentPtrVector inChildren); static constexpr MathObjectType getTypeStatic() { - return {MathObjectType::MinMaxExpression, "MinMaxExpression"}; + return {MathObjectType::MinMaxExpr, "MinMaxExpr"}; } }; diff --git a/src/fintamath/expressions/polynomial/MulExpression.cpp b/src/fintamath/expressions/polynomial/MulExpr.cpp similarity index 83% rename from src/fintamath/expressions/polynomial/MulExpression.cpp rename to src/fintamath/expressions/polynomial/MulExpr.cpp index ad50eb319..0b9d3c399 100644 --- a/src/fintamath/expressions/polynomial/MulExpression.cpp +++ b/src/fintamath/expressions/polynomial/MulExpr.cpp @@ -1,4 +1,4 @@ -#include "fintamath/expressions/polynomial/MulExpression.hpp" +#include "fintamath/expressions/polynomial/MulExpr.hpp" #include #include @@ -31,11 +31,11 @@ namespace fintamath { using namespace detail; -MulExpression::MulExpression(ArgumentPtrVector inChildren) +MulExpr::MulExpr(ArgumentPtrVector inChildren) : IPolynomExpressionCRTP(Mul{}, std::move(inChildren)) { } -std::string MulExpression::toString() const { +std::string MulExpr::toString() const { auto [childNumerator, childDenominator] = splitRational(children.front()); if (*childDenominator != Integer(1)) { @@ -67,7 +67,7 @@ std::string MulExpression::toString() const { return IPolynomExpression::toString(); } -std::string MulExpression::childToString(const IOperator &oper, const ArgumentPtr &inChild, const ArgumentPtr &prevChild) const { +std::string MulExpr::childToString(const IOperator &oper, const ArgumentPtr &inChild, const ArgumentPtr &prevChild) const { if (!prevChild && *inChild == Integer(-1)) { return Neg{}.toString(); } @@ -85,31 +85,31 @@ std::string MulExpression::childToString(const IOperator &oper, const ArgumentPt return operStr + operatorChildToString(oper, inChild); } -MulExpression::SimplifyFunctionVector MulExpression::getFunctionsForPreSimplify() const { +MulExpr::SimplifyFunctionVector MulExpr::getFunctionsForPreSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &MulExpression::rationalSimplify, - &MulExpression::divSimplify, - &MulExpression::powSimplify, + &MulExpr::rationalSimplify, + &MulExpr::divSimplify, + &MulExpr::powSimplify, }; return simplifyFunctions; } -MulExpression::SimplifyFunctionVector MulExpression::getFunctionsForPostSimplify() const { +MulExpr::SimplifyFunctionVector MulExpr::getFunctionsForPostSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &MulExpression::constSimplify, - &MulExpression::polynomSimplify, - &MulExpression::divSimplify, - &MulExpression::powSimplify, - &MulExpression::trigDoubleAngleSimplify, + &MulExpr::constSimplify, + &MulExpr::polynomSimplify, + &MulExpr::divSimplify, + &MulExpr::powSimplify, + &MulExpr::trigDoubleAngleSimplify, }; return simplifyFunctions; } -bool MulExpression::isConstantGreaterThanVariable() const { +bool MulExpr::isConstantGreaterThanVariable() const { return true; } -ArgumentPtr MulExpression::constSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr MulExpr::constSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (*lhs == Integer(0)) { if (isMulInfinity(rhs)) { return Undefined{}.clone(); @@ -165,7 +165,7 @@ ArgumentPtr MulExpression::constSimplify(const IFunction & /*func*/, const Argum return {}; } -ArgumentPtr MulExpression::rationalSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr MulExpr::rationalSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (const auto lhsRat = cast(lhs)) { ArgumentPtr numerator = mulExpr(lhsRat->numerator().clone(), rhs); ArgumentPtr denominator = lhsRat->denominator().clone(); @@ -175,7 +175,7 @@ ArgumentPtr MulExpression::rationalSimplify(const IFunction & /*func*/, const Ar return {}; } -ArgumentPtr MulExpression::divSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr MulExpr::divSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { const std::shared_ptr lhsExpr = cast(lhs); const std::shared_ptr rhsExpr = cast(rhs); @@ -213,7 +213,7 @@ ArgumentPtr MulExpression::divSimplify(const IFunction & /*func*/, const Argumen return res; } -ArgumentPtr MulExpression::polynomSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr MulExpr::polynomSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { const auto lhsExpr = cast(lhs); const auto rhsExpr = cast(rhs); @@ -268,7 +268,7 @@ ArgumentPtr MulExpression::polynomSimplify(const IFunction & /*func*/, const Arg return res; } -ArgumentPtr MulExpression::powSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr MulExpr::powSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { auto [lhsChildBase, lhsChildRate] = splitPowExpr(lhs); auto [rhsChildBase, rhsChildRate] = splitPowExpr(rhs); @@ -296,7 +296,7 @@ ArgumentPtr MulExpression::powSimplify(const IFunction & /*func*/, const Argumen return {}; } -ArgumentPtr MulExpression::trigDoubleAngleSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr MulExpr::trigDoubleAngleSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { const auto lhsExpr = cast(lhs); const auto rhsExpr = cast(rhs); diff --git a/src/fintamath/expressions/polynomial/MulExpression.hpp b/src/fintamath/expressions/polynomial/MulExpr.hpp similarity index 87% rename from src/fintamath/expressions/polynomial/MulExpression.hpp rename to src/fintamath/expressions/polynomial/MulExpr.hpp index 926fe0da7..b23503bb2 100644 --- a/src/fintamath/expressions/polynomial/MulExpression.hpp +++ b/src/fintamath/expressions/polynomial/MulExpr.hpp @@ -8,14 +8,14 @@ #include "fintamath/functions/IFunction.hpp" namespace fintamath { -class MulExpression final : public IPolynomExpressionCRTP { +class MulExpr final : public IPolynomExpressionCRTP { public: - explicit MulExpression(ArgumentPtrVector inChildren); + explicit MulExpr(ArgumentPtrVector inChildren); std::string toString() const override; static constexpr MathObjectType getTypeStatic() { - return {MathObjectType::MulExpression, "MulExpression"}; + return {MathObjectType::MulExpr, "MulExpr"}; } protected: diff --git a/src/fintamath/expressions/polynomial/OrExpression.cpp b/src/fintamath/expressions/polynomial/OrExpr.cpp similarity index 79% rename from src/fintamath/expressions/polynomial/OrExpression.cpp rename to src/fintamath/expressions/polynomial/OrExpr.cpp index a34bdf31c..bf3ff4b2b 100644 --- a/src/fintamath/expressions/polynomial/OrExpression.cpp +++ b/src/fintamath/expressions/polynomial/OrExpr.cpp @@ -1,4 +1,4 @@ -#include "fintamath/expressions/polynomial/OrExpression.hpp" +#include "fintamath/expressions/polynomial/OrExpr.hpp" #include #include @@ -20,11 +20,11 @@ namespace fintamath { using namespace detail; -OrExpression::OrExpression(ArgumentPtrVector inChildren) +OrExpr::OrExpr(ArgumentPtrVector inChildren) : IPolynomExpressionCRTP(Or{}, std::move(inChildren)) { } -std::string OrExpression::childToString(const IOperator &oper, const ArgumentPtr &inChild, const ArgumentPtr &prevChild) const { +std::string OrExpr::childToString(const IOperator &oper, const ArgumentPtr &inChild, const ArgumentPtr &prevChild) const { std::string result = operatorChildToString(oper, inChild); if (const auto &childExpr = cast(inChild); @@ -36,9 +36,9 @@ std::string OrExpression::childToString(const IOperator &oper, const ArgumentPtr return prevChild ? (putInSpaces(func->toString()) + result) : result; } -ArgumentPtr OrExpression::postSimplify() const { +ArgumentPtr OrExpr::postSimplify() const { ArgumentPtr simplObj = IPolynomExpression::postSimplify(); - auto simpl = cast(simplObj); + auto simpl = cast(simplObj); if (!simpl) { return simplObj; @@ -71,30 +71,30 @@ ArgumentPtr OrExpression::postSimplify() const { return simpl; } -OrExpression::SimplifyFunctionVector OrExpression::getFunctionsForPreSimplify() const { +OrExpr::SimplifyFunctionVector OrExpr::getFunctionsForPreSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &OrExpression::notSimplify, - &OrExpression::boolSimplify, - &OrExpression::equalSimplify, + &OrExpr::notSimplify, + &OrExpr::boolSimplify, + &OrExpr::equalSimplify, }; return simplifyFunctions; } -OrExpression::SimplifyFunctionVector OrExpression::getFunctionsForPostSimplify() const { +OrExpr::SimplifyFunctionVector OrExpr::getFunctionsForPostSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &OrExpression::andSimplify, - &OrExpression::notSimplify, - &OrExpression::boolSimplify, - &OrExpression::equalSimplify, + &OrExpr::andSimplify, + &OrExpr::notSimplify, + &OrExpr::boolSimplify, + &OrExpr::equalSimplify, }; return simplifyFunctions; } -bool OrExpression::isComparableOrderInversed() const { +bool OrExpr::isComparableOrderInversed() const { return true; } -ArgumentPtr OrExpression::boolSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr OrExpr::boolSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (const auto lhsBool = cast(lhs)) { return *lhsBool ? lhs : rhs; @@ -107,7 +107,7 @@ ArgumentPtr OrExpression::boolSimplify(const IFunction & /*func*/, const Argumen return {}; } -ArgumentPtr OrExpression::equalSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr OrExpr::equalSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (*lhs == *rhs) { return lhs; } @@ -115,7 +115,7 @@ ArgumentPtr OrExpression::equalSimplify(const IFunction & /*func*/, const Argume return {}; } -ArgumentPtr OrExpression::notSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr OrExpr::notSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { if (const auto rhsExpr = cast(rhs); rhsExpr && is(rhsExpr->getFunction()) && @@ -127,7 +127,7 @@ ArgumentPtr OrExpression::notSimplify(const IFunction & /*func*/, const Argument return {}; } -ArgumentPtr OrExpression::andSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr OrExpr::andSimplify(const IFunction & /*func*/, const ArgumentPtr &lhs, const ArgumentPtr &rhs) { const auto lhsExpr = cast(lhs); const auto rhsExpr = cast(rhs); @@ -197,7 +197,7 @@ ArgumentPtr OrExpression::andSimplify(const IFunction & /*func*/, const Argument return resultChildren.front(); } -ArgumentPtr OrExpression::absorptionSimplify(const ArgumentPtr &lhs, const ArgumentPtr &rhs) { +ArgumentPtr OrExpr::absorptionSimplify(const ArgumentPtr &lhs, const ArgumentPtr &rhs) { const auto lhsExpr = cast(lhs); const auto rhsExpr = cast(rhs); diff --git a/src/fintamath/expressions/polynomial/OrExpression.hpp b/src/fintamath/expressions/polynomial/OrExpr.hpp similarity index 86% rename from src/fintamath/expressions/polynomial/OrExpression.hpp rename to src/fintamath/expressions/polynomial/OrExpr.hpp index 856df8a77..15b0c06a0 100644 --- a/src/fintamath/expressions/polynomial/OrExpression.hpp +++ b/src/fintamath/expressions/polynomial/OrExpr.hpp @@ -9,12 +9,12 @@ namespace fintamath { -class OrExpression final : public IPolynomExpressionCRTP { +class OrExpr final : public IPolynomExpressionCRTP { public: - explicit OrExpression(ArgumentPtrVector inChildren); + explicit OrExpr(ArgumentPtrVector inChildren); static constexpr MathObjectType getTypeStatic() { - return {MathObjectType::OrExpression, "OrExpression"}; + return {MathObjectType::OrExpr, "OrExpr"}; } protected: diff --git a/src/fintamath/expressions/unary/AbsExpression.cpp b/src/fintamath/expressions/unary/AbsExpr.cpp similarity index 61% rename from src/fintamath/expressions/unary/AbsExpression.cpp rename to src/fintamath/expressions/unary/AbsExpr.cpp index fe0f717da..72ff6ff08 100644 --- a/src/fintamath/expressions/unary/AbsExpression.cpp +++ b/src/fintamath/expressions/unary/AbsExpr.cpp @@ -1,4 +1,4 @@ -#include "fintamath/expressions/unary/AbsExpression.hpp" +#include "fintamath/expressions/unary/AbsExpr.hpp" #include @@ -14,19 +14,19 @@ namespace fintamath { using namespace detail; -AbsExpression::AbsExpression(ArgumentPtr inChild) +AbsExpr::AbsExpr(ArgumentPtr inChild) : IUnaryExpressionCRTP(Abs{}, std::move(inChild)) { } -AbsExpression::SimplifyFunctionVector AbsExpression::getFunctionsForPostSimplify() const { +AbsExpr::SimplifyFunctionVector AbsExpr::getFunctionsForPostSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &AbsExpression::constSimplify, - &AbsExpression::negSimplify, + &AbsExpr::constSimplify, + &AbsExpr::negSimplify, }; return simplifyFunctions; } -ArgumentPtr AbsExpression::constSimplify(const IFunction & /*func*/, const ArgumentPtr &rhs) { +ArgumentPtr AbsExpr::constSimplify(const IFunction & /*func*/, const ArgumentPtr &rhs) { if (isInfinity(rhs)) { return Inf{}.clone(); } @@ -34,7 +34,7 @@ ArgumentPtr AbsExpression::constSimplify(const IFunction & /*func*/, const Argum return {}; } -ArgumentPtr AbsExpression::negSimplify(const IFunction & /*func*/, const ArgumentPtr &rhs) { +ArgumentPtr AbsExpr::negSimplify(const IFunction & /*func*/, const ArgumentPtr &rhs) { if (isNegated(rhs)) { return absExpr(negExpr(rhs)); } diff --git a/src/fintamath/expressions/unary/AbsExpression.hpp b/src/fintamath/expressions/unary/AbsExpr.hpp similarity index 76% rename from src/fintamath/expressions/unary/AbsExpression.hpp rename to src/fintamath/expressions/unary/AbsExpr.hpp index bba365840..b72f6b8c0 100644 --- a/src/fintamath/expressions/unary/AbsExpression.hpp +++ b/src/fintamath/expressions/unary/AbsExpr.hpp @@ -7,12 +7,12 @@ namespace fintamath { -class AbsExpression final : public IUnaryExpressionCRTP { +class AbsExpr final : public IUnaryExpressionCRTP { public: - explicit AbsExpression(ArgumentPtr inChild); + explicit AbsExpr(ArgumentPtr inChild); static constexpr MathObjectType getTypeStatic() { - return {MathObjectType::AbsExpression, "AbsExpression"}; + return {MathObjectType::AbsExpr, "AbsExpr"}; } protected: diff --git a/src/fintamath/expressions/unary/FloorCeilExpression.cpp b/src/fintamath/expressions/unary/FloorCeilExpr.cpp similarity index 68% rename from src/fintamath/expressions/unary/FloorCeilExpression.cpp rename to src/fintamath/expressions/unary/FloorCeilExpr.cpp index 8a5b22538..54c109116 100644 --- a/src/fintamath/expressions/unary/FloorCeilExpression.cpp +++ b/src/fintamath/expressions/unary/FloorCeilExpr.cpp @@ -1,4 +1,4 @@ -#include "fintamath/expressions/unary/FloorCeilExpression.hpp" +#include "fintamath/expressions/unary/FloorCeilExpr.hpp" #include #include @@ -20,19 +20,19 @@ namespace fintamath { using namespace detail; -FloorCeilExpression::FloorCeilExpression(const IFunction &inFunc, ArgumentPtr inChild) +FloorCeilExpr::FloorCeilExpr(const IFunction &inFunc, ArgumentPtr inChild) : IUnaryExpressionCRTP(inFunc, std::move(inChild)) { } -FloorCeilExpression::SimplifyFunctionVector FloorCeilExpression::getFunctionsForPostSimplify() const { +FloorCeilExpr::SimplifyFunctionVector FloorCeilExpr::getFunctionsForPostSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &FloorCeilExpression::negSimplify, - &FloorCeilExpression::intApproximateSimplify, + &FloorCeilExpr::negSimplify, + &FloorCeilExpr::intApproximateSimplify, }; return simplifyFunctions; } -ArgumentPtr FloorCeilExpression::intApproximateSimplify(const IFunction &func, const ArgumentPtr &rhs) { +ArgumentPtr FloorCeilExpr::intApproximateSimplify(const IFunction &func, const ArgumentPtr &rhs) { if (containsVariable(rhs)) { return {}; } @@ -47,7 +47,7 @@ ArgumentPtr FloorCeilExpression::intApproximateSimplify(const IFunction &func, c return {}; } -ArgumentPtr FloorCeilExpression::negSimplify(const IFunction &func, const ArgumentPtr &rhs) { +ArgumentPtr FloorCeilExpr::negSimplify(const IFunction &func, const ArgumentPtr &rhs) { if (isNegated(rhs)) { return negExpr(makeExpr(*getOppositeFunction(func), negExpr(rhs))); } @@ -55,7 +55,7 @@ ArgumentPtr FloorCeilExpression::negSimplify(const IFunction &func, const Argume return {}; } -std::shared_ptr FloorCeilExpression::getOppositeFunction(const IFunction &function) { +std::shared_ptr FloorCeilExpr::getOppositeFunction(const IFunction &function) { static const std::unordered_map> nameToOppositeFuncMap = { {Floor{}.toString(), std::make_shared()}, {Ceil{}.toString(), std::make_shared()}, diff --git a/src/fintamath/expressions/unary/FloorCeilExpression.hpp b/src/fintamath/expressions/unary/FloorCeilExpr.hpp similarity index 74% rename from src/fintamath/expressions/unary/FloorCeilExpression.hpp rename to src/fintamath/expressions/unary/FloorCeilExpr.hpp index 90ef8bcba..76be1fc4d 100644 --- a/src/fintamath/expressions/unary/FloorCeilExpression.hpp +++ b/src/fintamath/expressions/unary/FloorCeilExpr.hpp @@ -11,12 +11,12 @@ namespace fintamath { class Rational; -class FloorCeilExpression final : public IUnaryExpressionCRTP { +class FloorCeilExpr final : public IUnaryExpressionCRTP { public: - explicit FloorCeilExpression(const IFunction &inFunc, ArgumentPtr inChild); + explicit FloorCeilExpr(const IFunction &inFunc, ArgumentPtr inChild); static constexpr MathObjectType getTypeStatic() { - return {MathObjectType::FloorCeilExpression, "FloorCeilExpression"}; + return {MathObjectType::FloorCeilExpr, "FloorCeilExpr"}; } protected: diff --git a/src/fintamath/expressions/unary/HyperbExpression.cpp b/src/fintamath/expressions/unary/HyperbExpr.cpp similarity index 79% rename from src/fintamath/expressions/unary/HyperbExpression.cpp rename to src/fintamath/expressions/unary/HyperbExpr.cpp index 0051114fc..7cb4c70a5 100644 --- a/src/fintamath/expressions/unary/HyperbExpression.cpp +++ b/src/fintamath/expressions/unary/HyperbExpr.cpp @@ -1,4 +1,4 @@ -#include "fintamath/expressions/unary/HyperbExpression.hpp" +#include "fintamath/expressions/unary/HyperbExpr.hpp" #include #include @@ -33,27 +33,27 @@ using namespace detail; using NameToSimplifyFunctionMap = std::unordered_map>; -HyperbExpression::HyperbExpression(const IFunction &inFunc, ArgumentPtr inChild) +HyperbExpr::HyperbExpr(const IFunction &inFunc, ArgumentPtr inChild) : IUnaryExpressionCRTP(inFunc, std::move(inChild)) { } -HyperbExpression::SimplifyFunctionVector HyperbExpression::getFunctionsForPreSimplify() const { +HyperbExpr::SimplifyFunctionVector HyperbExpr::getFunctionsForPreSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &HyperbExpression::oppositeFunctionsSimplify, - &HyperbExpression::expandSimplify, + &HyperbExpr::oppositeFunctionsSimplify, + &HyperbExpr::expandSimplify, }; return simplifyFunctions; } -HyperbExpression::SimplifyFunctionVector HyperbExpression::getFunctionsForPostSimplify() const { +HyperbExpr::SimplifyFunctionVector HyperbExpr::getFunctionsForPostSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &HyperbExpression::oppositeFunctionsSimplify, - &HyperbExpression::negSimplify, + &HyperbExpr::oppositeFunctionsSimplify, + &HyperbExpr::negSimplify, }; return simplifyFunctions; } -ArgumentPtr HyperbExpression::oppositeFunctionsSimplify(const IFunction &func, const ArgumentPtr &rhs) { +ArgumentPtr HyperbExpr::oppositeFunctionsSimplify(const IFunction &func, const ArgumentPtr &rhs) { if (const auto expr = cast(rhs)) { if (const auto oppositeFunc = getOppositeFunction(func)) { if (*expr->getFunction() == *oppositeFunc) { @@ -65,7 +65,7 @@ ArgumentPtr HyperbExpression::oppositeFunctionsSimplify(const IFunction &func, c return {}; } -ArgumentPtr HyperbExpression::expandSimplify(const IFunction &func, const ArgumentPtr &rhs) { +ArgumentPtr HyperbExpr::expandSimplify(const IFunction &func, const ArgumentPtr &rhs) { static const NameToSimplifyFunctionMap nameToExpandFunctionMap = { {Tanh{}.toString(), [](const ArgumentPtr &inRhs) { @@ -92,7 +92,7 @@ ArgumentPtr HyperbExpression::expandSimplify(const IFunction &func, const Argume return {}; } -ArgumentPtr HyperbExpression::negSimplify(const IFunction &func, const ArgumentPtr &rhs) { +ArgumentPtr HyperbExpr::negSimplify(const IFunction &func, const ArgumentPtr &rhs) { static const NameToSimplifyFunctionMap nameToNegFunctionsMap = { {Sinh{}.toString(), [](const ArgumentPtr &inRhs) { @@ -113,7 +113,7 @@ ArgumentPtr HyperbExpression::negSimplify(const IFunction &func, const ArgumentP return {}; } -std::shared_ptr HyperbExpression::getOppositeFunction(const IFunction &function) { +std::shared_ptr HyperbExpr::getOppositeFunction(const IFunction &function) { static const std::unordered_map> nameToOppositeFunctionMap = { {Sinh{}.toString(), std::make_unique()}, {Cosh{}.toString(), std::make_unique()}, diff --git a/src/fintamath/expressions/unary/HyperbExpression.hpp b/src/fintamath/expressions/unary/HyperbExpr.hpp similarity index 79% rename from src/fintamath/expressions/unary/HyperbExpression.hpp rename to src/fintamath/expressions/unary/HyperbExpr.hpp index e798a7db6..66c87edde 100644 --- a/src/fintamath/expressions/unary/HyperbExpression.hpp +++ b/src/fintamath/expressions/unary/HyperbExpr.hpp @@ -9,12 +9,12 @@ namespace fintamath { -class HyperbExpression final : public IUnaryExpressionCRTP { +class HyperbExpr final : public IUnaryExpressionCRTP { public: - explicit HyperbExpression(const IFunction &inFunc, ArgumentPtr inChild); + explicit HyperbExpr(const IFunction &inFunc, ArgumentPtr inChild); static constexpr MathObjectType getTypeStatic() { - return {MathObjectType::HyperbExpression, "HyperbExpression"}; + return {MathObjectType::HyperbExpr, "HyperbExpr"}; } protected: diff --git a/src/fintamath/expressions/unary/InvHyperbExpression.cpp b/src/fintamath/expressions/unary/InvHyperbExpr.cpp similarity index 64% rename from src/fintamath/expressions/unary/InvHyperbExpression.cpp rename to src/fintamath/expressions/unary/InvHyperbExpr.cpp index 341df6166..9ff549e8c 100644 --- a/src/fintamath/expressions/unary/InvHyperbExpression.cpp +++ b/src/fintamath/expressions/unary/InvHyperbExpr.cpp @@ -1,4 +1,4 @@ -#include "fintamath/expressions/unary/InvHyperbExpression.hpp" +#include "fintamath/expressions/unary/InvHyperbExpr.hpp" #include @@ -8,7 +8,7 @@ namespace fintamath { -InvHyperbExpression::InvHyperbExpression(const IFunction &inFunc, ArgumentPtr inChild) +InvHyperbExpr::InvHyperbExpr(const IFunction &inFunc, ArgumentPtr inChild) : IUnaryExpressionCRTP(inFunc, std::move(inChild)) { } diff --git a/src/fintamath/expressions/unary/InvHyperbExpression.hpp b/src/fintamath/expressions/unary/InvHyperbExpr.hpp similarity index 57% rename from src/fintamath/expressions/unary/InvHyperbExpression.hpp rename to src/fintamath/expressions/unary/InvHyperbExpr.hpp index 027efd17d..8dcf74f03 100644 --- a/src/fintamath/expressions/unary/InvHyperbExpression.hpp +++ b/src/fintamath/expressions/unary/InvHyperbExpr.hpp @@ -7,12 +7,12 @@ namespace fintamath { -class InvHyperbExpression final : public IUnaryExpressionCRTP { +class InvHyperbExpr final : public IUnaryExpressionCRTP { public: - explicit InvHyperbExpression(const IFunction &inFunc, ArgumentPtr inChild); + explicit InvHyperbExpr(const IFunction &inFunc, ArgumentPtr inChild); static constexpr MathObjectType getTypeStatic() { - return {MathObjectType::InvHyperbExpression, "InvHyperbExpression"}; + return {MathObjectType::InvHyperbExpr, "InvHyperbExpr"}; } }; diff --git a/src/fintamath/expressions/unary/InvTrigExpression.cpp b/src/fintamath/expressions/unary/InvTrigExpr.cpp similarity index 88% rename from src/fintamath/expressions/unary/InvTrigExpression.cpp rename to src/fintamath/expressions/unary/InvTrigExpr.cpp index e4d14ba95..a9b7fdb8f 100644 --- a/src/fintamath/expressions/unary/InvTrigExpression.cpp +++ b/src/fintamath/expressions/unary/InvTrigExpr.cpp @@ -1,4 +1,4 @@ -#include "fintamath/expressions/unary/InvTrigExpression.hpp" +#include "fintamath/expressions/unary/InvTrigExpr.hpp" #include #include @@ -34,18 +34,18 @@ using TrigTable = std::unordered_map(*rhs)) { const Rational sqr = pow(*rat, 2) * rat->sign(); return TrigTableSimplify(func, sqr); @@ -77,7 +77,7 @@ ArgumentPtr InvTrigExpression::constSimplify(const IFunction &func, const Argume return {}; } -ArgumentPtr InvTrigExpression::TrigTableSimplify(const IFunction &func, const Rational &rhs) { +ArgumentPtr InvTrigExpr::TrigTableSimplify(const IFunction &func, const Rational &rhs) { static const NameToSimplifyFunctionMap nameToSimplifyFunctionMap = { {Asin{}.toString(), &TrigTableAsinSimplify}, {Acos{}.toString(), &TrigTableAcosSimplify}, @@ -89,7 +89,7 @@ ArgumentPtr InvTrigExpression::TrigTableSimplify(const IFunction &func, const Ra return nameToSimplifyFunctionMap.at(func.toString())(rhs); } -ArgumentPtr InvTrigExpression::TrigTableAsinSimplify(const Rational &rhs) { +ArgumentPtr InvTrigExpr::TrigTableAsinSimplify(const Rational &rhs) { static const TrigTable trigTable = { {Rational(-1), mulExpr(Rational(-1, 2), Pi{})}, // -1 | -π/2 {Rational(-3, 4), mulExpr(Rational(-1, 3), Pi{})}, // -√3/2 | -π/3 @@ -104,7 +104,7 @@ ArgumentPtr InvTrigExpression::TrigTableAsinSimplify(const Rational &rhs) { return findValue(trigTable, rhs); } -ArgumentPtr InvTrigExpression::TrigTableAcosSimplify(const Rational &rhs) { +ArgumentPtr InvTrigExpr::TrigTableAcosSimplify(const Rational &rhs) { static const TrigTable trigTable = { {Rational(-1), Pi{}.clone()}, // -1 | π {Rational(-3, 4), mulExpr(Rational(5, 6), Pi{})}, // -√3/2 | 5π/6 @@ -119,7 +119,7 @@ ArgumentPtr InvTrigExpression::TrigTableAcosSimplify(const Rational &rhs) { return findValue(trigTable, rhs); } -ArgumentPtr InvTrigExpression::TrigTableAtanSimplify(const Rational &rhs) { +ArgumentPtr InvTrigExpr::TrigTableAtanSimplify(const Rational &rhs) { static const TrigTable trigTable = { {Rational(-3), mulExpr(Rational(-1, 3), Pi{})}, // -√3 | -π/3 {Rational(-1), mulExpr(Rational(-1, 4), Pi{})}, // -1 | -π/4 @@ -132,7 +132,7 @@ ArgumentPtr InvTrigExpression::TrigTableAtanSimplify(const Rational &rhs) { return findValue(trigTable, rhs); } -ArgumentPtr InvTrigExpression::TrigTableAcotSimplify(const Rational &rhs) { +ArgumentPtr InvTrigExpr::TrigTableAcotSimplify(const Rational &rhs) { static const TrigTable trigTable = { {Rational(-3), mulExpr(Rational(-1, 6), Pi{})}, // -√3 | -π/6 {Rational(-1), mulExpr(Rational(-1, 4), Pi{})}, // -1 | -π/4 @@ -145,7 +145,7 @@ ArgumentPtr InvTrigExpression::TrigTableAcotSimplify(const Rational &rhs) { return findValue(trigTable, rhs); } -ArgumentPtr InvTrigExpression::TrigTableAsecSimplify(const Rational &rhs) { +ArgumentPtr InvTrigExpr::TrigTableAsecSimplify(const Rational &rhs) { static const TrigTable trigTable = { {Rational(-1), Pi{}.clone()}, // -1 | π {Rational(-4, 3), mulExpr(Rational(5, 6), Pi{})}, // -2/√3 | 5π/6 @@ -160,7 +160,7 @@ ArgumentPtr InvTrigExpression::TrigTableAsecSimplify(const Rational &rhs) { return findValue(trigTable, rhs); } -ArgumentPtr InvTrigExpression::TrigTableAcscSimplify(const Rational &rhs) { +ArgumentPtr InvTrigExpr::TrigTableAcscSimplify(const Rational &rhs) { static const TrigTable trigTable = { {Rational(-1), mulExpr(Rational(-1, 2), Pi{})}, // -1 | -π/2 {Rational(-4, 3), mulExpr(Rational(-1, 3), Pi{})}, // -2/√3 | -π/3 diff --git a/src/fintamath/expressions/unary/InvTrigExpression.hpp b/src/fintamath/expressions/unary/InvTrigExpr.hpp similarity index 81% rename from src/fintamath/expressions/unary/InvTrigExpression.hpp rename to src/fintamath/expressions/unary/InvTrigExpr.hpp index 56e234c0f..0f1f4f589 100644 --- a/src/fintamath/expressions/unary/InvTrigExpression.hpp +++ b/src/fintamath/expressions/unary/InvTrigExpr.hpp @@ -9,12 +9,12 @@ namespace fintamath { class Rational; -class InvTrigExpression final : public IUnaryExpressionCRTP { +class InvTrigExpr final : public IUnaryExpressionCRTP { public: - explicit InvTrigExpression(const IFunction &inFunc, ArgumentPtr inChild); + explicit InvTrigExpr(const IFunction &inFunc, ArgumentPtr inChild); static constexpr MathObjectType getTypeStatic() { - return {MathObjectType::InvTrigExpression, "InvTrigExpression"}; + return {MathObjectType::InvTrigExpr, "InvTrigExpr"}; } protected: diff --git a/src/fintamath/expressions/unary/NotExpression.cpp b/src/fintamath/expressions/unary/NotExpr.cpp similarity index 76% rename from src/fintamath/expressions/unary/NotExpression.cpp rename to src/fintamath/expressions/unary/NotExpr.cpp index 1f270ba8d..463fd812b 100644 --- a/src/fintamath/expressions/unary/NotExpression.cpp +++ b/src/fintamath/expressions/unary/NotExpr.cpp @@ -1,4 +1,4 @@ -#include "fintamath/expressions/unary/NotExpression.hpp" +#include "fintamath/expressions/unary/NotExpr.hpp" #include #include @@ -26,26 +26,26 @@ namespace fintamath { using namespace detail; -NotExpression::NotExpression(ArgumentPtr inChild) +NotExpr::NotExpr(ArgumentPtr inChild) : IUnaryExpressionCRTP(Not{}, std::move(inChild)) { } -NotExpression::SimplifyFunctionVector NotExpression::getFunctionsForPreSimplify() const { +NotExpr::SimplifyFunctionVector NotExpr::getFunctionsForPreSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &NotExpression::nestedNotSimplify, + &NotExpr::nestedNotSimplify, }; return simplifyFunctions; } -NotExpression::SimplifyFunctionVector NotExpression::getFunctionsForPostSimplify() const { +NotExpr::SimplifyFunctionVector NotExpr::getFunctionsForPostSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &NotExpression::logicNegatableSimplify, - &NotExpression::nestedNotSimplify, + &NotExpr::logicNegatableSimplify, + &NotExpr::nestedNotSimplify, }; return simplifyFunctions; } -ArgumentPtr NotExpression::logicNegatableSimplify(const IFunction & /*func*/, const ArgumentPtr &rhs) { +ArgumentPtr NotExpr::logicNegatableSimplify(const IFunction & /*func*/, const ArgumentPtr &rhs) { const std::shared_ptr rhsExpr = cast(rhs); if (!rhsExpr) { @@ -81,15 +81,15 @@ ArgumentPtr NotExpression::logicNegatableSimplify(const IFunction & /*func*/, co return res; } -ArgumentPtr NotExpression::nestedNotSimplify(const IFunction & /*func*/, const ArgumentPtr &rhs) { - if (const auto expr = cast(rhs)) { +ArgumentPtr NotExpr::nestedNotSimplify(const IFunction & /*func*/, const ArgumentPtr &rhs) { + if (const auto expr = cast(rhs)) { return expr->child; } return {}; } -std::shared_ptr NotExpression::getLogicOppositeFunction(const IFunction &function) { +std::shared_ptr NotExpr::getLogicOppositeFunction(const IFunction &function) { static const std::unordered_map> nameToOppositeFunctionMap = { {Eqv{}.toString(), std::make_shared()}, {Neqv{}.toString(), std::make_shared()}, diff --git a/src/fintamath/expressions/unary/NotExpression.hpp b/src/fintamath/expressions/unary/NotExpr.hpp similarity index 80% rename from src/fintamath/expressions/unary/NotExpression.hpp rename to src/fintamath/expressions/unary/NotExpr.hpp index d5c23b00d..1f001ce27 100644 --- a/src/fintamath/expressions/unary/NotExpression.hpp +++ b/src/fintamath/expressions/unary/NotExpr.hpp @@ -9,12 +9,12 @@ namespace fintamath { -class NotExpression final : public IUnaryExpressionCRTP { +class NotExpr final : public IUnaryExpressionCRTP { public: - explicit NotExpression(ArgumentPtr inChild); + explicit NotExpr(ArgumentPtr inChild); static constexpr MathObjectType getTypeStatic() { - return {MathObjectType::NotExpression, "NotExpression"}; + return {MathObjectType::NotExpr, "NotExpr"}; } protected: diff --git a/src/fintamath/expressions/unary/SignExpression.cpp b/src/fintamath/expressions/unary/SignExpr.cpp similarity index 68% rename from src/fintamath/expressions/unary/SignExpression.cpp rename to src/fintamath/expressions/unary/SignExpr.cpp index d8af5b2a8..fb77bb287 100644 --- a/src/fintamath/expressions/unary/SignExpression.cpp +++ b/src/fintamath/expressions/unary/SignExpr.cpp @@ -1,4 +1,4 @@ -#include "fintamath/expressions/unary/SignExpression.hpp" +#include "fintamath/expressions/unary/SignExpr.hpp" #include @@ -18,20 +18,20 @@ namespace fintamath { using namespace detail; -SignExpression::SignExpression(ArgumentPtr inChild) +SignExpr::SignExpr(ArgumentPtr inChild) : IUnaryExpressionCRTP(Sign{}, std::move(inChild)) { } -SignExpression::SimplifyFunctionVector SignExpression::getFunctionsForPostSimplify() const { +SignExpr::SimplifyFunctionVector SignExpr::getFunctionsForPostSimplify() const { static const SimplifyFunctionVector simplifyFunctions = { - &SignExpression::constSimplify, - &SignExpression::negSimplify, - &SignExpression::intApproximateSimplify, + &SignExpr::constSimplify, + &SignExpr::negSimplify, + &SignExpr::intApproximateSimplify, }; return simplifyFunctions; } -ArgumentPtr SignExpression::constSimplify(const IFunction & /*func*/, const ArgumentPtr &rhs) { +ArgumentPtr SignExpr::constSimplify(const IFunction & /*func*/, const ArgumentPtr &rhs) { if (is(rhs)) { return Integer(1).clone(); } @@ -47,7 +47,7 @@ ArgumentPtr SignExpression::constSimplify(const IFunction & /*func*/, const Argu return {}; } -ArgumentPtr SignExpression::intApproximateSimplify(const IFunction &func, const ArgumentPtr &rhs) { +ArgumentPtr SignExpr::intApproximateSimplify(const IFunction &func, const ArgumentPtr &rhs) { if (containsVariable(rhs)) { return {}; } @@ -62,7 +62,7 @@ ArgumentPtr SignExpression::intApproximateSimplify(const IFunction &func, const return {}; } -ArgumentPtr SignExpression::negSimplify(const IFunction & /*func*/, const ArgumentPtr &rhs) { +ArgumentPtr SignExpr::negSimplify(const IFunction & /*func*/, const ArgumentPtr &rhs) { if (isNegated(rhs)) { return negExpr(signExpr(negExpr(rhs))); } diff --git a/src/fintamath/expressions/unary/SignExpression.hpp b/src/fintamath/expressions/unary/SignExpr.hpp similarity index 78% rename from src/fintamath/expressions/unary/SignExpression.hpp rename to src/fintamath/expressions/unary/SignExpr.hpp index 7da7040bc..1795da67f 100644 --- a/src/fintamath/expressions/unary/SignExpression.hpp +++ b/src/fintamath/expressions/unary/SignExpr.hpp @@ -7,12 +7,12 @@ namespace fintamath { -class SignExpression final : public IUnaryExpressionCRTP { +class SignExpr final : public IUnaryExpressionCRTP { public: - explicit SignExpression(ArgumentPtr inChild); + explicit SignExpr(ArgumentPtr inChild); static constexpr MathObjectType getTypeStatic() { - return {MathObjectType::SignExpression, "SignExpression"}; + return {MathObjectType::SignExpr, "SignExpr"}; } protected: diff --git a/src/fintamath/expressions/unary/TrigExpression.cpp b/src/fintamath/expressions/unary/TrigExpr.cpp similarity index 84% rename from src/fintamath/expressions/unary/TrigExpression.cpp rename to src/fintamath/expressions/unary/TrigExpr.cpp index 48113cb95..84bd5f10a 100644 --- a/src/fintamath/expressions/unary/TrigExpression.cpp +++ b/src/fintamath/expressions/unary/TrigExpr.cpp @@ -1,4 +1,4 @@ -#include "fintamath/expressions/unary/TrigExpression.hpp" +#include "fintamath/expressions/unary/TrigExpr.hpp" #include #include @@ -46,28 +46,28 @@ using TrigTable = std::unordered_map(rhs)) { if (const auto oppositeFunc = getOppositeFunction(func)) { if (*expr->getFunction() == *oppositeFunc) { @@ -79,7 +79,7 @@ ArgumentPtr TrigExpression::oppositeFunctionsSimplify(const IFunction &func, con return {}; } -ArgumentPtr TrigExpression::expandSimplify(const IFunction &func, const ArgumentPtr &rhs) { +ArgumentPtr TrigExpr::expandSimplify(const IFunction &func, const ArgumentPtr &rhs) { static const NameToSimplifyFunctionMap nameToExpandFunctionMap = { {Tan{}.toString(), [](const ArgumentPtr &inRhs) { @@ -106,7 +106,7 @@ ArgumentPtr TrigExpression::expandSimplify(const IFunction &func, const Argument return {}; } -ArgumentPtr TrigExpression::negSimplify(const IFunction &func, const ArgumentPtr &rhs) { +ArgumentPtr TrigExpr::negSimplify(const IFunction &func, const ArgumentPtr &rhs) { static const NameToSimplifyFunctionMap nameToNegFunctionMap = { {Sin{}.toString(), [](const ArgumentPtr &inRhs) { @@ -127,7 +127,7 @@ ArgumentPtr TrigExpression::negSimplify(const IFunction &func, const ArgumentPtr return {}; } -ArgumentPtr TrigExpression::constSimplify(const IFunction &func, const ArgumentPtr &rhs) { +ArgumentPtr TrigExpr::constSimplify(const IFunction &func, const ArgumentPtr &rhs) { if (*rhs == Pi{}) { return TrigTableSimplify(func, 1); } @@ -154,7 +154,7 @@ ArgumentPtr TrigExpression::constSimplify(const IFunction &func, const ArgumentP return TrigTableSimplify(func, *rhsChildRat); } -ArgumentPtr TrigExpression::TrigTableSimplify(const IFunction &func, const Rational &rhs) { +ArgumentPtr TrigExpr::TrigTableSimplify(const IFunction &func, const Rational &rhs) { static const NameToTrigFunctionMap nameToTrigFunctionMap = { {Sin{}.toString(), &TrigTableSinSimplify}, {Cos{}.toString(), &TrigTableCosSimplify}, @@ -168,7 +168,7 @@ ArgumentPtr TrigExpression::TrigTableSimplify(const IFunction &func, const Ratio return {}; } -ArgumentPtr TrigExpression::TrigTableSinSimplify(const Rational &rhs) { +ArgumentPtr TrigExpr::TrigTableSinSimplify(const Rational &rhs) { static const TrigTable trigTable = { {Rational(0), Integer(0).clone()}, // 0 | 0 {Rational(1, 6), Rational(1, 2).clone()}, // π/6 | 1/2 @@ -184,7 +184,7 @@ ArgumentPtr TrigExpression::TrigTableSinSimplify(const Rational &rhs) { return findValue(trigTable, rhsShifted, isNegated); } -ArgumentPtr TrigExpression::TrigTableCosSimplify(const Rational &rhs) { +ArgumentPtr TrigExpr::TrigTableCosSimplify(const Rational &rhs) { static const TrigTable trigTable = { {Rational(0), Integer(1).clone()}, // 0 | 1 {Rational(1, 6), mulExpr(Rational(1, 2).clone(), sqrtExpr(Integer(3)))}, // π/6 | √3/2 @@ -200,7 +200,7 @@ ArgumentPtr TrigExpression::TrigTableCosSimplify(const Rational &rhs) { return findValue(trigTable, rhsShifted, isNegated); } -std::tuple TrigExpression::phaseShiftSin(const Rational &rhs) { +std::tuple TrigExpr::phaseShiftSin(const Rational &rhs) { Rational rhsShifted = rhs; bool isNegated = false; @@ -217,7 +217,7 @@ std::tuple TrigExpression::phaseShiftSin(const Rational &rhs) { return {rhsShifted, isNegated}; } -std::tuple TrigExpression::phaseShiftCos(const Rational &rhs) { +std::tuple TrigExpr::phaseShiftCos(const Rational &rhs) { Rational rhsShifted = rhs; bool isNegated = false; @@ -233,11 +233,11 @@ std::tuple TrigExpression::phaseShiftCos(const Rational &rhs) { return {rhsShifted, isNegated}; } -Rational TrigExpression::phaseShiftPeriod(const Rational &rhs) { +Rational TrigExpr::phaseShiftPeriod(const Rational &rhs) { return Rational(rhs.numerator() % (rhs.denominator() * 2), rhs.denominator()); } -std::shared_ptr TrigExpression::getOppositeFunction(const IFunction &function) { +std::shared_ptr TrigExpr::getOppositeFunction(const IFunction &function) { static const std::unordered_map> nameToOppositeFunctions = { {Sin{}.toString(), std::make_shared()}, {Cos{}.toString(), std::make_shared()}, diff --git a/src/fintamath/expressions/unary/TrigExpression.hpp b/src/fintamath/expressions/unary/TrigExpr.hpp similarity index 86% rename from src/fintamath/expressions/unary/TrigExpression.hpp rename to src/fintamath/expressions/unary/TrigExpr.hpp index ccd565145..aadaec53e 100644 --- a/src/fintamath/expressions/unary/TrigExpression.hpp +++ b/src/fintamath/expressions/unary/TrigExpr.hpp @@ -12,12 +12,12 @@ namespace fintamath { class Rational; -class TrigExpression final : public IUnaryExpressionCRTP { +class TrigExpr final : public IUnaryExpressionCRTP { public: - explicit TrigExpression(const IFunction &inFunc, ArgumentPtr inChild); + explicit TrigExpr(const IFunction &inFunc, ArgumentPtr inChild); static constexpr MathObjectType getTypeStatic() { - return {MathObjectType::TrigExpression, "TrigExpression"}; + return {MathObjectType::TrigExpr, "TrigExpr"}; } protected: diff --git a/tests/src/expressions/binary/CompExpressionTests.cpp b/tests/src/expressions/binary/CompExprTests.cpp similarity index 73% rename from tests/src/expressions/binary/CompExpressionTests.cpp rename to tests/src/expressions/binary/CompExprTests.cpp index cdbdbd521..474c5705e 100644 --- a/tests/src/expressions/binary/CompExpressionTests.cpp +++ b/tests/src/expressions/binary/CompExprTests.cpp @@ -6,6 +6,6 @@ using namespace fintamath; -TEST(CompExpressionTests, getTypeTest) { - EXPECT_EQ(eqvExpr(Integer(0), Integer(0))->getType(), MathObjectType(MathObjectType::CompExpression, "CompExpression")); +TEST(CompExprTests, getTypeTest) { + EXPECT_EQ(eqvExpr(Integer(0), Integer(0))->getType(), MathObjectType(MathObjectType::CompExpr, "CompExpr")); } diff --git a/tests/src/expressions/binary/DerivativeExpressionTests.cpp b/tests/src/expressions/binary/DerivativeExprTests.cpp similarity index 68% rename from tests/src/expressions/binary/DerivativeExpressionTests.cpp rename to tests/src/expressions/binary/DerivativeExprTests.cpp index 8395c9b87..89bc6617e 100644 --- a/tests/src/expressions/binary/DerivativeExpressionTests.cpp +++ b/tests/src/expressions/binary/DerivativeExprTests.cpp @@ -6,6 +6,6 @@ using namespace fintamath; -TEST(DerivativeExpressionTests, getTypeTest) { - EXPECT_EQ(derivativeExpr(Integer(0), Variable("x"))->getType(), MathObjectType(MathObjectType::DerivativeExpression, "DerivativeExpression")); +TEST(DerivativeExprTests, getTypeTest) { + EXPECT_EQ(derivativeExpr(Integer(0), Variable("x"))->getType(), MathObjectType(MathObjectType::DerivativeExpr, "DerivativeExpr")); } diff --git a/tests/src/expressions/binary/DivExpressionTests.cpp b/tests/src/expressions/binary/DivExprTests.cpp similarity index 73% rename from tests/src/expressions/binary/DivExpressionTests.cpp rename to tests/src/expressions/binary/DivExprTests.cpp index 0d24d9f1e..f81e42c91 100644 --- a/tests/src/expressions/binary/DivExpressionTests.cpp +++ b/tests/src/expressions/binary/DivExprTests.cpp @@ -6,6 +6,6 @@ using namespace fintamath; -TEST(DivExpressionTests, getTypeTest) { - EXPECT_EQ(divExpr(Integer(0), Integer(0))->getType(), MathObjectType(MathObjectType::DivExpression, "DivExpression")); +TEST(DivExprTests, getTypeTest) { + EXPECT_EQ(divExpr(Integer(0), Integer(0))->getType(), MathObjectType(MathObjectType::DivExpr, "DivExpr")); } diff --git a/tests/src/expressions/binary/IntegralExpressionTests.cpp b/tests/src/expressions/binary/IntegralExprTests.cpp similarity index 69% rename from tests/src/expressions/binary/IntegralExpressionTests.cpp rename to tests/src/expressions/binary/IntegralExprTests.cpp index 0434dc29a..759722501 100644 --- a/tests/src/expressions/binary/IntegralExpressionTests.cpp +++ b/tests/src/expressions/binary/IntegralExprTests.cpp @@ -6,6 +6,6 @@ using namespace fintamath; -TEST(IntegralExpressionTests, getTypeTest) { - EXPECT_EQ(integralExpr(Integer(0), Variable("x"))->getType(), MathObjectType(MathObjectType::IntegralExpression, "IntegralExpression")); +TEST(IntegralExprTests, getTypeTest) { + EXPECT_EQ(integralExpr(Integer(0), Variable("x"))->getType(), MathObjectType(MathObjectType::IntegralExpr, "IntegralExpr")); } diff --git a/tests/src/expressions/binary/LogExpressionTests.cpp b/tests/src/expressions/binary/LogExprTests.cpp similarity index 73% rename from tests/src/expressions/binary/LogExpressionTests.cpp rename to tests/src/expressions/binary/LogExprTests.cpp index 8fb5a9d2b..7ac04d96e 100644 --- a/tests/src/expressions/binary/LogExpressionTests.cpp +++ b/tests/src/expressions/binary/LogExprTests.cpp @@ -6,6 +6,6 @@ using namespace fintamath; -TEST(LogExpressionTests, getTypeTest) { - EXPECT_EQ(logExpr(Integer(0), Integer(0))->getType(), MathObjectType(MathObjectType::LogExpression, "LogExpression")); +TEST(LogExprTests, getTypeTest) { + EXPECT_EQ(logExpr(Integer(0), Integer(0))->getType(), MathObjectType(MathObjectType::LogExpr, "LogExpr")); } diff --git a/tests/src/expressions/binary/PowExpressionTests.cpp b/tests/src/expressions/binary/PowExprTests.cpp similarity index 73% rename from tests/src/expressions/binary/PowExpressionTests.cpp rename to tests/src/expressions/binary/PowExprTests.cpp index 655c140e8..47a56041d 100644 --- a/tests/src/expressions/binary/PowExpressionTests.cpp +++ b/tests/src/expressions/binary/PowExprTests.cpp @@ -6,6 +6,6 @@ using namespace fintamath; -TEST(PowExpressionTests, getTypeTest) { - EXPECT_EQ(powExpr(Integer(0), Integer(0))->getType(), MathObjectType(MathObjectType::PowExpression, "PowExpression")); +TEST(PowExprTests, getTypeTest) { + EXPECT_EQ(powExpr(Integer(0), Integer(0))->getType(), MathObjectType(MathObjectType::PowExpr, "PowExpr")); } diff --git a/tests/src/expressions/polynomial/AddExpressionTests.cpp b/tests/src/expressions/polynomial/AddExprTests.cpp similarity index 73% rename from tests/src/expressions/polynomial/AddExpressionTests.cpp rename to tests/src/expressions/polynomial/AddExprTests.cpp index 7906f21a2..05f6c89ee 100644 --- a/tests/src/expressions/polynomial/AddExpressionTests.cpp +++ b/tests/src/expressions/polynomial/AddExprTests.cpp @@ -6,6 +6,6 @@ using namespace fintamath; -TEST(AddExpressionTests, getTypeTest) { - EXPECT_EQ(addExpr(Integer(0), Integer(0))->getType(), MathObjectType(MathObjectType::AddExpression, "AddExpression")); +TEST(AddExprTests, getTypeTest) { + EXPECT_EQ(addExpr(Integer(0), Integer(0))->getType(), MathObjectType(MathObjectType::AddExpr, "AddExpr")); } diff --git a/tests/src/expressions/polynomial/AndExpressionTests.cpp b/tests/src/expressions/polynomial/AndExprTests.cpp similarity index 73% rename from tests/src/expressions/polynomial/AndExpressionTests.cpp rename to tests/src/expressions/polynomial/AndExprTests.cpp index 4f8ebdf0f..8d10d7f0b 100644 --- a/tests/src/expressions/polynomial/AndExpressionTests.cpp +++ b/tests/src/expressions/polynomial/AndExprTests.cpp @@ -6,6 +6,6 @@ using namespace fintamath; -TEST(AndExpressionTests, getTypeTest) { - EXPECT_EQ(andExpr(Boolean(), Boolean())->getType(), MathObjectType(MathObjectType::AndExpression, "AndExpression")); +TEST(AndExprTests, getTypeTest) { + EXPECT_EQ(andExpr(Boolean(), Boolean())->getType(), MathObjectType(MathObjectType::AndExpr, "AndExpr")); } diff --git a/tests/src/expressions/polynomial/MinMaxExpressionTests.cpp b/tests/src/expressions/polynomial/MinMaxExprTests.cpp similarity index 71% rename from tests/src/expressions/polynomial/MinMaxExpressionTests.cpp rename to tests/src/expressions/polynomial/MinMaxExprTests.cpp index d0bcc9f7d..068985189 100644 --- a/tests/src/expressions/polynomial/MinMaxExpressionTests.cpp +++ b/tests/src/expressions/polynomial/MinMaxExprTests.cpp @@ -6,6 +6,6 @@ using namespace fintamath; -TEST(MinMaxExpressionTests, getTypeTest) { - EXPECT_EQ(minExpr(Integer(0), Integer(0))->getType(), MathObjectType(MathObjectType::MinMaxExpression, "MinMaxExpression")); +TEST(MinMaxExprTests, getTypeTest) { + EXPECT_EQ(minExpr(Integer(0), Integer(0))->getType(), MathObjectType(MathObjectType::MinMaxExpr, "MinMaxExpr")); } diff --git a/tests/src/expressions/polynomial/MulExpressionTests.cpp b/tests/src/expressions/polynomial/MulExprTests.cpp similarity index 73% rename from tests/src/expressions/polynomial/MulExpressionTests.cpp rename to tests/src/expressions/polynomial/MulExprTests.cpp index 5d7f04613..157b2aaf1 100644 --- a/tests/src/expressions/polynomial/MulExpressionTests.cpp +++ b/tests/src/expressions/polynomial/MulExprTests.cpp @@ -6,6 +6,6 @@ using namespace fintamath; -TEST(MulExpressionTests, getTypeTest) { - EXPECT_EQ(mulExpr(Integer(0), Integer(0))->getType(), MathObjectType(MathObjectType::MulExpression, "MulExpression")); +TEST(MulExprTests, getTypeTest) { + EXPECT_EQ(mulExpr(Integer(0), Integer(0))->getType(), MathObjectType(MathObjectType::MulExpr, "MulExpr")); } diff --git a/tests/src/expressions/polynomial/OrExpressionTests.cpp b/tests/src/expressions/polynomial/OrExprTests.cpp similarity index 74% rename from tests/src/expressions/polynomial/OrExpressionTests.cpp rename to tests/src/expressions/polynomial/OrExprTests.cpp index 38fcb391f..ebb861417 100644 --- a/tests/src/expressions/polynomial/OrExpressionTests.cpp +++ b/tests/src/expressions/polynomial/OrExprTests.cpp @@ -6,6 +6,6 @@ using namespace fintamath; -TEST(OrExpressionTests, getTypeTest) { - EXPECT_EQ(orExpr(Boolean(), Boolean())->getType(), MathObjectType(MathObjectType::OrExpression, "OrExpression")); +TEST(OrExprTests, getTypeTest) { + EXPECT_EQ(orExpr(Boolean(), Boolean())->getType(), MathObjectType(MathObjectType::OrExpr, "OrExpr")); } diff --git a/tests/src/expressions/unary/AbsExpressionTests.cpp b/tests/src/expressions/unary/AbsExprTests.cpp similarity index 69% rename from tests/src/expressions/unary/AbsExpressionTests.cpp rename to tests/src/expressions/unary/AbsExprTests.cpp index 4345bcb01..3e062dae7 100644 --- a/tests/src/expressions/unary/AbsExpressionTests.cpp +++ b/tests/src/expressions/unary/AbsExprTests.cpp @@ -5,6 +5,6 @@ using namespace fintamath; -TEST(AbsExpressionTests, getTypeTest) { - EXPECT_EQ(absExpr(Integer(0).clone())->getType(), MathObjectType(MathObjectType::AbsExpression, "AbsExpression")); +TEST(AbsExprTests, getTypeTest) { + EXPECT_EQ(absExpr(Integer(0).clone())->getType(), MathObjectType(MathObjectType::AbsExpr, "AbsExpr")); } diff --git a/tests/src/expressions/unary/RoundExpressionTests.cpp b/tests/src/expressions/unary/FloorCeilExprTests.cpp similarity index 65% rename from tests/src/expressions/unary/RoundExpressionTests.cpp rename to tests/src/expressions/unary/FloorCeilExprTests.cpp index 1300992ed..093bde36f 100644 --- a/tests/src/expressions/unary/RoundExpressionTests.cpp +++ b/tests/src/expressions/unary/FloorCeilExprTests.cpp @@ -5,6 +5,6 @@ using namespace fintamath; -TEST(FloorCeilExpressionTests, getTypeTest) { - EXPECT_EQ(floorExpr(Integer(0).clone())->getType(), MathObjectType(MathObjectType::FloorCeilExpression, "FloorCeilExpression")); +TEST(FloorCeilExprTests, getTypeTest) { + EXPECT_EQ(floorExpr(Integer(0).clone())->getType(), MathObjectType(MathObjectType::FloorCeilExpr, "FloorCeilExpr")); } diff --git a/tests/src/expressions/unary/HyperbExpressionTests.cpp b/tests/src/expressions/unary/HyperbExprTests.cpp similarity index 72% rename from tests/src/expressions/unary/HyperbExpressionTests.cpp rename to tests/src/expressions/unary/HyperbExprTests.cpp index 0c81e2995..26cdc4c90 100644 --- a/tests/src/expressions/unary/HyperbExpressionTests.cpp +++ b/tests/src/expressions/unary/HyperbExprTests.cpp @@ -6,6 +6,6 @@ using namespace fintamath; -TEST(HyperbExpressionTests, getTypeTest) { - EXPECT_EQ(sinhExpr(Integer(0).clone())->getType(), MathObjectType(MathObjectType::HyperbExpression, "HyperbExpression")); +TEST(HyperbExprTests, getTypeTest) { + EXPECT_EQ(sinhExpr(Integer(0).clone())->getType(), MathObjectType(MathObjectType::HyperbExpr, "HyperbExpr")); } diff --git a/tests/src/expressions/unary/InvHyperbExpressionTests.cpp b/tests/src/expressions/unary/InvHyperbExprTests.cpp similarity index 70% rename from tests/src/expressions/unary/InvHyperbExpressionTests.cpp rename to tests/src/expressions/unary/InvHyperbExprTests.cpp index e1533984d..de39b1f80 100644 --- a/tests/src/expressions/unary/InvHyperbExpressionTests.cpp +++ b/tests/src/expressions/unary/InvHyperbExprTests.cpp @@ -6,6 +6,6 @@ using namespace fintamath; -TEST(InvHyperbExpressionTests, getTypeTest) { - EXPECT_EQ(asinhExpr(Integer(0).clone())->getType(), MathObjectType(MathObjectType::InvHyperbExpression, "InvHyperbExpression")); +TEST(InvHyperbExprTests, getTypeTest) { + EXPECT_EQ(asinhExpr(Integer(0).clone())->getType(), MathObjectType(MathObjectType::InvHyperbExpr, "InvHyperbExpr")); } diff --git a/tests/src/expressions/unary/InvTrigExpressionTests.cpp b/tests/src/expressions/unary/InvTrigExprTests.cpp similarity index 72% rename from tests/src/expressions/unary/InvTrigExpressionTests.cpp rename to tests/src/expressions/unary/InvTrigExprTests.cpp index ae300254c..85ce98d32 100644 --- a/tests/src/expressions/unary/InvTrigExpressionTests.cpp +++ b/tests/src/expressions/unary/InvTrigExprTests.cpp @@ -6,6 +6,6 @@ using namespace fintamath; -TEST(InvTrigExpressionTests, getTypeTest) { - EXPECT_EQ(asinExpr(Integer(0).clone())->getType(), MathObjectType(MathObjectType::InvTrigExpression, "InvTrigExpression")); +TEST(InvTrigExprTests, getTypeTest) { + EXPECT_EQ(asinExpr(Integer(0).clone())->getType(), MathObjectType(MathObjectType::InvTrigExpr, "InvTrigExpr")); } diff --git a/tests/src/expressions/unary/NotExpressionTests.cpp b/tests/src/expressions/unary/NotExprTests.cpp similarity index 76% rename from tests/src/expressions/unary/NotExpressionTests.cpp rename to tests/src/expressions/unary/NotExprTests.cpp index 9d91b7f9c..755c2045a 100644 --- a/tests/src/expressions/unary/NotExpressionTests.cpp +++ b/tests/src/expressions/unary/NotExprTests.cpp @@ -6,6 +6,6 @@ using namespace fintamath; -TEST(NotExpressionTests, getTypeTest) { - EXPECT_EQ(notExpr(Boolean())->getType(), MathObjectType(MathObjectType::NotExpression, "NotExpression")); +TEST(NotExprTests, getTypeTest) { + EXPECT_EQ(notExpr(Boolean())->getType(), MathObjectType(MathObjectType::NotExpr, "NotExpr")); } diff --git a/tests/src/expressions/unary/SignExpressionTests.cpp b/tests/src/expressions/unary/SignExprTests.cpp similarity index 68% rename from tests/src/expressions/unary/SignExpressionTests.cpp rename to tests/src/expressions/unary/SignExprTests.cpp index 7bf56a60f..3e867e7aa 100644 --- a/tests/src/expressions/unary/SignExpressionTests.cpp +++ b/tests/src/expressions/unary/SignExprTests.cpp @@ -5,6 +5,6 @@ using namespace fintamath; -TEST(SignExpressionTests, getTypeTest) { - EXPECT_EQ(signExpr(Integer(0).clone())->getType(), MathObjectType(MathObjectType::SignExpression, "SignExpression")); +TEST(SignExprTests, getTypeTest) { + EXPECT_EQ(signExpr(Integer(0).clone())->getType(), MathObjectType(MathObjectType::SignExpr, "SignExpr")); } diff --git a/tests/src/expressions/unary/TrigExpressionTests.cpp b/tests/src/expressions/unary/TrigExprTests.cpp similarity index 74% rename from tests/src/expressions/unary/TrigExpressionTests.cpp rename to tests/src/expressions/unary/TrigExprTests.cpp index 45c992beb..bf7502857 100644 --- a/tests/src/expressions/unary/TrigExpressionTests.cpp +++ b/tests/src/expressions/unary/TrigExprTests.cpp @@ -6,6 +6,6 @@ using namespace fintamath; -TEST(TrigExpressionTests, getTypeTest) { - EXPECT_EQ(sinExpr(Integer(0).clone())->getType(), MathObjectType(MathObjectType::TrigExpression, "TrigExpression")); +TEST(TrigExprTests, getTypeTest) { + EXPECT_EQ(sinExpr(Integer(0).clone())->getType(), MathObjectType(MathObjectType::TrigExpr, "TrigExpr")); }