import org.jblas.DoubleMatrix;
public class JblasExample {
public static void main(String[] args) {
DoubleMatrix matrix1 = new DoubleMatrix(new double[][]{{1, 2}, {3, 4}});
DoubleMatrix matrix2 = new DoubleMatrix(new double[][]{{5, 6}, {7, 8}});
DoubleMatrix sum = matrix1.add(matrix2);
System.out.println("Sum of matrices:
" + sum);
DoubleMatrix product = matrix1.mmul(matrix2);
System.out.println("Product of matrices:
" + product);
}
}
<dependency>
<groupId>org.jblas</groupId>
<artifactId>jblas</artifactId>
<version>1.2.4</version>
</dependency>