Skip to content

API Reference ​

Complete reference for all NDArray classes and methods.

Core ​

Array Manipulation ​

Mathematical Operations ​

Global functions ​

  • Global functions — Full list, import examples, and links back to each topic page.

Other ​

Quick Reference ​

Most Common Methods ​

Creation:

  • NDArray::array() - From PHP array
  • NDArray::zeros() - Array of zeros
  • NDArray::ones() - Array of ones
  • NDArray::random() - Random values

Properties:

  • shape(), shape(?int $axis) - Full shape list, or length of one axis (-1 = last)
  • dtype() - Get data type
  • size() - Total elements

Math:

  • add(), subtract(), multiply(), divide()
  • sum(), mean(), std(), min(), max()

Shape:

  • reshape(), transpose(), flatten()
  • slice() - Extract subarrays

Global functions ​

Most operations from the method reference are also available as functions under PhpMlKit\NDArray (and in the Linalg, Fft, and Windows sub-namespaces). See the exhaustive global functions page.

Next Steps ​

Released under the MIT License.