Skip to content

Alipsa/matrix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Matrix

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:

  1. 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.
  2. matrix-stats The stats library contains various statistical methods and tests (correlations, normalization, linear regression, t-test, etc.)
  3. matrix-datasets contains some common datasets used in R and Python such as mtcars, iris, diamonds, plantgrowth, toothgrowth etc.
  4. matrix-spreadsheet provides ways to import and export between a Matrix and an Excel or OpenOffice Calc spreadsheet
  5. matrix-csv provides a more advanced way to import and export between a Matrix and a CSV file using commons-csv(matrix-core has basic support for doing this built in)
  6. matrix-json provides ways to import and export between a Matrix and Json
  7. matrix-xcharts allows you to create charts in various formats (file, svg, swing) based on Matrix data and the XCharts library.
  8. matrix-sql relational database interaction
  9. matrix-bom Bill of materials for simpler dependency management.
  10. matrix-parquet provides ways to import and export between Matrix and Parquet. Experimental
  11. matrix-bigquery provides ways to import and export between Matrix and Google Big Query. Experimental
  12. matrix-charts allows you to create charts in various formats (file, javafx, svg) based on Matrix data. Experimental
  13. matrix-tablesaw interoperability between Matrix and the Tablesaw library. Experimental

Setup

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.matrix. The version numbers of the matrix modules does not align with each other so a way to handle this in a simpler way is to use the bom file.

An example for matrix-core is as follows for Gradle

implementation(platform( 'se.alipsa.matrix:matrix-bom:2.2.0'))
implementation('se.alipsa.matrix:matrix-core')

...or the following for maven

<project>
   ...
   <dependencyManagement>
      <dependencies>
         <dependency>
            <groupId>se.alipsa.matrix</groupId>
            <artifactId>matrix-bom</artifactId>
            <version>2.2.0</version>
            <type>pom</type>
            <scope>import</scope>
         </dependency>
      </dependencies>
   </dependencyManagement>
   <dependencies>
      <dependency>
         <groupId>se.alipsa.matrix</groupId>
         <artifactId>matrix-core</artifactId>
      </dependency>
   </dependencies>
   ...
</project>

The jvm should be JDK 21 or higher.

For more information see the the tutorial and the readme file and test classes in each subproject.