@Override public void visit(Exponentiation node) { handlebinary(node); resultExpr = new Exponentiation(left, right); }
@Override public void visit(Exponentiation node) { traverseBinary(node); MvExpressions l = expressions.get(node.getLeft()); MvExpressions r = expressions.get(node.getRight()); MvExpressions result = createNewMvExpressions(); result.bladeExpressions[0] = new Exponentiation(l.bladeExpressions[0], r.bladeExpressions[0]); expressions.put(node, result); System.err.println("Warning: Exponentiation is only implemented for scalars!"); }
@Override public Expression visitExponentiation(MaximaParser.ExponentiationContext ctx) { return new Exponentiation(visit(ctx.left), visit(ctx.right)); }
Expression square = new Exponentiation(node.getValue(), new FloatConstant(2));
Expression square = new Exponentiation(node.getValue(), new FloatConstant(2));
@Override public void visit(Exponentiation node) { result = null; node.getLeft().accept(this); Expression leftResult = result; node.getRight().accept(this); Expression rightResult = result; if (leftResult != null || rightResult != null) result = new Exponentiation(leftResult, rightResult); }
@Override public Expression copy() { return new Exponentiation(getLeft().copy(), getRight().copy()); }
node.getRight().accept(this); Expression right = resultExpr; resultExpr = new Exponentiation(left, right); if(left instanceof FloatConstant && right instanceof FloatConstant) { boolean isSqrt = rightc.getValue() - (double) new Double(rightc.getValue()).intValue() == 0.5; if(isSqrt && rightc.getValue() != 0.5) { MathFunctionCall newsqrt = new MathFunctionCall(new Exponentiation( left, new FloatConstant(rightc.getValue() - 0.5f)), MathFunction.SQRT); resultExpr = newsqrt;
node.getRight().accept(this); Expression right = resultExpr; resultExpr = new Exponentiation(left, right); if (isConstant(left) && isConstant(right)) { boolean isSqrt = doubleEquals(rightc.getValue() - (double) new Double(rightc.getValue()).intValue(), 0.5f); if (isSqrt && !doubleEquals(rightc.getValue(), 0.5f)) { MathFunctionCall newsqrt = new MathFunctionCall(new Exponentiation( left, new FloatConstant(rightc.getValue() - 0.5f)), MathFunction.SQRT); resultExpr = newsqrt;
@Override//dfg public void visit(Exponentiation node) { if (isSquare(node) && (node.getLeft() instanceof Variable)) { String varname = null; if(node.getLeft() instanceof MultivectorComponent){ varname = ((MultivectorComponent)node.getLeft()).getName() + ((MultivectorComponent)node.getLeft()).getBladeIndex(); } else varname= ((Variable)node.getLeft()).getName(); if (!myHashmap.containsKey(varname)){ myHashmap.put(varname, ( varname + "_quad")); AddedExponentiationBang = new AssignmentNode(cfg, new Variable(varname+"_quad"), new Multiplication(node.getLeft(), node.getLeft())); //new AssignmentNode(cfg,new Variable(varname+"_quad"),node.copy()); currentAssignment.insertBefore(AddedExponentiationBang); } nx = new Variable(myHashmap.get(varname)); } else // left is novariable or node is no square { node.getLeft().accept(this); Expression lhs =nx; node.getRight().accept(this); Expression rhs =nx; nx = new Exponentiation(lhs, rhs); } }
@Override public void visit(Exponentiation node) { Multiplication nodeMul; if (isSquare(node)) { nodeMul = new Multiplication(node.getLeft(), node.getLeft()); nx = nodeMul; if (opstor.OperationShouldBeReplaced(nodeMul)) { nx = new Variable(opstor.getReplacementID(nodeMul)); } } else { if (opstor.OperationShouldBeReplaced(node)) { nx = new Variable(opstor.getReplacementID(node)); System.out.println("Replacer: Node in Set: ( " + node.toString() + " ) ---> Replacing with " + opstor.getReplacementID(node)); } else { node.getLeft().accept(this); Expression lhs = nx; node.getRight().accept(this); Expression rhs = nx; nx = new Exponentiation(lhs, rhs); } } }
new Subtraction( new FloatConstant(1), new Exponentiation( node.getOperand().copy(), new FloatConstant(2) new Subtraction( new FloatConstant(1), new Exponentiation( node.getOperand().copy(), new FloatConstant(2) new Addition( new FloatConstant(1), new Exponentiation( node.getOperand().copy(), new FloatConstant(2)
new Exponentiation( node.getLeft().copy(), new Subtraction(node.getRight().copy(), new FloatConstant(1))