sebiniemann / armadillojava Goto Github PK
View Code? Open in Web Editor NEWPure Java-based linear algebra library
Home Page: armadillojava.org
Pure Java-based linear algebra library
Home Page: armadillojava.org
The following methods are missing any documentation:
arma.Op is missing any documentation.
Add guide for eclipse, including a XML-definition of the formatter and error settings.
The project is currently missing test cases for matrix-valued element-wise functions, which is split in trigonometric and miscellaneous functions.
Both cases seem to be well parameterisable but clearly with some differences. A blank test class can already be found at test/Arma/arma/TestMatrixValuedElementWiseFunctions.java
, which should be split accordingly into to separate test classes, one for trigonometric and one for miscellaneous functions.
My suggestion would be to split it into test/Arma/arma/TestMatrixValuedElementWiseFunctionsTrigonometric.java
and test/Arma/arma/TestMatrixValuedElementWiseFunctionsMiscellaneous.java
(quite the long names :D).
Tasks:
test/Arma/arma/TestMatrixValuedElementWiseFunctionsTrigonometric.java
test/Arma/arma/TestMatrixValuedElementWiseFunctionsMiscellaneous.java
For the test data, I would like to check the following values with positive and negative sign:
The 38 test values for the trigonometric functions should be arranged in a non-sqaure (2, 19)-matrix and the 46 test values for the miscellaneous functions in a non-sqaure (2, 23)-matrix.
An example of a parameterised test class for the trigonometric functions:
@RunWith(Parameterized.class)
public class TestMatrixValuedElementWiseFunctionsTrigonometric {
@Parameters
public static Collection<Object[]> getTestData() {
Collection<Object[]> matrices = new ArrayList<Object[]>();
matrices.add(new Object[]{new Mat(new double[][]{
{0, 1, 2, Datum.eps, Datum.inf, 1/12*Datum.pi, 1/10*Datum.pi, 1/8*Datum.pi, 1/6*Datum.pi, 1/4*Datum.pi, 1/2*Datum.pi, Datum.pi, 3/2*Datum.pi, 2*Datum.pi, 3*Datum.pi, 4*Datum.pi, 5*Datum.pi, 10*Datum.pi, 100*Datum.pi},
{-0, -1, -2, -Datum.eps, -Datum.inf, -1/12*Datum.pi, -1/10*Datum.pi, -1/8*Datum.pi, -1/6*Datum.pi, -1/4*Datum.pi, -1/2*Datum.pi, -Datum.pi, -3/2*Datum.pi, -2*Datum.pi, -3*Datum.pi, -4*Datum.pi, -5*Datum.pi, -10*Datum.pi, -100*Datum.pi}
})});
return matrices;
}
@Parameter
public Mat _testData;
/* some tests */
}
Tasks continued:
The expected results of these tests should be pre-calculated and saved to compare always with the same pre-calculated values.
An example for the generation of pre-calculated expected results with native java functions:
public class TestExpectedValues {
public static void main(String[] args) throws FileNotFoundException {
testMatrixValuedElementWiseFunctionsTrigonometric();
}
protected static void testMatrixValuedElementWiseFunctionsTrigonometric() throws FileNotFoundException {
Mat testData = (Mat) TestMatrixValuedElementWiseFunctions.getTestData().iterator().next()[0];
Mat expected = new Mat(testData.n_rows, testData.n_cols);
for(int n = 0; n < testData.n_elem; n++) {
expected.at(n, Op.EQUAL, Math.sqrt(testData.at(n)));
}
expected.save("test/data/Arma/TestMatrixValuedElementWiseFunctions/Miscellaneous.sqrt.mat");
/* generation of other expected results for the same parameterised test class */
}
/* generation of other expected results for another parameterised test class */
}
The example code given above should be placed under test/util/arma/TestExpectedValues.java
Tasks continued:
Continued example of the actual test case:
@Test
public void testSqrt() {
Mat expected = new Mat();
expected.load("test/data/Arma/TestMatrixValuedElementWiseFunctions/Miscellaneous.sqrt.mat");
Mat actual = Arma.sqrt(_testData);
for(int n = 0; n < _testData.n_elem; n++) {
assertEquals(expected.at(n), actual.at(n), TestUtil.NUMERIC_TOLERANCE);
}
}
Tasks continued:
The following methods are missing any documentation:
Using .at(n) requires a conversion of the index n between a major-major-ordered context and a column-major-ordered context.
However, this could completely be skipped by directly using .get(n)
Instead of simple returning find() with switched parameters ...
public static Mat find(double a, Op operation, Mat b) {
return find(b, operation, a);
}
... the operation needs also to be switch if neither Op.EQUAL nor Op.NOT_EQUAL was requested.
Armadillo's Mat is stored by column-major-ordering, while EJML's DenseMatrix64F is stored by row-major-ordering resulting in unexpected results by traversing the one-dimensional view of Mat.at(n).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.