Examples of SimpleMatrix


Examples of com.alibaba.security.simpleimage.analyze.sift.matrix.SimpleMatrix

        ImageMap below = spaces[level - 1];
        ImageMap current = spaces[level];
        ImageMap above = spaces[level + 1];

        SimpleMatrix H = new SimpleMatrix(3, 3);
        /*
         * 下面是该幅图像尺度空间的三元偏导数,记住是尺度空间上 的二阶自变量为3的偏导数2006.3.1
         */
        H.values[0][0] = below.valArr[y][x] - 2 * current.valArr[y][x] + above.valArr[y][x];
        H.values[0][1] = H.values[1][0] = 0.25 * (above.valArr[y + 1][x] - above.valArr[y - 1][x] - (below.valArr[y + 1][x] - below.valArr[y - 1][x]));
        H.values[0][2] = H.values[2][0] = 0.25 * (above.valArr[y][x + 1] - above.valArr[y][x - 1] - (below.valArr[y][x + 1] - below.valArr[y][x - 1]));
        H.values[1][1] = current.valArr[y - 1][x] - 2 * current.valArr[y][x] + current.valArr[y + 1][x];
        H.values[1][2] = H.values[2][1] = 0.25 * (current.valArr[y + 1][x + 1] - current.valArr[y + 1][x - 1] - (current.valArr[y - 1][x + 1] - current.valArr[y - 1][x - 1]));
        H.values[2][2] = current.valArr[y][x - 1] - 2 * current.valArr[y][x] + current.valArr[y][x + 1];

        SimpleMatrix d = new SimpleMatrix(3, 1);
        /*
         * 下面这个是自变量为3的一阶偏导数2006.3.1
         */
        d.values[0][0] = 0.5 * (above.valArr[y][x] - below.valArr[y][x]);
        d.values[1][0] = 0.5 * (current.valArr[y + 1][x] - current.valArr[y - 1][x]);
        d.values[2][0] = 0.5 * (current.valArr[y][x + 1] - current.valArr[y][x - 1]);

        SimpleMatrix b = (SimpleMatrix) d.clone();
        b.negate();
        // Solve: A x = b
        H.solveLinear(b);
        ref.val = b.dot(d);
        return (b);
    }
View Full Code Here

Examples of com.alibaba.security.simpleimage.analyze.sift.matrix.SimpleMatrix

            ImageMap space = spaces[point.level];
            if (x <= 0 || x >= (space.xDim - 1)) return (true);
            if (y <= 0 || y >= (space.yDim - 1)) return (true);

            RefDouble dp = new RefDouble();
            SimpleMatrix adj = getAdjustment(point, point.level, x, y, dp);

            // Get adjustments and check if we require further adjustments due
            // to pixel level moves. If so, turn the adjustments into real
            // changes and continue the loop. Do not adjust the plane, as we
            // are usually quite low on planes in thie space and could not do
View Full Code Here

Examples of org.ejml.simple.SimpleMatrix

        checkMatrix(5,5);
        checkMatrix(7,7);
    }

    private void checkMatrix( int numRows , int numCols ) {
        SimpleMatrix A = SimpleMatrix.random(numRows,numCols,-1,1,rand);

        QRExampleSimple alg = new QRExampleSimple();

        alg.decompose(A);

        SimpleMatrix Q = alg.getQ();
        SimpleMatrix R = alg.getR();

        SimpleMatrix A_found = Q.mult(R);

        assertTrue( A.isIdentical(A_found,1e-8));
    }
View Full Code Here

Examples of org.ejml.simple.SimpleMatrix

    public void extract() {
        DenseMatrix64F A = RandomMatrices.createRandom(5,10,-1,1,rand);

        D1Submatrix64F S = new D1Submatrix64F(A,2,4,1,10);

        SimpleMatrix M = S.extract();

        DenseMatrix64F E = CommonOps.extract(A,2,4,1,10);

        assertTrue(MatrixFeatures.isEquals(E,M.getMatrix()));
    }
View Full Code Here

