public static boolean isEquals( BlockMatrix64F A , BlockMatrix64F B ) { if( A.blockLength != B.blockLength ) return false; return MatrixFeatures.isEquals(A,B); }
public static boolean isEquals( BlockMatrix64F A , BlockMatrix64F B ) { if( A.blockLength != B.blockLength ) return false; return MatrixFeatures.isEquals(A,B); }
public static boolean isEquals( BlockMatrix64F A , BlockMatrix64F B ) { if( A.blockLength != B.blockLength ) return false; return MatrixFeatures.isEquals(A,B); }
public static boolean isEquals( BlockMatrix64F A , BlockMatrix64F B , double tol ) { if( A.blockLength != B.blockLength ) return false; return MatrixFeatures.isEquals(A,B,tol); }
public static boolean isEquals( BlockMatrix64F A , BlockMatrix64F B , double tol ) { if( A.blockLength != B.blockLength ) return false; return MatrixFeatures.isEquals(A,B,tol); }
public static boolean isEquals( BlockMatrix64F A , BlockMatrix64F B , double tol ) { if( A.blockLength != B.blockLength ) return false; return MatrixFeatures.isEquals(A,B,tol); }
private static void assertMatrixEquals(DenseMatrix64F expected, DenseMatrix64F actual, double epsilon) { assertTrue(assertErrorMessage(expected, actual), MatrixFeatures.isEquals(expected, actual, epsilon)); }
private static void assertMatrixEquals(DenseMatrix64F expected, DenseMatrix64F actual, double epsilon) { assertTrue(assertErrorMessage(expected, actual), MatrixFeatures.isEquals(expected, actual, epsilon)); }
private static void assertMatrixEquals(DenseMatrix64F expected, DenseMatrix64F actual, double epsilon) { assertTrue(assertErrorMessage(expected, actual), MatrixFeatures.isEquals(expected, actual, epsilon)); }
private void assertEquals(DenseMatrix64F expectedCovariance, DenseMatrix64F actualCovariance, double epsilon) { assertTrue(assertErrorMessage(expectedCovariance, actualCovariance), MatrixFeatures.isEquals(expectedCovariance, actualCovariance, epsilon)); }
private static void assertMatrixEquals(DenseMatrix64F expected, DenseMatrix64F actual, double epsilon) { assertTrue(assertErrorMessage(expected, actual), MatrixFeatures.isEquals(expected, actual, epsilon)); }
private static void assertEquals(DenseMatrix64F expected, DenseMatrix64F actual, double epsilon) { assertTrue(assertErrorMessage(expected, actual), MatrixFeatures.isEquals(expected, actual, epsilon)); }
private static void assertEquals(DenseMatrix64F expected, DenseMatrix64F actual, double epsilon) { assertTrue(assertErrorMessage(expected, actual), MatrixFeatures.isEquals(expected, actual, epsilon)); }
return isEquals(a,b);
@ContinuousIntegrationTest(estimatedDuration = 0.0) @Test(timeout = 30000) public void testScaleTranspose() throws Exception { Random random = new Random(165156L); for (int i = 0; i < 200; i++) { int numRows = RandomNumbers.nextInt(random, 1, 100); int numCols = RandomNumbers.nextInt(random, 1, 100); DenseMatrix64F randomMatrix = RandomMatrices.createRandom(numRows, numCols, 1.0, 100.0, random); double randomAlpha = RandomNumbers.nextDouble(random, 100.0); DenseMatrix64F expectedMatrix = new DenseMatrix64F(numCols, numRows); DenseMatrix64F actualMatrix = new DenseMatrix64F(numCols, numRows); CommonOps.transpose(randomMatrix, expectedMatrix); CommonOps.scale(randomAlpha, expectedMatrix); MatrixTools.scaleTranspose(randomAlpha, randomMatrix, actualMatrix); boolean areMatricesEqual = MatrixFeatures.isEquals(expectedMatrix, actualMatrix, 1.0e-10); assertTrue(areMatricesEqual); } }
@ContinuousIntegrationTest(estimatedDuration = 0.0) @Test(timeout = 30000) public void testRemoveRow() { Random random = new Random(3216516L); for (int i = 0; i < 20; i++) { int numRows = RandomNumbers.nextInt(random, 1, 100); int numCols = RandomNumbers.nextInt(random, 1, 100); DenseMatrix64F randomMatrix = RandomMatrices.createRandom(numRows, numCols, 1.0, 100.0, random); int indexOfRowToRemove = RandomNumbers.nextInt(random, 0, randomMatrix.getNumRows() - 1); DenseMatrix64F expectedMatrix = new DenseMatrix64F(numRows - 1, numCols); for (int rowIndex = 0; rowIndex < numRows - 1; rowIndex++) { for (int colIndex = 0; colIndex < numCols; colIndex++) { if (rowIndex >= indexOfRowToRemove) expectedMatrix.set(rowIndex, colIndex, randomMatrix.get(rowIndex + 1, colIndex)); else expectedMatrix.set(rowIndex, colIndex, randomMatrix.get(rowIndex, colIndex)); } } DenseMatrix64F matrixToTest = new DenseMatrix64F(randomMatrix); MatrixTools.removeRow(matrixToTest, indexOfRowToRemove); boolean areMatricesEqual = MatrixFeatures.isEquals(expectedMatrix, matrixToTest, 1.0e-10); assertTrue(areMatricesEqual); } }
@ContinuousIntegrationTest(estimatedDuration = 0.0) @Test(timeout = 30000) public void testConstrainedSimple() { int objectiveSize = 3; int solutionSize = 3; int constraintSize = 1; DenseMatrix64F a = new DenseMatrix64F(objectiveSize, solutionSize); CommonOps.setIdentity(a); DenseMatrix64F b = new DenseMatrix64F(objectiveSize, 1); b.zero(); DenseMatrix64F c = new DenseMatrix64F(constraintSize, solutionSize); CommonOps.setIdentity(c); DenseMatrix64F d = new DenseMatrix64F(constraintSize, 1); d.set(0, 0, -1.0); QuadraticProgram quadraticProgram = new QuadraticProgram(a, b, c, d); DenseMatrix64F initialGuess = new DenseMatrix64F(solutionSize, 1); initialGuess.set(0, 0, -10.0); initialGuess.set(1, 0, -10.0); initialGuess.set(2, 0, -10.0); ActiveSearchSolutionInfo solutionInfo = solve(quadraticProgram, initialGuess); assertTrue(solutionInfo.isConverged()); DenseMatrix64F expectedResult = new DenseMatrix64F(solutionSize, 1); expectedResult.set(0, 0, d.get(0, 0)); expectedResult.set(1, 0, 0.0); expectedResult.set(2, 0, 0.0); assertTrue(MatrixFeatures.isEquals(expectedResult, solutionInfo.getSolution(), 1e-12)); }