Java Code Examples for org.apache.commons.math3.analysis.differentiation.DerivativeStructure#subtract()
The following examples show how to use
org.apache.commons.math3.analysis.differentiation.DerivativeStructure#subtract() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CircleProblem.java From astor with GNU General Public License v2.0 | 6 votes |
public DerivativeStructure[] value(DerivativeStructure[] params) { final DerivativeStructure cx = params[0]; final DerivativeStructure cy = params[1]; final DerivativeStructure r = params[2]; final DerivativeStructure[] model = new DerivativeStructure[points.size() * 2]; for (int i = 0; i < points.size(); i++) { final Vector2D p = points.get(i); // Find the circle point closest to the observed point // (observed points are points add through the addPoint method above) final DerivativeStructure dX = cx.subtract(p.getX()); final DerivativeStructure dY = cy.subtract(p.getY()); final DerivativeStructure scaling = r.divide(dX.multiply(dX).add(dY.multiply(dY)).sqrt()); final int index = i * 2; model[index] = cx.subtract(scaling.multiply(dX)); model[index + 1] = cy.subtract(scaling.multiply(dY)); } return model; }
Example 2
Source File: CircleProblem.java From astor with GNU General Public License v2.0 | 6 votes |
public DerivativeStructure[] value(DerivativeStructure[] params) { final DerivativeStructure cx = params[0]; final DerivativeStructure cy = params[1]; final DerivativeStructure r = params[2]; final DerivativeStructure[] model = new DerivativeStructure[points.size() * 2]; for (int i = 0; i < points.size(); i++) { final Vector2D p = points.get(i); // Find the circle point closest to the observed point // (observed points are points add through the addPoint method above) final DerivativeStructure dX = cx.subtract(p.getX()); final DerivativeStructure dY = cy.subtract(p.getY()); final DerivativeStructure scaling = r.divide(dX.multiply(dX).add(dY.multiply(dY)).sqrt()); final int index = i * 2; model[index] = cx.subtract(scaling.multiply(dX)); model[index + 1] = cy.subtract(scaling.multiply(dY)); } return model; }
Example 3
Source File: CircleProblem.java From astor with GNU General Public License v2.0 | 6 votes |
public DerivativeStructure[] value(DerivativeStructure[] params) { final DerivativeStructure cx = params[0]; final DerivativeStructure cy = params[1]; final DerivativeStructure r = params[2]; final DerivativeStructure[] model = new DerivativeStructure[points.size() * 2]; for (int i = 0; i < points.size(); i++) { final Vector2D p = points.get(i); // Find the circle point closest to the observed point // (observed points are points add through the addPoint method above) final DerivativeStructure dX = cx.subtract(p.getX()); final DerivativeStructure dY = cy.subtract(p.getY()); final DerivativeStructure scaling = r.divide(dX.multiply(dX).add(dY.multiply(dY)).sqrt()); final int index = i * 2; model[index] = cx.subtract(scaling.multiply(dX)); model[index + 1] = cy.subtract(scaling.multiply(dY)); } return model; }
Example 4
Source File: MinpackTest.java From astor with GNU General Public License v2.0 | 5 votes |
@Override public DerivativeStructure[] value(DerivativeStructure[] variables) { DerivativeStructure[] f = new DerivativeStructure[m]; DerivativeStructure sum = variables[0].getField().getZero().subtract(n + 1); DerivativeStructure prod = variables[0].getField().getOne(); for (int j = 0; j < n; ++j) { sum = sum.add(variables[j]); prod = prod.multiply(variables[j]); } for (int i = 0; i < n; ++i) { f[i] = variables[i].add(sum); } f[n - 1] = prod.subtract(1); return f; }
Example 5
Source File: MinpackTest.java From astor with GNU General Public License v2.0 | 5 votes |
@Override public DerivativeStructure[] value(DerivativeStructure[] variables) { DerivativeStructure[] f = new DerivativeStructure[m]; DerivativeStructure sum = variables[0].getField().getZero().subtract(n + 1); DerivativeStructure prod = variables[0].getField().getOne(); for (int j = 0; j < n; ++j) { sum = sum.add(variables[j]); prod = prod.multiply(variables[j]); } for (int i = 0; i < n; ++i) { f[i] = variables[i].add(sum); } f[n - 1] = prod.subtract(1); return f; }
Example 6
Source File: MinpackTest.java From astor with GNU General Public License v2.0 | 5 votes |
@Override public DerivativeStructure[] value(DerivativeStructure[] variables) { DerivativeStructure[] f = new DerivativeStructure[m]; DerivativeStructure sum = variables[0].getField().getZero().subtract(n + 1); DerivativeStructure prod = variables[0].getField().getOne(); for (int j = 0; j < n; ++j) { sum = sum.add(variables[j]); prod = prod.multiply(variables[j]); } for (int i = 0; i < n; ++i) { f[i] = variables[i].add(sum); } f[n - 1] = prod.subtract(1); return f; }
Example 7
Source File: MinpackTest.java From astor with GNU General Public License v2.0 | 5 votes |
@Override public DerivativeStructure[] value(DerivativeStructure[] variables) { DerivativeStructure[] f = new DerivativeStructure[m]; DerivativeStructure sum = variables[0].getField().getZero().subtract(n + 1); DerivativeStructure prod = variables[0].getField().getOne(); for (int j = 0; j < n; ++j) { sum = sum.add(variables[j]); prod = prod.multiply(variables[j]); } for (int i = 0; i < n; ++i) { f[i] = variables[i].add(sum); } f[n - 1] = prod.subtract(1); return f; }
Example 8
Source File: CircleScalar.java From astor with GNU General Public License v2.0 | 4 votes |
private DerivativeStructure distance(Vector2D point, DerivativeStructure cx, DerivativeStructure cy) { DerivativeStructure dx = cx.subtract(point.getX()); DerivativeStructure dy = cy.subtract(point.getY()); return dx.multiply(dx).add(dy.multiply(dy)).sqrt(); }
Example 9
Source File: CircleVectorial.java From astor with GNU General Public License v2.0 | 4 votes |
private DerivativeStructure distance(Vector2D point, DerivativeStructure cx, DerivativeStructure cy) { DerivativeStructure dx = cx.subtract(point.getX()); DerivativeStructure dy = cy.subtract(point.getY()); return dx.multiply(dx).add(dy.multiply(dy)).sqrt(); }
Example 10
Source File: CircleScalar.java From astor with GNU General Public License v2.0 | 4 votes |
private DerivativeStructure distance(Vector2D point, DerivativeStructure cx, DerivativeStructure cy) { DerivativeStructure dx = cx.subtract(point.getX()); DerivativeStructure dy = cy.subtract(point.getY()); return dx.multiply(dx).add(dy.multiply(dy)).sqrt(); }
Example 11
Source File: XMinus5Function.java From astor with GNU General Public License v2.0 | 4 votes |
public DerivativeStructure value(DerivativeStructure t) { return t.subtract(5); }
Example 12
Source File: XMinus5Function.java From astor with GNU General Public License v2.0 | 4 votes |
public DerivativeStructure value(DerivativeStructure t) { return t.subtract(5); }
Example 13
Source File: CircleScalar.java From astor with GNU General Public License v2.0 | 4 votes |
private DerivativeStructure distance(Vector2D point, DerivativeStructure cx, DerivativeStructure cy) { DerivativeStructure dx = cx.subtract(point.getX()); DerivativeStructure dy = cy.subtract(point.getY()); return dx.multiply(dx).add(dy.multiply(dy)).sqrt(); }
Example 14
Source File: XMinus5Function.java From astor with GNU General Public License v2.0 | 4 votes |
public DerivativeStructure value(DerivativeStructure t) { return t.subtract(5); }
Example 15
Source File: CircleVectorial.java From astor with GNU General Public License v2.0 | 4 votes |
private DerivativeStructure distance(Vector2D point, DerivativeStructure cx, DerivativeStructure cy) { DerivativeStructure dx = cx.subtract(point.getX()); DerivativeStructure dy = cy.subtract(point.getY()); return dx.multiply(dx).add(dy.multiply(dy)).sqrt(); }
Example 16
Source File: CircleVectorial.java From astor with GNU General Public License v2.0 | 4 votes |
private DerivativeStructure distance(Vector2D point, DerivativeStructure cx, DerivativeStructure cy) { DerivativeStructure dx = cx.subtract(point.getX()); DerivativeStructure dy = cy.subtract(point.getY()); return dx.multiply(dx).add(dy.multiply(dy)).sqrt(); }
Example 17
Source File: CircleScalar.java From astor with GNU General Public License v2.0 | 4 votes |
private DerivativeStructure distance(Vector2D point, DerivativeStructure cx, DerivativeStructure cy) { DerivativeStructure dx = cx.subtract(point.getX()); DerivativeStructure dy = cy.subtract(point.getY()); return dx.multiply(dx).add(dy.multiply(dy)).sqrt(); }
Example 18
Source File: XMinus5Function.java From astor with GNU General Public License v2.0 | 4 votes |
public DerivativeStructure value(DerivativeStructure t) { return t.subtract(5); }
Example 19
Source File: CircleScalar.java From astor with GNU General Public License v2.0 | 4 votes |
private DerivativeStructure distance(Vector2D point, DerivativeStructure cx, DerivativeStructure cy) { DerivativeStructure dx = cx.subtract(point.getX()); DerivativeStructure dy = cy.subtract(point.getY()); return dx.multiply(dx).add(dy.multiply(dy)).sqrt(); }
Example 20
Source File: CircleVectorial.java From astor with GNU General Public License v2.0 | 4 votes |
private DerivativeStructure distance(Vector2D point, DerivativeStructure cx, DerivativeStructure cy) { DerivativeStructure dx = cx.subtract(point.getX()); DerivativeStructure dy = cy.subtract(point.getY()); return dx.multiply(dx).add(dy.multiply(dy)).sqrt(); }