sciphp/numphp

PHP library for scientific computing.

Maintainers

Package info

github.com/sciphp/numphp

pkg:composer/sciphp/numphp

Fund package maintenance!

landrok

Ko Fi

Statistics

Installs: 17 953

Dependents: 0

Suggesters: 0

Stars: 66

Open Issues: 1

0.4.0 2020-10-14 19:37 UTC

This package is auto-updated.

Last update: 2026-02-21 17:55:13 UTC


README

NumPhp is a port of the famous NumPy (Python) package in PHP language.

Table of contents

Requirements

NumPhp supports PHP 7.2, 7.3 7.4 and 8.0.

Install

composer require sciphp/numphp

Basic usage

use SciPhp\NumPhp as np;

$m = np::ar(
  [[ 1, 0, 0],
   [ 0, 1, 0],
   [ 0, 0, 1]]
)->dot(42);

echo "m.42 =\n$m";

will output:

m.42 =
[[ 42,  0,  0 ],
 [  0, 42,  0 ],
 [  0,  0, 42 ]]

Documentation

NdArray attributes

NdArray methods

NumPhp methods

In the complete documentation, you will find all implemented stuff including some Linear Algebra methods like matrix norms and Cholesky transformation.

Contributing

Feel free to open issues and make PR. Contributions are welcome.

If you find a mistake or think an example is missing in the documentation, it's hosted on numphp-doc repository.