mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-21 14:50:44 +01:00
[poincare] Constant: i->ComplexCartesian(0,1) only if the reduction
target is the user
This commit is contained in:
@@ -58,7 +58,7 @@ public:
|
||||
bool isIComplex() const { return node()->isIComplex(); }
|
||||
|
||||
// Simplification
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit);
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit, ExpressionNode::ReductionTarget target);
|
||||
|
||||
private:
|
||||
ConstantNode * node() const { return static_cast<ConstantNode *>(Expression::node()); }
|
||||
|
||||
@@ -46,15 +46,15 @@ Evaluation<T> ConstantNode::templatedApproximate(Context& context, Preferences::
|
||||
}
|
||||
|
||||
Expression ConstantNode::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, ReductionTarget target) {
|
||||
return Constant(this).shallowReduce(context, angleUnit);
|
||||
return Constant(this).shallowReduce(context, angleUnit, target);
|
||||
}
|
||||
|
||||
Constant::Constant(char name) : SymbolAbstract(TreePool::sharedPool()->createTreeNode<ConstantNode>(SymbolAbstract::AlignedNodeSize(1, sizeof(ConstantNode)))) {
|
||||
node()->setName(&name, 1);
|
||||
}
|
||||
|
||||
Expression Constant::shallowReduce(Context & context, Preferences::AngleUnit angleUnit) {
|
||||
if (isIComplex()) {
|
||||
Expression Constant::shallowReduce(Context & context, Preferences::AngleUnit angleUnit, ExpressionNode::ReductionTarget target) {
|
||||
if (target == ExpressionNode::ReductionTarget::User && isIComplex()) {
|
||||
ComplexCartesian c = ComplexCartesian::Builder(Rational(0), Rational(1));
|
||||
replaceWithInPlace(c);
|
||||
return c;
|
||||
|
||||
Reference in New Issue
Block a user