diff --git a/libraries-2/pom.xml b/libraries-2/pom.xml
index aca47f957d..bcb4f51bc2 100644
--- a/libraries-2/pom.xml
+++ b/libraries-2/pom.xml
@@ -55,6 +55,11 @@
ejml-all
${ejml.version}
+
+ org.nd4j
+ nd4j-native
+ ${nd4j.version}
+
colt
colt
@@ -124,7 +129,8 @@
3.17.2
4.4.0
2.1.4.RELEASE
- 0.37.1
+ 0.38
+ 1.0.0-beta4
1.2.0
0.6.0
diff --git a/libraries-2/src/test/java/com/baeldung/nd4j/INDArrayUnitTest.java b/libraries-2/src/test/java/com/baeldung/nd4j/INDArrayUnitTest.java
new file mode 100644
index 0000000000..a09eef9a57
--- /dev/null
+++ b/libraries-2/src/test/java/com/baeldung/nd4j/INDArrayUnitTest.java
@@ -0,0 +1,40 @@
+package com.baeldung.nd4j;
+
+import org.junit.jupiter.api.Test;
+import org.nd4j.linalg.api.ndarray.INDArray;
+import org.nd4j.linalg.factory.Nd4j;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class INDArrayUnitTest {
+
+ @Test
+ void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() {
+ INDArray firstMatrix = Nd4j.create(
+ new double[][]{
+ new double[]{1d, 5d},
+ new double[]{2d, 3d},
+ new double[]{1d, 7d}
+ }
+ );
+
+ INDArray secondMatrix = Nd4j.create(
+ new double[][] {
+ new double[] {1d, 2d, 3d, 7d},
+ new double[] {5d, 2d, 8d, 1d}
+ }
+ );
+
+ INDArray expected = Nd4j.create(
+ new double[][] {
+ new double[] {26d, 12d, 43d, 12d},
+ new double[] {17d, 10d, 30d, 17d},
+ new double[] {36d, 16d, 59d, 14d}
+ }
+ );
+
+ INDArray actual = firstMatrix.mmul(secondMatrix);
+
+ assertThat(actual).isEqualTo(expected);
+ }
+}