Search in sources :

Example 46 with DMatrixRMaj

use of org.ejml.data.DMatrixRMaj in project narchy by automenta.

the class EJMLVsPython method testAssignAllLessThan.

@Test
public void testAssignAllLessThan() throws IOException {
    double[][] Xin = MatrixUtils.simpleRead2DMatrix(new StringReader(s), " ");
    DMatrixRMaj X = new DMatrixRMaj(Xin);
    EjmlOps.assignAllLessThan(X, 3, -1);
    double[][] pylt = { { -1., -1., 3., 4., 5. }, { 6., 7., 8., 9., 5. }, { 3., 4., -1., 7., 3. }, { 7., 3., 6., 7., 3. }, { -1., 4., 7., 8., 9. }, { 3., 4., 3., 3., 5. }, { 8., 6., 9., 4., -1. } };
    assertEqualDoubleArrays(pylt, EjmlOps.extractDoubleArray(X), epsilon);
}
Also used : StringReader(java.io.StringReader) DMatrixRMaj(org.ejml.data.DMatrixRMaj) Test(org.junit.jupiter.api.Test)

Example 47 with DMatrixRMaj

use of org.ejml.data.DMatrixRMaj in project narchy by automenta.

the class EJMLVsPython method testTile.

@Test
public void testTile() throws IOException {
    double[][] Xin = MatrixUtils.simpleRead2DMatrix(new StringReader(s), " ");
    double[][] PQrowi = MatrixOps.copyCols(Xin, 4);
    DMatrixRMaj tile = new DMatrixRMaj(PQrowi);
    DMatrixRMaj X = EjmlOps.tile(tile, 3, 1);
    double[][] pytile1 = { { 5., 5., 3., 3., 9., 5., 2. }, { 5., 5., 3., 3., 9., 5., 2. }, { 5., 5., 3., 3., 9., 5., 2. } };
    assertEqualDoubleArrays(pytile1, EjmlOps.extractDoubleArray(X), epsilon);
    X = EjmlOps.tile(tile, 3, 2);
    double[][] pytile2 = { { 5., 5., 3., 3., 9., 5., 2., 5., 5., 3., 3., 9., 5., 2. }, { 5., 5., 3., 3., 9., 5., 2., 5., 5., 3., 3., 9., 5., 2. }, { 5., 5., 3., 3., 9., 5., 2., 5., 5., 3., 3., 9., 5., 2. } };
    assertEqualDoubleArrays(pytile2, EjmlOps.extractDoubleArray(X), epsilon);
}
Also used : StringReader(java.io.StringReader) DMatrixRMaj(org.ejml.data.DMatrixRMaj) Test(org.junit.jupiter.api.Test)

Example 48 with DMatrixRMaj

use of org.ejml.data.DMatrixRMaj in project narchy by automenta.

the class EJMLVsPython method testScalarInverseVector.

@Test
public void testScalarInverseVector() throws IOException {
    double[][] Xin = MatrixUtils.simpleRead2DMatrix(new StringReader(s), " ");
    DMatrixRMaj X = new DMatrixRMaj(Xin);
    double[] pyinv = { 0.14285714, 0.33333333, 0.16666667, 0.14285714, 0.33333333 };
    DMatrixRMaj row = extract(X, 3, 4, 0, 5);
    divide(1.0, row);
    double[] inv = EjmlOps.extractDoubleArray(row)[0];
    assertArrayEquals(inv, inv, epsilon);
}
Also used : StringReader(java.io.StringReader) DMatrixRMaj(org.ejml.data.DMatrixRMaj) Test(org.junit.jupiter.api.Test)

Example 49 with DMatrixRMaj

use of org.ejml.data.DMatrixRMaj in project narchy by automenta.

the class EJMLVsPython method testScalarMultiply.

@Test
public void testScalarMultiply() throws IOException {
    double[][] Xin = MatrixUtils.simpleRead2DMatrix(new StringReader(s), " ");
    DMatrixRMaj X = new DMatrixRMaj(Xin);
    double[][] pysm = { { 1., 4., 9., 16., 25. }, { 36., 49., 64., 81., 25. }, { 9., 16., 4., 49., 9. }, { 49., 9., 36., 49., 9. }, { 4., 16., 49., 64., 81. }, { 9., 16., 9., 9., 25. }, { 64., 36., 81., 16., 4. } };
    elementMult(X, X);
    double[][] sm = EjmlOps.extractDoubleArray(X);
    assertEqualDoubleArrays(pysm, sm, epsilon);
}
Also used : StringReader(java.io.StringReader) DMatrixRMaj(org.ejml.data.DMatrixRMaj) Test(org.junit.jupiter.api.Test)

Example 50 with DMatrixRMaj

use of org.ejml.data.DMatrixRMaj in project narchy by automenta.

the class EJMLVsPython method testMinus.

@Test
public void testMinus() throws IOException {
    double[][] Xin = MatrixUtils.simpleRead2DMatrix(new StringReader(s), " ");
    DMatrixRMaj X = new DMatrixRMaj(Xin);
    DMatrixRMaj mins = new DMatrixRMaj(X.numRows, X.numCols);
    double[][] pymin = { { 0., 0., 0., 0., 0. }, { 0., 0., 0., 0., 0. }, { 0., 0., 0., 0., 0. }, { 0., 0., 0., 0., 0. }, { 0., 0., 0., 0., 0. }, { 0., 0., 0., 0., 0. }, { 0., 0., 0., 0., 0. } };
    subtract(X, X, mins);
    double[][] min = EjmlOps.extractDoubleArray(mins);
    assertEqualDoubleArrays(pymin, min, epsilon);
}
Also used : StringReader(java.io.StringReader) DMatrixRMaj(org.ejml.data.DMatrixRMaj) Test(org.junit.jupiter.api.Test)

Aggregations

DMatrixRMaj (org.ejml.data.DMatrixRMaj)454 Test (org.junit.jupiter.api.Test)210 Se3_F64 (georegression.struct.se.Se3_F64)107 Point2D_F64 (georegression.struct.point.Point2D_F64)87 Point3D_F64 (georegression.struct.point.Point3D_F64)68 ArrayList (java.util.ArrayList)55 Vector3D_F64 (georegression.struct.point.Vector3D_F64)54 AssociatedPair (boofcv.struct.geo.AssociatedPair)38 CameraPinhole (boofcv.struct.calib.CameraPinhole)32 Equation (org.ejml.equation.Equation)29 UtilPoint3D_F64 (georegression.geometry.UtilPoint3D_F64)25 Point4D_F64 (georegression.struct.point.Point4D_F64)19 StringReader (java.io.StringReader)16 Test (org.junit.Test)15 AssociatedTriple (boofcv.struct.geo.AssociatedTriple)12 TrifocalTensor (boofcv.struct.geo.TrifocalTensor)11 RectifyCalibrated (boofcv.alg.geo.rectify.RectifyCalibrated)10 CameraPinholeBrown (boofcv.struct.calib.CameraPinholeBrown)10 BufferedImage (java.awt.image.BufferedImage)10 SceneStructureProjective (boofcv.abst.geo.bundle.SceneStructureProjective)9