Examples of AMatrix


Examples of mikera.matrixx.AMatrix

 
  public static void main(String[] args) {
    SparseRowMatrix sm=createMatrix();
    System.out.println(sm.nonZeroCount() +" elements are non-zero out of " + sm.elementCount()+" total elements");
   
    AMatrix smm=sm.innerProduct(sm);
    System.out.println(smm.nonZeroCount() +" elements are non-zero in the product.");
  }
View Full Code Here

Examples of mikera.matrixx.AMatrix

    System.out.println(m);
    System.out.println(m.getTranspose());

    System.out.println();
   
    AMatrix m2=Matrixx.createRandomSquareMatrix(2);
    System.out.println(m2);
    System.out.println(m2.getTranspose());
    m2.transposeInPlace();
    System.out.println(m2);
   
   
  }
View Full Code Here

Examples of mikera.matrixx.AMatrix

  @Test public void testOuterProducts() {
    AVector v=Vectorz.createUniformRandomVector(5);
    INDArray a=v.outerProduct(v);
    assertTrue(a instanceof AMatrix);
   
    AMatrix m=(AMatrix)a;
    AVector v2=v.clone();
    v2.square();
    assertEquals(v2,m.getLeadingDiagonal());
  }
View Full Code Here

Examples of mikera.matrixx.AMatrix

    AVector c=Vectorz.createUniformRandomVector(v.length());
    assertEquals(v.dotProduct(c),v.innerProduct((INDArray)c).get(),0.00001);
   
    if (len>20) return;
   
    AMatrix m=Matrixx.createRandomMatrix(len, len);
    assertTrue(v.innerProduct(m).epsilonEquals(m.getTranspose().transform(v)));
  }
View Full Code Here

Examples of mikera.matrixx.AMatrix

    AVector g4=new GrowableVector(v4);
    doGenericTests(g4);
  }
   
  @Test public void g_MatrixViews5x5() { 
    AMatrix m1=Matrixx.createRandomSquareMatrix(5);
    doGenericTests(m1.asVector());
    doGenericTests(m1.getRow(4));
    doGenericTests(m1.getColumn(1));
    doGenericTests(m1.getLeadingDiagonal());
  }
View Full Code Here

Examples of mikera.matrixx.AMatrix

    doGenericTests(m1.getColumn(1));
    doGenericTests(m1.getLeadingDiagonal());
  }
   
  @Test public void g_MatrixViews3x3() { 
    AMatrix m2=Matrixx.createRandomSquareMatrix(3);
    doGenericTests(m2.asVector());
    doGenericTests(m2.getRow(1));
    doGenericTests(m2.getColumn(1));
    doGenericTests(m2.getLeadingDiagonal());
    doGenericTests(new MatrixAsVector(m2));
  }
View Full Code Here

Examples of mikera.matrixx.AMatrix

    doGenericTests(m2.getLeadingDiagonal());
    doGenericTests(new MatrixAsVector(m2));
  }

  @Test public void g_MatrixViews4x5() { 
    AMatrix m3=Matrixx.createRandomMatrix(4,5);
    doGenericTests(m3.asVector());
    doGenericTests(m3.getRow(2));
    doGenericTests(m3.getColumn(2));
    doGenericTests(m3.subMatrix(1, 1, 2, 3).asVector());
    doGenericTests(new MatrixAsVector(m3));
  }
View Full Code Here

Examples of mikera.matrixx.AMatrix

        Matrix b = Matrix.create(new double[][] {{18}, {21.5}, {4.9000}});

        LUSolver solver = new LUSolver();
       
        assertNotNull(solver.setA(A));
        AMatrix x = solver.solve(b);


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

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

Examples of mikera.matrixx.AMatrix

        Matrix A = Matrix.create(new double[][] {{5, 2, 3}, {1.5, -2, 8}, {-3, 4.7, -0.5}});
        Matrix b = Matrix.create(new double[][] {{18}, {21.5}, {4.9000}});

        QRHouseColSolver solver = new QRHouseColSolver();
        assertTrue(solver.setA(A));
        AMatrix x = solver.solve(b);


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

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

Examples of mikera.matrixx.AMatrix

        Matrix A = createPolyA(t,3);

        QRHouseColSolver solver = new QRHouseColSolver();
        assertTrue(solver.setA(A));

        AMatrix x = solver.solve(B);

        assertEquals(a,x.get(0,0),tol);
        assertEquals(b,x.get(1,0),tol);
        assertEquals(c,x.get(2,0),tol);
    }
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.