Examples of subtract()


Examples of org.apache.commons.math.complex.Complex.subtract()

            C = f[i].subtract(f[i+1]);
            D = f[i+2].subtract(f[i+3]);
            E = C.add(D.multiply(Complex.I));
            F = C.subtract(D.multiply(Complex.I));
            f[i] = A.add(B);
            f[i+2] = A.subtract(B);
            // omegaCount indicates forward or inverse transform
            f[i+1] = roots.isForward() ? F : E;
            f[i+3] = roots.isForward() ? E : F;
        }
View Full Code Here

Examples of org.apache.commons.math.dfp.Dfp.subtract()

            /* Make adjustments for sign */
            if (x < 0.0) {
                if (y > 0.0)
                    refdfp = field.getPi().add(refdfp);
                else
                    refdfp = refdfp.subtract(field.getPi());
            }

            double ref = refdfp.toDouble();
            double err = (tst - ref) / ref;

View Full Code Here

Examples of org.apache.commons.math.geometry.Vector3D.subtract()

    Vector3D v1 = new Vector3D(1, 2, 3);
    Vector3D v2 = new Vector3D(-3, -2, -1);
    v1 = v1.subtract(v2);
    checkVector(v1, 4, 4, 4);

    checkVector(v2.subtract(v1), -7, -6, -5);
    checkVector(v2.subtract(3, v1), -15, -14, -13);

  }

  public void testAdd() {
View Full Code Here

Examples of org.apache.commons.math.linear.RealMatrix.subtract()

         * Verify that residuals computed using the hat matrix are close to
         * what we get from direct computation, i.e. r = (I - H) y
         */
        double[] residuals = model.estimateResiduals();
        RealMatrix I = MatrixUtils.createRealIdentityMatrix(10);
        double[] hatResiduals = I.subtract(hat).operate(model.Y).getData();
        TestUtils.assertEquals(residuals, hatResiduals, 10e-12);
    }
}
View Full Code Here

Examples of org.apache.commons.math.linear.RealVector.subtract()

        EigenDecomposition ed = new EigenDecompositionImpl(matrix, MathUtils.SAFE_MIN);
        for (int i = 0; i < matrix.getRowDimension(); ++i) {
            double lambda = ed.getRealEigenvalue(i);
            RealVector v  = ed.getEigenvector(i);
            RealVector mV = matrix.operate(v);
            assertEquals(0, mV.subtract(v.mapMultiplyToSelf(lambda)).getNorm(), 1.0e-13);
        }
    }

    /** test A = VDVt */
    public void testAEqualVDVt() {
View Full Code Here

Examples of org.apache.commons.math3.analysis.differentiation.DerivativeStructure.subtract()

    @Override
    public DerivativeStructure[] value(DerivativeStructure[] variables) {
        DerivativeStructure x1 = variables[0];
        DerivativeStructure x2 = variables[1];
        return new DerivativeStructure[] {
            x2.subtract(x1.multiply(x1)).multiply(10),
            x1.negate().add(1)
        };
    }

  }
View Full Code Here

Examples of org.apache.commons.math3.complex.Complex.subtract()

        Complex a = complexFormat.parse(stackAnswer.pop());
        Complex b = complexFormat.parse(stackAnswer.pop());
        if (token.equals("+")) {
          stackAnswer.push(complexFormat.format(b.add(a)));
        } else if (token.equals("-")) {
          stackAnswer.push(complexFormat.format(b.subtract(a)));
        } else if (token.equals("*")) {
          stackAnswer.push(complexFormat.format(b.multiply(a)));
        } else if (token.equals("/")) {
          stackAnswer.push(complexFormat.format(b.divide(a)));
        }
View Full Code Here

Examples of org.apache.commons.math3.dfp.Dfp.subtract()

            /* Make adjustments for sign */
            if (x < 0.0) {
                if (y > 0.0)
                    refdfp = field.getPi().add(refdfp);
                else
                    refdfp = refdfp.subtract(field.getPi());
            }

            double ref = refdfp.toDouble();
            double err = (tst - ref) / ref;

View Full Code Here

Examples of org.apache.commons.math3.linear.ArrayRealVector.subtract()

                                     double[] sample,
                                     double learningRate) {
        final ArrayRealVector c = new ArrayRealVector(current, false);
        final ArrayRealVector s = new ArrayRealVector(sample, false);
        // c + learningRate * (s - c)
        return s.subtract(c).mapMultiplyToSelf(learningRate).add(c).toArray();
    }
}
View Full Code Here

Examples of org.apache.commons.math3.linear.RealMatrix.subtract()

        stateEstimation = stateEstimation.add(kalmanGain.operate(innovation));

        // update covariance of prediction error
        // P(k) = (I - K * H) * P(k)-
        RealMatrix identity = MatrixUtils.createRealIdentityMatrix(kalmanGain.getRowDimension());
        errorCovariance = identity.subtract(kalmanGain.multiply(measurementMatrix)).multiply(errorCovariance);
    }
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.