Examples of AMatrix


Examples of mikera.matrixx.AMatrix

            TridiagonalDecompositionHouseholder alg = createDecomposition();
            alg.decompose(A);

            // test the results using the decomposition's definition
            AMatrix Q = alg.getQ(false);
            AMatrix T = alg.getT();

//            SimpleMatrix A_found = Q.mult(T).mult(Q.transpose());
            Matrix A_found = Multiplications.multiply(Q, Multiplications.multiply(T, Q.getTranspose()));

            assertTrue("width = "+width,A.epsilonEquals(A_found,1e-8));
View Full Code Here

Examples of mikera.matrixx.AMatrix

            TridiagonalDecompositionHouseholder alg = createDecomposition();

            alg.decompose(A);

            AMatrix T = alg.getT();

            double diag[] = new double[width];
            double off[] = new double[width];

            alg.getDiagonal(diag,off);
            assertEquals(T.get(0,0),diag[0],1e-8);
            for( int i = 1; i < width; i++ ) {
                assertEquals(T.get(i,i),diag[i],1e-8);
                assertEquals(T.get(i-1,i),off[i-1],1e-8);
            }
        }
    }
View Full Code Here

Examples of mikera.matrixx.AMatrix

            TridiagonalDecompositionHouseholder alg = createDecomposition();

            alg.decompose(A);

            AMatrix Q = alg.getQ(false);
            AMatrix Q_t = alg.getQ(true);

            for( int i = 0; i < Q.rowCount(); i++ ) {
                for( int j = 0; j < Q.columnCount(); j++ ) {
                    assertEquals(Q.get(i,j),Q_t.get(j,i),1e-8);
                }
            }
        }
    }
View Full Code Here

Examples of mikera.matrixx.AMatrix

     */
    public void checkRandomSymmetric() {
        for( int N = 1; N <= 15; N++ ) {
            for( int i = 0; i < 20; i++ ) {
//                DenseMatrix64F A = RandomMatrices.createSymmetric(N,-1,1,rand);
                AMatrix z = Matrixx.createRandomMatrix(3, 3);
                AMatrix A = z.innerProduct(z.getTranspose());

                SymmetricQRAlgorithmDecomposition alg = createDecomposition();

                assertNotNull(alg.decompose(A));
               
                performStandardTests(alg,A.toMatrix(),-1);
            }
        }
    }
View Full Code Here

Examples of mikera.matrixx.AMatrix

                assertFalse(v.hasUncountable());

//                CommonOps.mult(A,v,tempA);
                Matrix ta = Matrix.create(A.rowCount(), 1);
                ta.setColumn(0, (v));
                AMatrix tempA = Multiplications.multiply(A, ta);
//                CommonOps.scale(c.real,v,tempB);
                Matrix tb = Matrix.create(v.length(), 1);
                tb.setColumn(0, v);
                AMatrix tempB = tb.multiplyCopy(c.x);
//                double max = NormOps.normPInf(A);
                double max = normPInf(A);
                if( max == 0 ) max = 1;
               
                double error = diffNormF(tempA,tempB)/max;
View Full Code Here

Examples of mikera.matrixx.AMatrix

        return A.absCopy().elementMax();
    }

    private double diffNormF(AMatrix tempA, AMatrix tempB)
    {
        AMatrix temp = tempA.copy();
        temp.sub(tempB);
        double total = temp.elementSquaredSum();
        temp.abs();
        double scale = temp.elementMax();
        return Math.abs(scale-0) > 1e-12 ? total/scale : 0;
    }
View Full Code Here

Examples of mikera.matrixx.AMatrix

//                if( c.isReal() ) {
                if(Math.abs(c.y - 0) < 1e-8)
                    if( vector.length > 0 ) {
                        AVector v = alg.getEigenVector(i);
                        AMatrix e = Matrix.createFromRows(vector);
                        e = e.getTranspose();
                       
                        Matrix t = Matrix.create(v.length(), 1);
                        t.setColumn(0, v);
                        double error = diffNormF(e,t);
//                        CommonOps.changeSign(e);
                        e.multiply(-1);
                        double error2 = diffNormF(e,t);


                        if(error < 1e-3 || error2 < 1e-3)
                            numMatched++;
View Full Code Here

Examples of mikera.matrixx.AMatrix

    assertEquals(original,a);
  }
 
  @Test
  public void testCholesky() {
    AMatrix z = Matrixx.createRandomMatrix(3, 3);
    AMatrix a = z.innerProduct(z.getTranspose()); // should get a symmetric positive definite matrix!
   
    ICholeskyResult r=Cholesky.decompose(a);
    validateCholesky(a,r);
  }
View Full Code Here

Examples of mikera.matrixx.AMatrix

    validateCholesky(a,r);
  }
 
  @Test
  public void testZero() {
    AMatrix a = ZeroMatrix.create(4, 4);
    ICholeskyResult r=Cholesky.decompose(a);
    assertNull(r);
  }
View Full Code Here

Examples of mikera.matrixx.AMatrix

    assertNull(r);
  }
 
  @Test
  public void testIdentity() {
    AMatrix a = IdentityMatrix.create(5);
    ICholeskyResult r=Cholesky.decompose(a);
    validateCholesky(a,r);   
  }
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.