protected final void compute() { int size = geolist.size(); boolean regok = true; double a, b; if (!geolist.isDefined() || (size < 2)) { // 24.04.08: 2 geofunction.setUndefined(); return; } else { RegressionMath regMath = kernel.getRegressionMath(); regok = regMath.doLog(geolist); if (regok) { a = regMath.getP1(); b = regMath.getP2(); MyDouble A = new MyDouble(kernel, a); MyDouble B = new MyDouble(kernel, b); FunctionVariable X = new FunctionVariable(kernel); ExpressionValue expr = new ExpressionNode(kernel, X, ExpressionNode.LOG, X); expr = new ExpressionNode(kernel, B, ExpressionNode.MULTIPLY, expr); ExpressionNode node = new ExpressionNode(kernel, A, ExpressionNode.PLUS, expr); Function f = new Function(node, X); geofunction.setFunction(f); geofunction.setDefined(true); } else { geofunction.setUndefined(); return; } // if error in regression } // if error in parameters } // compute()
public AlgoFitLog(Construction cons, String label, GeoList geolist) { this(cons, geolist); geofunction.setLabel(label); } // Constructor