Examples of HouseholderQR


Examples of mikera.matrixx.decompose.impl.qr.HouseholderQR

    Random rand = new Random(0xff);


    @Override
    protected QRDecomposition createQRDecomposition(boolean compact) {
        return new HouseholderQR(compact);
    }
View Full Code Here

Examples of mikera.matrixx.decompose.impl.qr.HouseholderQR

  @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);
View Full Code Here

Examples of mikera.matrixx.decompose.impl.qr.HouseholderQR

  }

  @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());
View Full Code Here

Examples of mikera.matrixx.decompose.impl.qr.HouseholderQR

  }

  @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);
View Full Code Here

Examples of mikera.matrixx.decompose.impl.qr.HouseholderQR

     *
     * @param matrix
     * @return
     */
    public static IQRResult decompose(AMatrix matrix) {
        HouseholderQR alg = new HouseholderQR(false);
        return alg.decompose(matrix)
    }
View Full Code Here

Examples of mikera.matrixx.decompose.impl.qr.HouseholderQR

     *
     * @param matrix
     * @return
     */
    public static IQRResult decompose(AMatrix matrix, boolean compact) {
        HouseholderQR alg = new HouseholderQR(compact);
        return alg.decompose(matrix)
    }
View Full Code Here

Examples of mikera.matrixx.decompose.impl.qr.HouseholderQR

   *
   * @param matrix
   * @return
   */
  public static IQRResult decomposeCompact(AMatrix matrix) {
    HouseholderQR alg = new HouseholderQR(true);
    return alg.decompose(matrix)
  }
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.