mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-21 23:00:45 +01:00
[poincare] Discard BottomUpComputation of ReductionTarget because it is
never used
This commit is contained in:
@@ -104,8 +104,7 @@ public:
|
||||
|
||||
/* Properties */
|
||||
enum class ReductionTarget {
|
||||
BottomUpComputation = 0,
|
||||
TopDownComputation = 1,
|
||||
TopDownComputation = 0,
|
||||
User
|
||||
};
|
||||
enum class Sign {
|
||||
|
||||
@@ -134,7 +134,7 @@ Expression Logarithm::shallowReduce(Context & context, Preferences::ComplexForma
|
||||
* - the reduction is being BottomUp. In this case, we do not yet have any
|
||||
* information on the parent which could later be a power of b.
|
||||
*/
|
||||
bool letLogAtRoot = target == ExpressionNode::ReductionTarget::BottomUpComputation || parentIsAPowerOfSameBase();
|
||||
bool letLogAtRoot = parentIsAPowerOfSameBase();
|
||||
// log(x^y, b)->y*log(x, b) if x>0
|
||||
if (!letLogAtRoot && c.type() == ExpressionNode::Type::Power && c.childAtIndex(0).sign(&context) == ExpressionNode::Sign::Positive) {
|
||||
Power p = static_cast<Power &>(c);
|
||||
|
||||
@@ -453,7 +453,7 @@ Expression Multiplication::privateShallowReduce(Context & context, Preferences::
|
||||
* Note: This step must be done after Step 4, otherwise we wouldn't be able to
|
||||
* reduce expressions such as (x+y)^(-1)*(x+y)(a+b). */
|
||||
Expression p = parent();
|
||||
if (target != ExpressionNode::ReductionTarget::BottomUpComputation && shouldExpand && (p.isUninitialized() || p.type() != ExpressionNode::Type::Multiplication)) {
|
||||
if (shouldExpand && (p.isUninitialized() || p.type() != ExpressionNode::Type::Multiplication)) {
|
||||
for (int i = 0; i < numberOfChildren(); i++) {
|
||||
if (childAtIndex(i).type() == ExpressionNode::Type::Addition) {
|
||||
return distributeOnOperandAtIndex(i, context, complexFormat, angleUnit, target);
|
||||
|
||||
@@ -394,14 +394,10 @@ Expression Power::shallowReduce(Context & context, Preferences::ComplexFormat co
|
||||
}
|
||||
}
|
||||
|
||||
/* We do not apply some rules to a^b if:
|
||||
* - the parent node is a logarithm of same base a. In this case there is a
|
||||
* simplication of form ln(e^(3^(1/2))->3^(1/2).
|
||||
* - the reduction is being BottomUpComputation. In this case, we do not yet have any
|
||||
* information on the parent which could later be a logarithm of the same
|
||||
* base.
|
||||
/* We do not apply some rules to a^b if the parent node is a logarithm of same
|
||||
* base a. In this case there is a simplication of form ln(e^(3^(1/2))->3^(1/2).
|
||||
*/
|
||||
bool letPowerAtRoot = target == ExpressionNode::ReductionTarget::BottomUpComputation || parentIsALogarithmOfSameBase();
|
||||
bool letPowerAtRoot = parentIsALogarithmOfSameBase();
|
||||
|
||||
/* Step 2: we now bubble up ComplexCartesian, we handle different cases:
|
||||
* At least, one child is a ComplexCartesian and the other is either a
|
||||
|
||||
@@ -303,7 +303,7 @@ Expression Trigonometry::shallowReduceInverseFunction(Expression & e, Context& c
|
||||
* information on the parent which could later be a cosine, a sine or a tangent.
|
||||
*/
|
||||
Expression p = e.parent();
|
||||
bool letArcFunctionAtRoot = target == ExpressionNode::ReductionTarget::BottomUpComputation || (!p.isUninitialized() && isDirectTrigonometryFunction(p));
|
||||
bool letArcFunctionAtRoot = !p.isUninitialized() && isDirectTrigonometryFunction(p);
|
||||
/* Step 5. Handle opposite argument: arccos(-x) = Pi-arcos(x),
|
||||
* arcsin(-x) = -arcsin(x), arctan(-x)= -arctan(x) *
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user