Examples of IQRResult


Examples of mikera.matrixx.decompose.IQRResult

    private void checkDecomposition(int height, int width, boolean compact ) {
        QRDecomposition alg = createQRDecomposition(compact);

        Matrix A = Matrix.createRandom(height, width);

        IQRResult result = alg.decompose(A);
        assertNotNull(result);

        int minStride = Math.min(height,width);

        Matrix Q = result.getQ().toMatrix();
        Matrix R = result.getR().toMatrix();
        assertTrue(Q.rowCount() == height && Q.columnCount() == height);
        assertTrue(R.rowCount() == (compact ? minStride : height));
        assertTrue(R.columnCount() == width);

        // see if Q has the expected properties
View Full Code Here

Examples of mikera.matrixx.decompose.IQRResult

        QRDecomposition alg = createQRDecomposition(true);

        Matrix A = Matrix.createRandom(height, width);

        IQRResult result = alg.decompose(A);

        Matrix Q = result.getQ().toMatrix();

        // see if Q has the expected properties
        assertTrue(Q.isOrthogonal(1e-8));
    }
View Full Code Here

Examples of mikera.matrixx.decompose.IQRResult

  }
 
  @Test
  public void testReallyTall() {
    AMatrix a = Matrix.createRandom(15, 3);
    IQRResult result = QR.decompose(a);
    validateQR(a, result);
  }
View Full Code Here

Examples of mikera.matrixx.decompose.IQRResult

  }
 
  @Test
  public void testReallyWide() {
    AMatrix a = Matrix.createRandom(3, 15);
    IQRResult result = QR.decompose(a);
    validateQR(a, result);
  }
View Full Code Here

Examples of mikera.matrixx.decompose.IQRResult

  }
 
  @Test public void testQR() {
   
    AMatrix a=Matrixx.createRandomMatrix(5, 4);
    IQRResult ms=QR.decompose(a);
   
    AMatrix q=ms.getQ();
    AMatrix r=ms.getR();
   
    // we are testing that A = QR
    assertTrue(q.innerProduct(r).epsilonEquals(a));

    // check properties of Q - should be orthogonal
View Full Code Here

Examples of mikera.matrixx.decompose.IQRResult

  @Test
  public void testDecompose() {
    double[][] dataA = { { 0, 3, 1 }, { 0, 4, -2 }, { 2, 1, 1 } };
    Matrix A = Matrix.create(dataA);
    HouseholderQR alg = new HouseholderQR(false);
    IQRResult result = alg.decompose(A);
   
    AMatrix Q = result.getQ();
    AMatrix R = result.getR();

    Matrix expectQ = Matrix.create(new double[][] { { 0, -0.6, 0.8 },
        { 0, -0.8, -0.6 }, { -1, 0, 0 } });
    Matrix expectR = Matrix.create(new double[][] { { -2, -1, -1 },
        { 0, -5, 1 }, { 0, 0, 2 } });
    assertEquals(Q, expectQ);
    assertEquals(R, expectR);

    A = Matrix.create(dataA);
    alg = new HouseholderQR(true);
    result = alg.decompose(A);
    Q = result.getQ();
    R = result.getR();

    assertEquals(Q, expectQ);
    assertEquals(R, expectR);
    validateQR(A, result);
  }
View Full Code Here

Examples of mikera.matrixx.decompose.IQRResult

  @Test
  public void testZeroDecompose() {
    AMatrix a = ZeroMatrix.create(4, 3);
    HouseholderQR alg = new HouseholderQR(false);
    IQRResult result = alg.decompose(a);
    AMatrix q = result.getQ();
    AMatrix r = result.getR();

    assertEquals(IdentityMatrix.create(3), q.subMatrix(0, 3, 0, 3));
    assertTrue(r.isZero());
    validateQR(a, result);
  }
View Full Code Here

Examples of mikera.matrixx.decompose.IQRResult

  @Test
  public void testZeroDecomposeSquare() {
    AMatrix a = ZeroMatrix.create(3, 3);
    HouseholderQR alg = new HouseholderQR(false);
    IQRResult result = alg.decompose(a);
    AMatrix q = result.getQ();
    AMatrix r = result.getR();

    assertEquals(IdentityMatrix.create(3), q);

    assertTrue(r.isZero());
    validateQR(a, result);
View Full Code Here

Examples of mikera.matrixx.decompose.IQRResult

 
  @Test
  public void testQR() {
    AMatrix a = Matrixx.createRandomMatrix(3, 3);
   
    IQRResult result = QR.decompose(a);
    validateQR(a,result);
  }
View Full Code Here

Examples of mikera.matrixx.decompose.IQRResult

//  }
 
  @Test
  public void testZero() {
    AMatrix a = ZeroMatrix.create(4, 4);
    IQRResult result = QR.decompose(a);
    assertTrue(result.getQ().isIdentity());
    assertTrue(result.getR().isZero());
  }
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.