What is SciPhp?

SciPhp * is an organization that provides PHP tools for matrix computation.

The main tool, SciPhp\NumPhp alias np, is largely inspirated by NumPy, a Python scientific library.

With np, you can easily work with matrices.

Example

use SciPhp\NumPhp as np;

// Load a matrix from a CSV file
$m np::loadtxt('test/data.csv');

// Construct a Vandermonde matrix
$n np::diagonal($m)->vander();

// r=m.n 
$r $m->dot($n);

echo 
"m\n$m""n\n$n""r\n$r";
m
[[7     0.27  0.36]
 [6.3   0.3   0.34]
 [8.1   0.28  0.4 ]]
n
[[49    7     1   ]
 [0.09  0.3   1   ]
 [0.16  0.4   1   ]]
r
[[343.0819  49.225    7.63    ]
 [308.7814  44.326    6.94    ]
 [396.9892  56.944    8.78    ]]

Getting started

Contribute

Last updated

License

np is licensed under the MIT License.


* You're right! SciPhp stands for Scientific PHP.