Package no.uib.cipr.matrix

Examples of no.uib.cipr.matrix.DenseMatrix


        assertEquals(Ar, qr.factor(new DenseMatrix(Ar)));
    }

    public void testRepeatFactorNonSquare() {
        QR qr = new QR(Ar.numRows(), Ar.numColumns());
        qr.factor(new DenseMatrix(Ar));
        assertEquals(Ar, qr);
        qr.factor(new DenseMatrix(Ar));
        assertEquals(Ar, qr);
    }
View Full Code Here


        BandLU lu = new BandLU(n, kl, ku);
        lu.factor(A.copy());

        lu.solve(I);

        Matrix J = I.mult(A, new DenseMatrix(n, n));
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < n; ++j)
                if (i != j)
                    assertEquals(J.get(i, j), 0, 1e-10);
                else
View Full Code Here

        BandLU lu = new BandLU(n, kl, ku);
        lu.factor(A.copy());

        lu.transSolve(I);

        Matrix J = I.transAmult(A, new DenseMatrix(n, n));
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < n; ++j)
                if (i != j)
                    assertEquals(J.get(i, j), 0, 1e-10);
                else
View Full Code Here

        BandCholesky c = new BandCholesky(n, kl, false);
        c.factor(L.copy());

        c.solve(I);

        Matrix J = I.mult(L, new DenseMatrix(n, n));
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < n; ++j)
                if (i != j)
                    assertEquals(J.get(i, j), 0, 1e-10);
                else
View Full Code Here

        BandCholesky c = new BandCholesky(n, ku, true);
        c.factor(U.copy());

        c.solve(I);

        Matrix J = I.mult(U, new DenseMatrix(n, n));
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < n; ++j)
                if (i != j)
                    assertEquals(J.get(i, j), 0, 1e-10);
                else
View Full Code Here

    }

    @Override
    protected void setUp() throws Exception {
        int n = Utilities.getInt(1, max);
        A = new DenseMatrix(n, n);
    }
View Full Code Here

        int n = 1000;
       
        System.out.println(
            "Testing QR factorization of " + m + "-by-" + n + " matrix");
              
        DenseMatrix A = new DenseMatrix(m,n);
        DenseMatrix B = new DenseMatrix(n,n);
        Random R = new Random();
       
        for (int j=0; j<A.numColumns(); ++j) {
            for (int i=0; i<A.numRows(); ++i) {
                A.set(i,j,R.nextGaussian());
            }
        }
       
        long start = System.currentTimeMillis();
       
        QR qr = QR.factorize(A);
        B.set(qr.getR());
       
        long end = System.currentTimeMillis();
       
        System.out.println(
            "Total time: " + (end - start) + " millisecs.");
View Full Code Here

        public void collect(TypedBytesWritable key, TypedBytesWritable value)
            throws IOException {
            double row[] = decodeTypedBytesArray(value);
            if (A == null) {
                numColumns = row.length;
                A = new DenseMatrix(numColumns*blockSize,numColumns);
            } else {
                assert(row.length == numColumns);
            }
           
            // just collect one row at the moment
View Full Code Here

        super.setUp();
    }

    public void testTriDiagonal() {
        int n = Utilities.getInt(1, 10);
        Matrix A = new DenseMatrix(n, n);
        Vector x = new DenseVector(n);

        for (int i = 0; i < n; ++i) {
            A.set(i, i, 2);
            x.set(i, 1);
        }
        for (int i = 0; i < n - 1; ++i) {
            A.set(i, i + 1, -1);
            A.set(i + 1, i, -1);
        }

        testFactorization(A, x);
    }
View Full Code Here

        testFactorization(A, x);
    }

    public void testPentaDiagonal() {
        int n = Utilities.getInt(1, 10);
        Matrix A = new DenseMatrix(n, n);
        Vector x = new DenseVector(n);

        for (int i = 0; i < n; ++i) {
            A.set(i, i, 4);
            x.set(i, 1);
        }
        for (int i = 0; i < n - 1; ++i) {
            A.set(i, i + 1, -1);
            A.set(i + 1, i, -1);
        }
        for (int i = 0; i < n - 2; ++i) {
            A.set(i, i + 2, -1);
            A.set(i + 2, i, -1);
        }

        testFactorization(A, x);
    }
View Full Code Here

TOP

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

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.