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.
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 ]]
Random values in a given shape.
SciPhp Manual
Return random integers from low (inclusive) to high (exclusive).
Return a sample (or samples) from the “standard normal” distribution.
Random generator Functions
np is licensed under the MIT License.
* You're right! SciPhp stands for Scientific PHP.