@Override public void visit(MathFunctionCall mathFunctionCall) { code.append(mathFunctionCall.getFunction().toString()); code.append('('); mathFunctionCall.getOperand().accept(this); code.append(')'); }
@Override public void visit(MathFunctionCall node) { node.getOperand().accept(this); Expression previousExpr = resultExpr; resultExpr = new MathFunctionCall(previousExpr, node.getFunction()); if ((node.getFunction() == MathFunction.SQRT) && (previousExpr instanceof FloatConstant)) { FloatConstant operand = (FloatConstant) previousExpr; resultExpr = new FloatConstant(Math.sqrt(operand.getValue())); } else if ((node.getFunction() == MathFunction.ABS) && (previousExpr instanceof MathFunctionCall)) { /* remove abs() around sqrts, as they are always positive */ MathFunctionCall insideFunc = (MathFunctionCall) previousExpr; if (insideFunc.getFunction() == MathFunction.ABS || insideFunc.getFunction() == MathFunction.SQRT) resultExpr = previousExpr; } else if ((node.getFunction() == MathFunction.SQRT) && ((!(previousExpr instanceof MathFunctionCall)) || (((MathFunctionCall) previousExpr).getFunction() != MathFunction.ABS))) { /* insert in every sqrt() an abs() */ resultExpr = new MathFunctionCall(new MathFunctionCall(previousExpr, MathFunction.ABS), MathFunction.SQRT); } }
@Override public void visit(MathFunctionCall mathFunctionCall) { String funcName; switch (mathFunctionCall.getFunction()) { case ABS: funcName = "fabs"; break; case SQRT: funcName = "sqrtf"; break; default: funcName = mathFunctionCall.getFunction().toString().toLowerCase(); } code.append(funcName); code.append('('); mathFunctionCall.getOperand().accept(this); code.append(')'); }
@Override public void visit(MathFunctionCall mathFunctionCall) { code.append(mathFunctionCall.getFunction().toString()); code.append('('); mathFunctionCall.getOperand().accept(this); code.append(')'); }
@Override public void visit(MathFunctionCall mathFunctionCall) { code.append(mathFunctionCall.getFunction().toString()); code.append('('); mathFunctionCall.getOperand().accept(this); code.append(')'); }
@Override public void visit(MathFunctionCall mathFunctionCall) { code.append(mathFunctionCall.getFunction().toString()); code.append('('); mathFunctionCall.getOperand().accept(this); code.append(')'); }
@Override public void visit(MathFunctionCall node) { String opName = node.getFunction().name().toLowerCase(); switch (node.getFunction()) { case CEIL: opName = "ceiling"; break; case FACT: opName = ""; result.append("("); node.getOperand().accept(this); result.append("!)"); return; } handleUnary(node, opName); }
@Override public void visit(MathFunctionCall node) { createExtCalculationFromUnaryOperation(node, transformFunction(node.getFunction())); }
node.accept(this); double operandValue = resultValue; switch (node.getFunction()) { case ABS: resultValue = Math.abs(operandValue);
@Override public void visit(MathFunctionCall node) { node.getOperand().accept(this); switch (node.getFunction()) { case ABS: result = Math.abs(result);
@Override public void visit(MathFunctionCall mathFunctionCall) { String funcName = "(double) Math." + mathFunctionCall.getFunction().toString().toLowerCase(); if (mathFunctionCall.getFunction() == MathFunction.FACT) { funcName = "fact"; implementFactorial = true; } append(funcName); append('('); mathFunctionCall.getOperand().accept(this); append(')'); }
@Override public void visit(MathFunctionCall node) { result = null; node.getOperand().accept(this); if (result != null) result = new MathFunctionCall(result, node.getFunction()); }
@Override public void visit(MathFunctionCall node) { node.getOperand().accept(this); resultExpr = new MathFunctionCall(resultExpr, node.getFunction()); }
node.getOperand().accept(this); Expression operandExpr = resultExpr; resultExpr = new MathFunctionCall(operandExpr, node.getFunction()); if ((node.getFunction() == MathFunction.SQRT) && isConstant(operandExpr)) { FloatConstant operand = (FloatConstant) operandExpr; setGraphModified(); } else if ((node.getFunction() == MathFunction.ABS) && (DFGNodeTypeGetter.getTypeOfDFGNode(operandExpr) == DFGNodeType.MathFunctionCall)) { if (insideFunc.getFunction() == MathFunction.ABS || insideFunc.getFunction() == MathFunction.SQRT) { resultExpr = operandExpr; setGraphModified(); }*/ else if ((node.getFunction() == MathFunction.ABS) && isConstant(operandExpr)) { FloatConstant operand = (FloatConstant) operandExpr;
switch (node.getFunction()) { case ABS: break; default: result.bladeExpressions[0] = new MathFunctionCall(expressions.get(node.getOperand()).bladeExpressions[0], node.getFunction()); System.err.println("Warning: " + node.getFunction().toString() + " is only implemented for scalar inputs!"); break;
@Override public void visit(MathFunctionCall node) { //TODO Schluckt nachkommende werte 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.getOperand().accept(this); nx = new MathFunctionCall(nx, node.getFunction()); } //nx = node; }
@Override public void visit(MathFunctionCall mathFunctionCall) { addNode(mathFunctionCall, mathFunctionCall.getFunction().toString()); mathFunctionCall.getOperand().accept(this); addEdge(mathFunctionCall.getOperand(), mathFunctionCall); }
@Override public void visit(MathFunctionCall node) { System.out.println("MyMathFuncVisit"); mathfunctionHack = true; node.getOperand().accept(this); mathfunctionHack = false; UnaryOperation newOp; switch (node.getFunction()) { case SQRT: newOp = new SquareRoot(); break; case ABS: newOp = new Absolut(); break; case ACOS: newOp = new ArcCos(); break; case COS: newOp = new Cos(); break; case SIN: newOp = new Sin(); break; default: throw new UnsupportedOperationException("Math function " + node.toString() + " not supported."); } newOp.setData(toappend); toappend = newOp; addToGraph(toappend); }
@Override public void visit(MathFunctionCall node) { node.getOperand().accept(this); switch (node.getFunction()) { case ABS: result = new RealInterval(Math.min(result.lo(),result.hi()),Math.max(result.lo(),result.hi()));
if ((leftFunc.getFunction() == MathFunction.ABS) && (rightFunc.getFunction() == MathFunction.ABS)) { resultExpr = new MathFunctionCall(new Multiplication(rightFunc.getOperand(), leftFunc.getOperand()), MathFunction.ABS); if ((leftFunc.getFunction() == MathFunction.SQRT) && (rightFunc.getFunction() == MathFunction.SQRT)) { resultExpr = new MathFunctionCall(new Multiplication(rightFunc.getOperand(), leftFunc.getOperand()), MathFunction.SQRT);