Examples of AMatrix


Examples of mikera.matrixx.AMatrix

    validateCholesky(a,r);   
  }
 
  @Test
  public void testSpecial() {
    AMatrix a = Matrix.create(new double[][] {{0,1},{0,0}});
    ICholeskyResult r=Cholesky.decompose(a);
    assertNull(r)
  }
View Full Code Here

Examples of mikera.matrixx.AMatrix

    assertNull(r)
  }
 
  @Test
  public void testNegative() {
    AMatrix a = Matrix.create(new double[][] {{-1}});
    ICholeskyResult r=Cholesky.decompose(a);
    assertNull(r);   
  }
View Full Code Here

Examples of mikera.matrixx.AMatrix

    ICholeskyResult r=Cholesky.decompose(a);
    assertNull(r);   
  }
 
  public void validateCholesky(AMatrix a, ICholeskyResult r) {
    AMatrix l=r.getL();
    AMatrix u=r.getU();
   
    assertTrue("l and u and not transposes!",l.epsilonEquals(u.getTranspose()));
    assertTrue(l.isLowerTriangular());
    assertTrue(u.isUpperTriangular());
   
    assertTrue("product not valid",l.innerProduct(u).epsilonEquals(a));
  }
View Full Code Here

Examples of mikera.matrixx.AMatrix

        I.sub(temp1);
        Matrix expected = Multiplications.multiply(I, A_sub);

        qr.updateA(w,U.asDoubleArray(),gamma,tau);

        AMatrix found = qr.getQR();

        assertEquals(-tau,found.get(w,w),1e-8);

        for( int i = w+1; i < width; i++ ) {
            assertEquals(U.get(i,0),found.get(i,w),1e-8);
        }

        // the right should be the same
        for( int i = w; i < width; i++ ) {
            for( int j = w+1; j < width; j++ ) {
                double a = expected.get(i-w,j-w);
                double b = found.get(i,j);

                assertEquals(a,b,1e-6);
            }
        }
    }
View Full Code Here

Examples of mikera.matrixx.AMatrix

    assertEquals(1,m.lowerBandwidth());
  }
 
  @Test
  public void testBandedBandwidth() {
    AMatrix m=BandedMatrix.create(6, 6, -6, 6);
   
    assertEquals(0,m.upperBandwidth());
    assertEquals(5,m.upperBandwidthLimit());
    assertEquals(0,m.lowerBandwidth());
    assertEquals(5,m.lowerBandwidthLimit());
   
    m.getBand(-1).fill(1.0);
    assertEquals(0,m.upperBandwidth());
    assertEquals(1,m.lowerBandwidth());
  }
View Full Code Here

Examples of mikera.matrixx.AMatrix

   
    mb.append(Vector3.of(1,0,0));
    mb.append(new double[] {0,1,0});
    mb.append(Vector.of(0,0).join(Vector.of(1)));
   
    AMatrix m= mb.toMatrix();
   
    assertEquals(3,m.rowCount());
    assertTrue(m.isIdentity());
  }
View Full Code Here

Examples of mikera.matrixx.AMatrix

    assertEquals(0.0,m.elementMax(),0.0);
    assertEquals(0.0,m.elementMin(),0.0);   
  }
 
  @Test public void testBigMatrix() {
    AMatrix m=Matrixx.createSparse(2000000,2000000);
    testBigStats(m);
    testBigStats(m.getTranspose());
   
    m.set(3,4,7.0);
    assertEquals(m,m.exactClone());
   
    AMatrix mt=m.getTranspose();
    assertEquals(m.getTranspose(),mt);
   
    assertTrue(m.density()<0.0001);
  }
View Full Code Here

Examples of mikera.matrixx.AMatrix

   
    assertTrue(m.density()<0.0001);
  }
 
  @Test public void testBigMultiply() {
    AMatrix m=Matrixx.createSparse(2000000,2000000);
    m.set(3,4,7.0);
   
    AMatrix r=m.innerProduct(m.getTranspose());
    assertEquals(49.0,r.get(3,3),0.0);
    assertEquals(49.0,r.elementSum(),0.0);
  }
View Full Code Here

Examples of mikera.matrixx.AMatrix

    assertEquals(49.0,r.get(3,3),0.0);
    assertEquals(49.0,r.elementSum(),0.0);
  }
 
  @Test public void testSparseAdd() {
    AMatrix m=Matrixx.createSparse(20000,20000);
    m.add(ZeroMatrix.create(20000, 20000));
   
    assertTrue(m.isZero());
   
    AMatrix mz=m.addCopy(Matrixx.createSparse(20000,20000));
    assertTrue(mz.isZero());
  }
View Full Code Here

Examples of mikera.matrixx.AMatrix

    AMatrix mz=m.addCopy(Matrixx.createSparse(20000,20000));
    assertTrue(mz.isZero());
  }
 
  @Test public void testSparseInnerProduct() {
    AMatrix m=Matrixx.createSparse(200000,200000);
   
    AMatrix mt=m.getTranspose();
    AMatrix mmt = m.innerProduct(mt);
   
    assertTrue(mmt.isSameShape(m));
  }
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.