diff --git a/poincare/include/poincare/simplification_helper.h b/poincare/include/poincare/simplification_helper.h index 8b1907d73..aa35b20df 100644 --- a/poincare/include/poincare/simplification_helper.h +++ b/poincare/include/poincare/simplification_helper.h @@ -1,8 +1,6 @@ #ifndef POINCARE_SIMPLIFICATION_HELPER_H #define POINCARE_SIMPLIFICATION_HELPER_H -#if MATRIX_EXACT_REDUCING - #include namespace Poincare { @@ -14,5 +12,3 @@ namespace SimplificationHelper { } #endif - -#endif diff --git a/poincare/src/absolute_value.cpp b/poincare/src/absolute_value.cpp index ce114dc9a..48073d873 100644 --- a/poincare/src/absolute_value.cpp +++ b/poincare/src/absolute_value.cpp @@ -41,14 +41,10 @@ Expression AbsoluteValue::shallowReduce(Context & context, Preferences::ComplexF if (e.isUndefined()) { return e; } -#if MATRIX_EXACT_REDUCING -#if 0 - if (c->type() == Type::Matrix) { - return SimplificationHelper::Map(this, context, angleUnit); - } -#endif -#endif Expression c = childAtIndex(0); + if (c.type() == ExpressionNode::Type::Matrix) { + return SimplificationHelper::Map(*this, context, angleUnit); + } if (c.isReal(context)) { float app = c.node()->approximate(float(), context, complexFormat, angleUnit).toScalar(); if (!std::isnan(app) && diff --git a/poincare/src/arc_cosine.cpp b/poincare/src/arc_cosine.cpp index 887bf0ef6..432d39e70 100644 --- a/poincare/src/arc_cosine.cpp +++ b/poincare/src/arc_cosine.cpp @@ -56,11 +56,9 @@ Expression ArcCosine::shallowReduce(Context & context, Preferences::ComplexForma return e; } } -#if MATRIX_EXACT_REDUCING - if (childAtIndex(0).type() == Type::Matrix) { + if (childAtIndex(0).type() == ExpressionNode::Type::Matrix) { return SimplificationHelper::Map(*this, context, angleUnit); } -#endif return Trigonometry::shallowReduceInverseFunction(*this, context, complexFormat, angleUnit, target); } diff --git a/poincare/src/arc_sine.cpp b/poincare/src/arc_sine.cpp index 7a043d7f4..bf4941b07 100644 --- a/poincare/src/arc_sine.cpp +++ b/poincare/src/arc_sine.cpp @@ -56,11 +56,9 @@ Expression ArcSine::shallowReduce(Context & context, Preferences::ComplexFormat return e; } } -#if MATRIX_EXACT_REDUCING - if (childAtIndex(0).type() == Type::Matrix) { + if (childAtIndex(0).type() == ExpressionNode::Type::Matrix) { return SimplificationHelper::Map(*this, context, angleUnit); } -#endif return Trigonometry::shallowReduceInverseFunction(*this, context, complexFormat, angleUnit, target); } diff --git a/poincare/src/arc_tangent.cpp b/poincare/src/arc_tangent.cpp index a107b1b72..9c35e07c4 100644 --- a/poincare/src/arc_tangent.cpp +++ b/poincare/src/arc_tangent.cpp @@ -56,11 +56,9 @@ Expression ArcTangent::shallowReduce(Context & context, Preferences::ComplexForm return e; } } -#if MATRIX_EXACT_REDUCING if (childAtIndex(0).type() == ExpressionNode::Type::Matrix) { return SimplificationHelper::Map(*this, context, angleUnit); } -#endif return Trigonometry::shallowReduceInverseFunction(*this, context, complexFormat, angleUnit, target); } diff --git a/poincare/src/simplification_helper.cpp b/poincare/src/simplification_helper.cpp index 4b3220212..1d062b6b0 100644 --- a/poincare/src/simplification_helper.cpp +++ b/poincare/src/simplification_helper.cpp @@ -1,10 +1,13 @@ #include +#include -#if MATRIX_EXACT_REDUCING namespace Poincare { -// TODO Use clones -Expression SimplificationHelper::Map(const Expression & e, Context & context, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit) { +//TODO: , Preferences::ComplexFormat complexFormat? +Expression SimplificationHelper::Map(const Expression & e, Context & context, Preferences::AngleUnit angleUnit) { + //TODO LEA +#if 0 + // TODO Use clones assert(e->numberOfChildren() == 1 && e->childAtIndex(0)->type() == ExpressionNode::Type::Matrix); Expression c = e.childAtIndex(0); Matrix matrix = Matrix::Builder(); @@ -15,7 +18,8 @@ Expression SimplificationHelper::Map(const Expression & e, Context & context, Pr } replaceWithInPlace(matrix); return matrix.shallowReduce(context, complexFormat, angleUnit); +#endif + return Undefined::Builder(); } } -#endif diff --git a/poincare/src/tangent.cpp b/poincare/src/tangent.cpp index e1d339026..9c6b6186b 100644 --- a/poincare/src/tangent.cpp +++ b/poincare/src/tangent.cpp @@ -45,12 +45,12 @@ Expression Tangent::shallowReduce(Context & context, Preferences::ComplexFormat return e; } } -#if MATRIX_EXACT_REDUCING + Expression op = childAtIndex(0); if (op.type() == ExpressionNode::Type::Matrix) { return SimplificationHelper::Map(*this, context, angleUnit); } -#endif + Expression newExpression = Trigonometry::shallowReduceDirectFunction(*this, context, complexFormat, angleUnit, target); if (newExpression.type() == ExpressionNode::Type::Tangent) { Sine s = Sine::Builder(newExpression.childAtIndex(0).clone());