Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
com.googlecode.matrix-toolkits-java:mtj
Advanced tools
A comprehensive collection of matrix data structures, linear solvers, least squares methods, eigenvalue, and singular value decompositions.
MTJ is a high-performance library for developing linear algebra applications.
MTJ is based on BLAS and LAPACK for its dense and structured sparse computations, and on the Templates project for unstructured sparse operations.
MTJ uses the netlib-java
project as a backend,
which will automatically use machine-optimised natives, if they are available. Please read the netlib-java
documentation for the extra steps needed to ensure that you are getting the best performance for your system.
For more details on high performance linear algebra on the JVM, please watch my talk at Scala eXchange 2014 (follow along with high-res slides).
The java-matrix-benchmark clearly shows MTJ to be the most performant Java library for large matrices:
A more complete breakdown is available: MTJ with system optimised natives wins almost every benchmark.
We recommend common-math for small matrix requirements as it provides a large variety of mathematics features, and EJML if performance on small matrices is more important than features.
A variety of sparse matrix / vector storage classes are available:
CompColMatrix
CompDiagMatrix
CompRowMatrix
FlexCompColMatrix
FlexCompRowMatrix
UnitLowerCompRowMatrix
UpperCompRowMatrix
SparseVector
LinkedSparseMatrix
The LinkedSparseMatrix
storage type is a novel storage type developed under this project. It maintains two tail links, one for the next matrix element by row order and another by column order. Lookups are kept into each row and column, making multiplication and transpose multiplication very fast.
The following charts compare the LinkedSparseMatrix
against DenseMatrix
for increasing matrix size (n x n
) and number of non-zero elements, m
. Rainbow lines indicate m
varied from 10,000
to 100,000
. Solid lines are for dense matrix, dashed lines are the sparse matrix.
The following is time to initialise the matrix:
The following is the memory consumption:
The following is the time to perform a multiplication with a dense matrix and output into a dense matrix:
MTJ provides ARPACK for very large symmetric matrices in ArpackSym (see the example usage in ArpackSymTest). ARPACK solves an arbitrary number of eigenvalues / eigenvectors.
In addition, implementations of the netlib Templates are available in the no.uib.cipr.matrix.sparse
package.
Users may wish to look at Sparse Eigensolvers for Java for another solver.
This project was originally written by Bjørn-Ove Heimsund, who has taken a step back due to other commitments.
Releases are distributed on Maven central:
<dependency>
<groupId>com.googlecode.matrix-toolkits-java</groupId>
<artifactId>mtj</artifactId>
<version>1.0.2</version>
</dependency>
Unofficial single-jar builds may be available from java-matrix-benchmark
for laggards who don't have 5 minutes to learn Maven.
Snapshots may be distributed on Sonatype's Snapshot Repository (if you submit a pull request, a build will appear here when it is merged):
<dependency>
<groupId>com.googlecode.matrix-toolkits-java</groupId>
<artifactId>mtj</artifactId>
<version>1.0.3-SNAPSHOT</version>
</dependency>
Contributors are encouraged to fork this repository and issue pull requests. Contributors implicitly agree to assign an unrestricted licence to Sam Halliday, but retain the copyright of their code (this means we both have the freedom to update the licence for those contributions).
FAQs
A comprehensive collection of matrix data structures, linear solvers, least squares methods, eigenvalue, and singular value decompositions.
We found that com.googlecode.matrix-toolkits-java:mtj demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.