This is a Groovy library (that also works in Java) to make it easy to work with
a matrix (tabular i.e. 2-dimensional) data. Whenever you ḧave a structure like this
List<List<?>> (typically defined in
Groovy like this def myList = [ [1,2,3], [3.4, 7.12, 0.19] ]
) a Matrix or
a Grid can greatly enhance the experience of working with that data structure.
The Matrix project consist of the following modules:
- matrix-core The matrix-core is the heart of the matrix project. It contains the Matrix and Grid classes as well as several utility classes to do basic statistics (sum, mean, median, sd, variance, counts, frequency etc.) and to convert data into various shapes and formats See tests for more usage examples or the javadocs for more info.
- matrix-stats The stats library contains various statistical methods and tests (correlations, normalization, linear regression, t-test, etc.)
- matrix-datasets contains some common datasets used in R and Python such as mtcars, iris, diamonds, plantgrowth, toothgrowth etc.
- matrix-spreadsheet provides ways to import and export between a Matrix and an Excel or OpenOffice Calc spreadsheet
- matrix-csv provides a more advanced way to import and export between a Matrix and a CSV file (matrix-core has basic support for doing this built in)
- matrix-json provides ways to import and export between a Matrix and Json
- matrix-charts allows you to create charts in various formats (file, javafx) based on Matrix data.
- matrix-sql relational database interaction
- matrix-tablesaw interoperability between Matrix and the Tablesaw library
Matrix should work with any 4.x version of groovy. Binary builds can be downloaded from the Matrix project release page but if you use a build system that handles dependencies via maven central (gradle, maven ivy etc.) you can add your dependencies from there . The group name is se.alipsa.groovy. An example for matrix-core is as follows for Gradle
implementation 'se.alipsa.groovy:matrix-core:2.0.0'
...and the following for maven
<dependency>
<groupId>se.alipsa.groovy</groupId>
<artifactId>matrix-core</artifactId>
<version>2.0.0</version>
</dependency>
The jvm should be JDK 17 or higher.
For more information see the readme file in each subproject, the test classes and the Cookbook