Package mikera.matrixx.decompose

Examples of mikera.matrixx.decompose.ILUPResult


   *
   * @param m
   * @return
   */
  static double calculateLUPDeterminant(AMatrix m) {
    ILUPResult lup=SimpleLUP.decompose(m);
    double det=lup.getL().diagonalProduct()*lup.getU().diagonalProduct()*lup.getP().determinant();
    return det;
  }
View Full Code Here


//  }

  @Test
  public void testRandomDecompose() {
    AMatrix a=Matrixx.createRandomMatrix(4, 4);
    ILUPResult r=SimpleLUP.decompose(a);
   
    AMatrix lu=r.getL().innerProduct(r.getU());
    AMatrix pa=r.getP().innerProduct(a);
   
    if(!lu.epsilonEquals(pa)) {
      fail("L="+r.getL()+"\n"+"U="+r.getU()+"\n"+"LU="+lu+"\n"+"PA="+pa+"\n");
    }
  }
View Full Code Here

  @Test public void testLU() {
    // we are testing that PA = LU
   
    AMatrix a=Matrixx.create(new double[][] {{4,3},{6,3}});
   
    ILUPResult ms=SimpleLUP.decompose(a);
    AMatrix lu=ms.getL().innerProduct(ms.getU());
   
    assertEquals(ms.getP().innerProduct(a),lu);

    //assertEquals(Matrixx.create(new double[][] {{1,0},{1.5,1}}),lu[0]);
    //assertEquals(Matrixx.create(new double[][] {{4,3},{0,-1.5}}),lu[1]);

    a=Matrixx.createRandomSquareMatrix(4);
    ms=SimpleLUP.decompose(a);
    lu=ms.getL().innerProduct(ms.getU());
    assertTrue(ms.getP().innerProduct(a).epsilonEquals(lu));

   
    a=PermutationMatrix.create(0, 2,1,3);
    ms=SimpleLUP.decompose(a);
    lu=ms.getL().innerProduct(ms.getU());
    assertTrue(ms.getP().innerProduct(a).epsilonEquals(lu));
    assertEquals(IdentityMatrix.create(4),ms.getL());
    assertEquals(IdentityMatrix.create(4),ms.getU());
    assertEquals(a,ms.getP().inverse());
  }
View Full Code Here

TOP

Related Classes of mikera.matrixx.decompose.ILUPResult

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.