Package org.apache.commons.math3.fraction

Examples of org.apache.commons.math3.fraction.BigFraction


    /**
     *
     * @see BigFraction#BigFraction(double)
     */
    public Rational(double value) throws MathIllegalArgumentException {
        fraction = new BigFraction(value);
    }
View Full Code Here


    /**
     *
     * @see BigFraction#BigFraction(double, double, int)
     */
    public Rational(double value, double epsilon, int maxIterations) throws FractionConversionException {
        fraction = new BigFraction(value, epsilon, maxIterations);
    }
View Full Code Here

    /**
     *
     * @see BigFraction#BigFraction(double, int)
     */
    public Rational(double value, int maxDenominator) throws FractionConversionException {
        fraction = new BigFraction(value, maxDenominator);
    }
View Full Code Here

    /**
     *
     * @see BigFraction#BigFraction(int)
     */
    public Rational(int num) {
        fraction = new BigFraction(num);
    }
View Full Code Here

    /**
     *
     * @see BigFraction#BigFraction(int, int)
     */
    public Rational(int num, int den) {
        fraction = new BigFraction(num, den);
    }
View Full Code Here

    /**
     *
     * @see BigFraction#BigFraction(long)
     */
    public Rational(long num) {
        fraction = new BigFraction(num);
    }
View Full Code Here

    /**
     *
     * @see BigFraction#BigFraction(long, long)
     */
    public Rational(long num, long den) {
        fraction = new BigFraction(num, den);
    }
View Full Code Here

    }

    @Test
    public void testBigFractionConverter() {
        BigFraction[][] bfData = {
                { new BigFraction(1), new BigFraction(2), new BigFraction(3) },
                { new BigFraction(2), new BigFraction(5), new BigFraction(3) },
                { new BigFraction(1), new BigFraction(0), new BigFraction(8) }
        };
        FieldMatrix<BigFraction> m = new Array2DRowFieldMatrix<BigFraction>(bfData, false);
        RealMatrix converted = MatrixUtils.bigFractionMatrixToRealMatrix(m);
        RealMatrix reference = new Array2DRowRealMatrix(testData, false);
        Assert.assertEquals(0.0, converted.subtract(reference).getNorm(), 0.0);
View Full Code Here

     
      List<SiteWithPolynomial> nearestSites =
          nearestSiteMap.get(site);
     
      RealVector vector = new ArrayRealVector(SITES_FOR_APPROX);
      RealMatrix matrix = new Array2DRowRealMatrix(
          SITES_FOR_APPROX, DefaultPolynomial.NUM_COEFFS);
     
      for (int row = 0; row < SITES_FOR_APPROX; row++) {
        SiteWithPolynomial nearSite = nearestSites.get(row);
        DefaultPolynomial.populateMatrix(matrix, row, nearSite.pos.x, nearSite.pos.z);
View Full Code Here

     * @param residuals Residuals.
     * @return the cost.
     * @see #computeResiduals(double[])
     */
    protected double computeCost(double[] residuals) {
        final ArrayRealVector r = new ArrayRealVector(residuals);
        return FastMath.sqrt(r.dotProduct(getWeight().operate(r)));
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.math3.fraction.BigFraction

Copyright © 2018 www.massapicom. 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.