Examples of org.ejml.simple.SimpleMatrix

        LUDecomposition<DenseMatrix64F> alg = create(3,3);
        assertTrue(alg.decompose(A));

        assertFalse(alg.isSingular());

        SimpleMatrix L = SimpleMatrix.wrap(alg.getLower(null));
        SimpleMatrix U = SimpleMatrix.wrap(alg.getUpper(null));
        SimpleMatrix P = SimpleMatrix.wrap(alg.getPivot(null));

        EjmlUnitTests.assertEquals(octLower,L.getMatrix(),1e-5);
        EjmlUnitTests.assertEquals(octUpper,U.getMatrix(),1e-5);

        DenseMatrix64F A_found = P.mult(L).mult(U).getMatrix();
        assertTrue(MatrixFeatures.isIdentical(A_found,A,1e-8));
    }
View Full Code Here

Examples of org.ejml.simple.SimpleMatrix

            checkWithDefinition(lower,5);
        }
    }

    private void checkWithDefinition(boolean lower, int size) {
        SimpleMatrix A = SimpleMatrix.wrap( RandomMatrices.createSymmPosDef(size,rand));

        CholeskyDecomposition<DenseMatrix64F> cholesky = create(lower);
        assertTrue(DecompositionFactory.decomposeSafe(cholesky,A.getMatrix()));

        SimpleMatrix T = SimpleMatrix.wrap(cholesky.getT(null));
        SimpleMatrix found;

        if( lower ) {
            found = T.mult(T.transpose());
        } else {
            found = T.transpose().mult(T);
View Full Code Here

Examples of org.ejml.simple.SimpleMatrix

    @Test
    public void fullTest() {

        for( int width = 1; width < 20; width += 2 ) {

            SimpleMatrix A = SimpleMatrix.wrap(RandomMatrices.createSymmetric(width,-1,1,rand));

            TridiagonalSimilarDecomposition<DenseMatrix64F> alg = createDecomposition();


            assertTrue(safeDecomposition(alg,A.getMatrix()));

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

            SimpleMatrix A_found = Q.mult(T).mult(Q.transpose());

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

Examples of org.ejml.simple.SimpleMatrix

            LUDecomposition<DenseMatrix64F> alg = create(i,i);
            assertTrue(alg.decompose(A));

            assertFalse(alg.isSingular());

            SimpleMatrix L = SimpleMatrix.wrap(alg.getLower(null));
            SimpleMatrix U = SimpleMatrix.wrap(alg.getUpper(null));
            SimpleMatrix P = SimpleMatrix.wrap(alg.getPivot(null));

            DenseMatrix64F A_found = P.transpose().mult(L).mult(U).getMatrix();
            assertTrue(MatrixFeatures.isIdentical(A_found,A,1e-8));
        }
    }
View Full Code Here

Examples of org.ejml.simple.SimpleMatrix

        LUDecomposition<DenseMatrix64F> alg = create(2,3);

        assertTrue(alg.decompose(A));
//        assertFalse(alg.isSingular());

        SimpleMatrix L = SimpleMatrix.wrap(alg.getLower(null));
        SimpleMatrix U = SimpleMatrix.wrap(alg.getUpper(null));
        SimpleMatrix P = SimpleMatrix.wrap(alg.getPivot(null));

        DenseMatrix64F A_found = P.mult(L).mult(U).getMatrix();

        assertTrue(MatrixFeatures.isIdentical(A_found,A,1e-8));
    }
View Full Code Here

Examples of org.ejml.simple.SimpleMatrix

        LUDecomposition<DenseMatrix64F> alg = create(3,2);

        assertTrue(alg.decompose(A));
//        assertFalse(alg.isSingular());

        SimpleMatrix L = SimpleMatrix.wrap(alg.getLower(null));
        SimpleMatrix U = SimpleMatrix.wrap(alg.getUpper(null));
        SimpleMatrix P = SimpleMatrix.wrap(alg.getPivot(null));

        DenseMatrix64F A_found = P.transpose().mult(L).mult(U).getMatrix();

        assertTrue(MatrixFeatures.isIdentical(A_found,A,1e-8));
    }
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.