/** * @param n Normal vector characterizing a surface element * of the microsphere. */ MicrosphereSurfaceElement(double[] n) { normal = new ArrayRealVector(n); }
/** * @param coefficients The coefficients for the linear equation being optimized * @param constantTerm The constant term of the linear equation */ public LinearObjectiveFunction(double[] coefficients, double constantTerm) { this(new ArrayRealVector(coefficients), constantTerm); }
/** * @param coefficients Coefficients for the linear equation being optimized. * @param constantTerm Constant term of the linear equation. */ public LinearObjectiveFunction(double[] coefficients, double constantTerm) { this(new ArrayRealVector(coefficients), constantTerm); }
/** {@inheritDoc} */ @Override public ArrayRealVector copy() { return new ArrayRealVector(this, true); }
/** {@inheritDoc} */ @Override public RealVector append(RealVector v) { try { return new ArrayRealVector(this, (ArrayRealVector) v); } catch (ClassCastException cce) { return new ArrayRealVector(this, v); } }
/** * Construct a vector by appending a vector to this vector. * * @param v Vector to append to this one. * @return a new vector. */ public ArrayRealVector append(ArrayRealVector v) { return new ArrayRealVector(this, v); }
/** {@inheritDoc} */ @Override public RealVector append(double in) { final double[] out = new double[data.length + 1]; System.arraycopy(data, 0, out, 0, data.length); out[data.length] = in; return new ArrayRealVector(out, false); }
/** * Configure the observed data. * * @param newTarget the observed data. * @return this */ public LeastSquaresBuilder target(final double[] newTarget) { return target(new ArrayRealVector(newTarget, false)); }
/** * Configure the initial guess. * * @param newStart the initial guess. * @return this */ public LeastSquaresBuilder start(final double[] newStart) { return start(new ArrayRealVector(newStart, false)); }
/** * Computes the value of the linear equation at the current point. * * @param point Point at which linear equation must be evaluated. * @return the value of the linear equation at the current point. */ public double value(final double[] point) { return value(new ArrayRealVector(point, false)); }
/** {@inheritDoc} */ public RealVector getRowVector(final int row) throws OutOfRangeException { return new ArrayRealVector(getRow(row), false); }
/** {@inheritDoc} */ public RealVector getColumnVector(final int column) throws OutOfRangeException { return new ArrayRealVector(getColumn(column), false); }
/** * Predict the internal state estimation one time step ahead. * * @param u * the control vector * @throws DimensionMismatchException * if the dimension of the control vector does not fit */ public void predict(final double[] u) throws DimensionMismatchException { predict(new ArrayRealVector(u, false)); }
public double[] solveDToD(double[] b) { RealVector bVec = new ArrayRealVector(b, false); return solver.solve(bVec).toArray(); }
/** {@inheritDoc} */ public double getCost() { final ArrayRealVector r = new ArrayRealVector(this.getResiduals()); return FastMath.sqrt(r.dotProduct(r)); }
/** {@inheritDoc} */ @Override public RealVector operate(final RealVector x) { // Dimension check is carried out by ebeDivide return new ArrayRealVector(MathArrays.ebeDivide(x.toArray(), diag.toArray()), false); }
public float[] solveFToF(float[] b) { RealVector bVec = new ArrayRealVector(b.length); for (int i = 0; i < b.length; i++) { bVec.setEntry(i, b[i]); } RealVector resultVec = solver.solve(bVec); float[] result = new float[resultVec.getDimension()]; for (int i = 0; i < result.length; i++) { result[i] = (float) resultVec.getEntry(i); } return result; }
/** * Computes the cost. * * @param residuals Residuals. * @return the cost. * @see #computeResiduals(double[]) * @since 3.1 */ protected double computeCost(double[] residuals) { final ArrayRealVector r = new ArrayRealVector(residuals); return FastMath.sqrt(r.dotProduct(getWeight().operate(r))); }
private double weightedResidual(final PointVectorValuePair pv) { final RealVector v = new ArrayRealVector(pv.getValueRef(), false); final RealVector r = target.subtract(v); return r.dotProduct(weight.operate(r)); } };
/** {@inheritDoc} */ public RealVector getSigma(double covarianceSingularityThreshold) { final RealMatrix cov = this.getCovariances(covarianceSingularityThreshold); final int nC = cov.getColumnDimension(); final RealVector sig = new ArrayRealVector(nC); for (int i = 0; i < nC; ++i) { sig.setEntry(i, FastMath.sqrt(cov.getEntry(i,i))); } return sig; }