Package no.uib.cipr.matrix

Examples of no.uib.cipr.matrix.Matrix


        assertEquals(Cd, C);
    }

    public void testMatrixMultAddDense() {
        int m = A.numRows(), k = A.numColumns(), n = Utilities.getInt(1, max);
        Matrix B = Matrices.random(k, n), C = Matrices.random(m, n);
        double[][] Bd = Matrices.getArray(B), Cd = Matrices.getArray(C);
        double alpha = Math.random();

        C = A.multAdd(alpha, B, C);
        Cd = multAdd(Ad, alpha, Bd, Cd);
View Full Code Here


        assertEquals(Cd, C);
    }

    public void testMatrixMultAdd() {
        int m = A.numRows(), k = A.numColumns(), n = Utilities.getInt(1, max);
        Matrix B = Matrices.synchronizedMatrix(Matrices.random(k, n)), C = Matrices
                .synchronizedMatrix(Matrices.random(m, n));
        double[][] Bd = Matrices.getArray(B), Cd = Matrices.getArray(C);
        double alpha = Math.random();

        C = A.multAdd(alpha, B, C);
View Full Code Here

        assertEquals(Cd, C);
    }

    public void testMatrixTransAmultAddDense() {
        int m = A.numColumns(), k = A.numRows(), n = Utilities.getInt(1, max);
        Matrix B = Matrices.random(k, n), C = Matrices.random(m, n);
        double[][] Bd = Matrices.getArray(B), Cd = Matrices.getArray(C);
        double alpha = Math.random();

        C = A.transAmultAdd(alpha, B, C);
        Cd = transAmultAdd(Ad, alpha, Bd, Cd);
View Full Code Here

        assertEquals(Cd, C);
    }

    public void testMatrixTransAmultAdd() {
        int m = A.numColumns(), k = A.numRows(), n = Utilities.getInt(1, max);
        Matrix B = Matrices.synchronizedMatrix(Matrices.random(k, n)), C = Matrices
                .synchronizedMatrix(Matrices.random(m, n));
        double[][] Bd = Matrices.getArray(B), Cd = Matrices.getArray(C);
        double alpha = Math.random();

        C = A.transAmultAdd(alpha, B, C);
View Full Code Here

        assertEquals(Cd, C);
    }

    public void testMatrixTransABmultAddDense() {
        int m = A.numColumns(), k = A.numRows(), n = Utilities.getInt(1, max);
        Matrix B = Matrices.random(n, k), C = Matrices.random(m, n);
        double[][] Bd = Matrices.getArray(B), Cd = Matrices.getArray(C);
        double alpha = Math.random();

        C = A.transABmultAdd(alpha, B, C);
        Cd = transABmultAdd(Ad, alpha, Bd, Cd);
View Full Code Here

        assertEquals(Cd, C);
    }

    public void testMatrixTransABmultAdd() {
        int m = A.numColumns(), k = A.numRows(), n = Utilities.getInt(1, max);
        Matrix B = Matrices.synchronizedMatrix(Matrices.random(n, k)), C = Matrices
                .synchronizedMatrix(Matrices.random(m, n));
        double[][] Bd = Matrices.getArray(B), Cd = Matrices.getArray(C);
        double alpha = Math.random();

        C = A.transABmultAdd(alpha, B, C);
View Full Code Here

        assertEquals(Cd, C);
    }

    public void testMatrixTransBmultAddDense() {
        int m = A.numRows(), k = A.numColumns(), n = Utilities.getInt(1, max);
        Matrix B = Matrices.random(n, k), C = Matrices.random(m, n);
        double[][] Bd = Matrices.getArray(B), Cd = Matrices.getArray(C);
        double alpha = Math.random();

        C = A.transBmultAdd(alpha, B, C);
        Cd = transBmultAdd(Ad, alpha, Bd, Cd);
View Full Code Here

        assertEquals(Cd, C);
    }

    public void testMatrixTransBmultAdd() {
        int m = A.numRows(), k = A.numColumns(), n = Utilities.getInt(1, max);
        Matrix B = Matrices.synchronizedMatrix(Matrices.random(n, k)), C = Matrices
                .synchronizedMatrix(Matrices.random(m, n));
        double[][] Bd = Matrices.getArray(B), Cd = Matrices.getArray(C);
        double alpha = Math.random();

        C = A.transBmultAdd(alpha, B, C);
View Full Code Here

    /**
     * Checks transpose
     */
    public void testTranspose() {
        Matrix At = Matrices.random(A.numColumns(), A.numRows());
        assertEquals(transpose(), A.transpose(At));
    }
View Full Code Here

     * Test of direct matrix solver
     */
    public void testMatrixSolve() {
        while (true) {
            try {
                Matrix B = Matrices.random(A.numRows(), A.numColumns());
                Matrix X = Matrices.random(A.numRows(), A.numColumns());
                X = A.solve(B, X);

                Matrix Y = A.multAdd(X, X.copy().set(-1, B));
                assertEquals(0, Y.norm(Matrix.Norm.Frobenius), tol);
                assertEquals(Ad, A);
                return;
            } catch (MatrixSingularException e) {
                Utilities.addDiagonal(A, Ad, 1);
            } catch (MatrixNotSPDException e) {
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.