mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
[poincare] Matrix exact reducing when mapping or undefined
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
#ifndef POINCARE_SIMPLIFICATION_HELPER_H
|
||||
#define POINCARE_SIMPLIFICATION_HELPER_H
|
||||
|
||||
#if MATRIX_EXACT_REDUCING
|
||||
|
||||
#include <poincare/expression.h>
|
||||
|
||||
namespace Poincare {
|
||||
@@ -14,5 +12,3 @@ namespace SimplificationHelper {
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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) &&
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
#include <poincare/simplification_helper.h>
|
||||
#include <poincare/undefined.h>
|
||||
|
||||
#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
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user