Appendix E. Using the ND4J API

ND4J is a scientific computing library for the Java Virtual Machine (JVM). It is designed to run fast in production environments. Here are its main features:

  • Versatile n-dimensional array object
  • Multiplatform functionality including graphics processing units (GPUs)
  • Linear algebra and signal processing functions

ND4S is the Scala version of ND4J.

A usability gap has separated Java, Scala, and Clojure programmers from the most powerful tools in data analysis, like NumPy or Matlab. Libraries like Breeze don’t support n-dimensional arrays, or tensors, which are necessary for deep learning and other tasks. ND4J and ND4S are used by national laboratories for tasks such as climatic modeling, which require computationally intensive simulations.

ND4J brings the intuitive scientific computing tools of the Python community to the JVM in an open source, distributed, and GPU-enabled library. In structure, it is similar to SLF4J. ND4J gives engineers in production environments an easy way to port their algorithms and interface with other libraries in the Java and Scala ecosystems.

The Complete ND4J User Guide Online

ND4J supports many more operations than are listed in this appendix. For the complete ND4J User Guide, go to

The Complete ND4J API Javadoc

For a complete resource on the ND4J API, check out Javadoc at

Design and Basic Usage

ND4J is designed to run in many places and integrates with today’s ...

Get Deep Learning now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.