Package mikera.matrixx

Examples of mikera.matrixx.Matrix.epsilonEquals()


   
   
        // ----------------------------------------------------------------------
    // Check equality from D.
    startTimer();
    eq = D.epsilonEquals(M, 0.000001);
    printTime("epsilonEquals check result (" + eq + ", should be true): ");
   
   
        // ----------------------------------------------------------------------
    // Change sparse matrix and test equality again (shouldn't be equal)
View Full Code Here


        Matrix B = Matrix.createRandom(4,2);
        Matrix B_orig = B.copy();

        solver.solve(B);

        assertTrue(B_orig.epsilonEquals(B));
    }

    /**
     * See if a matrix that is more singular has a lower quality.
     */
 
View Full Code Here

        AMatrix x = solver.solve(b);


        Matrix x_expected = Matrix.create(new double[][] {{1}, {2}, {3}});

        assertTrue(x_expected.epsilonEquals(x,1e-8));
    }

    /**
     * This test checks to see if it can solve a system that will require some algorithms to
     * perform a pivot.  Pivots can change the data structure and can cause solve to fail if not
View Full Code Here

        assertNotNull(solver.setA(A));
        Matrix x = solver.solve(b).toMatrix();

        Matrix x_expected = Matrix.create(new double[][] {{1}, {2}, {3}});

        assertTrue(x_expected.epsilonEquals(x,1e-6));
    }
}
View Full Code Here

        Matrix B = Matrix.createRandom(4,2);
        Matrix B_orig = B.copy();

        solver.solve(B);

        assertTrue(B_orig.epsilonEquals(B));
    }

    /**
     * See if a matrix that is more singular has a lower quality.
     */
 
View Full Code Here

        AMatrix x = solver.solve(b);


        Matrix x_expected = Matrix.create(new double[][] {{1}, {2}, {3}});

        assertTrue(x_expected.epsilonEquals(x,1e-8));
    }

    /**
     * This test checks to see if it can solve a system that will require some algorithms to
     * perform a pivot.  Pivots can change the data structure and can cause solve to fail if not
View Full Code Here

        assertTrue(solver.setA(A));
        Matrix x = solver.solve(b).toMatrix();

        Matrix x_expected = Matrix.create(new double[][] {{1}, {2}, {3}});

        assertTrue(x_expected.epsilonEquals(x,1e-6));
    }

    /**
     * Have it solve for the coefficients in a polynomial
     */
 
View Full Code Here

        I.sub(temp1);
        Matrix Q = I;


        // check the expected properties of Q
        assertTrue(Q.epsilonEquals(Q.getTranspose(),1e-6));
        assertTrue(Q.epsilonEquals(Q.inverse(),1e-6));

//        SimpleMatrix result = Q.mult(A.extractMatrix(w,width,w,width));
        AStridedMatrix result = Multiplications.multiply(Q, A.subMatrix(w,width-w,w,width-w));
View Full Code Here

        Matrix Q = I;


        // check the expected properties of Q
        assertTrue(Q.epsilonEquals(Q.getTranspose(),1e-6));
        assertTrue(Q.epsilonEquals(Q.inverse(),1e-6));

//        SimpleMatrix result = Q.mult(A.extractMatrix(w,width,w,width));
        AStridedMatrix result = Multiplications.multiply(Q, A.subMatrix(w,width-w,w,width-w));

        for( int i = 1; i < width-w; i++ ) {
View Full Code Here

  @Test
  public void testModifiedInput() {
      Matrix A = Matrix.createRandom(5, 5);
      Matrix B = A.copy();
      AltLU.decompose(A);
      assertTrue(B.epsilonEquals(A));
  }

  /**
   * Uses the decomposition returned from octave, which uses LAPACK
   */
 
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.