@Override public void visit(Exponentiation exponentiation) { code.append("Math.pow("); addChild(exponentiation, exponentiation.getLeft()); code.append(','); addChild(exponentiation, exponentiation.getRight()); code.append(")"); }
@Override public void visit(Exponentiation exponentiation) { if (isSquare(exponentiation)) { Multiplication m = new Multiplication(exponentiation.getLeft(), exponentiation.getLeft()); m.accept(this); } else { code.append("pow("); exponentiation.getLeft().accept(this); code.append(','); exponentiation.getRight().accept(this); code.append(')'); } }
@Override public void visit(Exponentiation exponentiation) { exponentiation.getLeft().accept(this); code.append("^{"); exponentiation.getRight().accept(this); code.append('}'); }
@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 void visit(Exponentiation node) { if (node.getRight() instanceof FloatConstant) { double constant = ((FloatConstant) node.getRight()).getValue(); int integer = (int) Math.round(constant); if (integer>0 && integer<=3) if (Math.abs(constant-integer) < 10E-7) { //Unfold //TODO chs set a new temporary variable, if left is of big height switch (integer) { case 1: result = node.getLeft(); return; case 2: result = new Multiplication(node.getLeft(), node.getLeft()); return; case 3: result = new Multiplication(new Multiplication(node.getLeft(),node.getLeft()), node.getLeft()); return; } } } super.visit(node); }
@Override public void visit(Exponentiation node) { handleBinary(node.getLeft(), node.getRight()); }
@Override public void visit(Exponentiation node) { node.getLeft().accept(this); double leftValue = resultValue; node.getRight().accept(this); resultValue = Math.pow(leftValue,resultValue); }
@Override public void visit(Exponentiation node) { node.getLeft().accept(this); Double left = result; node.getRight().accept(this); result = Math.pow(left,result); }
@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); } }
/** * Converts this node to a human readable string. * * @return The string "<code>left ^ right</code>" where left and right are the two operands converted to strings * using their toString methods. */ public String toString() { return bracketComposite(getLeft()) + " ^ " + bracketComposite(getRight()); } }
@Override public void visit(Exponentiation node) { node.getLeft().accept(this); node.getRight().accept(this); }
public void visit(Exponentiation node) { // just do nothing, because only MulitvectorComponent is important node.getLeft().accept(this); node.getRight().accept(this); }
@Override public void visit(Exponentiation exponentiation) { if (isSquare(exponentiation)) { Multiplication m = new Multiplication(exponentiation.getLeft(), exponentiation.getLeft()); m.accept(this); } else { append("Math.pow("); exponentiation.getLeft().accept(this); append(','); exponentiation.getRight().accept(this); append(')'); } }
@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()); }
@Override public void visit(Exponentiation node) { node.getLeft().accept(this); RealInterval left = result; node.getRight().accept(this); double hi = result.hi(); if (Math.abs(hi-result.lo()) < 0.001 && Math.abs(hi-((int) hi)) < 0.001 && hi>=0) { result = new RealInterval(1); for (int i=0;i<((int) hi);i++) result = IAMath.mul(result, left); } else result = IAMath.power(left, result); }
@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); } } }
@Override public void visit(Exponentiation node) { node.getLeft().accept(this); Expression left = resultExpr; node.getRight().accept(this);
@Override public void visit(Exponentiation node) { node.getLeft().accept(this); Expression dLeft = result; node.getRight().accept(this); node.getRight().copy(), new Exponentiation( node.getLeft().copy(), new Subtraction(node.getRight().copy(), new FloatConstant(1)) Expression dv = result; result = new Multiplication( new Multiplication(dv, new MathFunctionCall(node.getLeft().copy(), MathFunction.LOG)), node.copy() ); Expression dv = result; result = new Multiplication(new Addition( new Multiplication(dv, new MathFunctionCall(node.getLeft().copy(), MathFunction.LOG)), new Division(new Multiplication(node.getRight().copy(), dLeft), node.getLeft().copy()) ), node.copy());