Package no.uib.cipr.matrix

Examples of no.uib.cipr.matrix.Matrix


        System.arraycopy(svd.getS(), 0, S.getDiagonal(), 0, svd.getS().length);
        DenseMatrix U = svd.getU();
        DenseMatrix Vt = svd.getVt();

        // Compute U*S*Vt
        Matrix s = U.mult(S.mult(Vt, new DenseMatrix(S.numRows(), Vt
                .numColumns())), new DenseMatrix(A.numRows(), A.numColumns()));

        // Check that A=U*S*Vt
        for (int i = 0; i < A.numRows(); ++i)
            for (int j = 0; j < A.numColumns(); ++j)
                assertEquals(A.get(i, j), s.get(i, j), 1e-12);
    }
View Full Code Here


        A = null;
    }

    protected void assertEquals(Matrix A, double[] w, DenseMatrix Z) {
        // A*X
        Matrix left = A.mult(Z, new DenseMatrix(A.numRows(), A.numColumns()));

        // lambda*X
        Matrix right = new DenseMatrix(Z);
        for (int i = 0; i < w.length; ++i)
            for (int j = 0; j < w.length; ++j)
                right.set(i, j, w[j] * right.get(i, j));

        // Check that A*X=lambda*X
        for (int i = 0; i < A.numRows(); ++i)
            for (int j = 0; j < A.numColumns(); ++j)
                assertEquals(left.get(i, j), right.get(i, j), 1e-12);
    }
View Full Code Here

TOP

Related Classes of no.uib.cipr.matrix.Matrix

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.