PHPackages                             ghostjat/np - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ghostjat/np

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ghostjat/np
===========

Np (numphp) is numerical library with low memory footprint for php language. Suitable for large scale computing. php-8.0+ 64 bit is required!

0.0.1-alpha(4y ago)10321[4 issues](https://github.com/ghostjat/Np/issues)MITPHP

Since May 28Pushed 2y ago2 watchersCompare

[ Source](https://github.com/ghostjat/Np)[ Packagist](https://packagist.org/packages/ghostjat/np)[ Docs](https://github.com/ghostjat/Np)[ RSS](/packages/ghostjat-np/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (1)Versions (5)Used By (0)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/95c514c4f7aa441298867dc34820c4722d42ec2095c0186c51ac163fa7e028b4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f67686f73746a61742f4e702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/ghostjat/Np/?branch=main)[![Packagist PHP Version Support](https://camo.githubusercontent.com/23015a8a8769d69bfd2130adba3dc0dcfa4d8c845c164f25c529234aa9e16c00/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f67686f73746a61742f4e70)](https://camo.githubusercontent.com/23015a8a8769d69bfd2130adba3dc0dcfa4d8c845c164f25c529234aa9e16c00/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f67686f73746a61742f4e70)[![Build Status](https://camo.githubusercontent.com/03df4a4ce64261c5dbb1e8eae8ae27485e2c904ec30ebd1d32414c15ad5367d0/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f67686f73746a61742f4e702f6261646765732f6275696c642e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/ghostjat/Np/build-status/main)[![Code Intelligence Status](https://camo.githubusercontent.com/f612ab31bc9080472724034f2049de36f914e8274e165a1ab2d0d658b2f88b32/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f67686f73746a61742f4e702f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d61696e)](https://scrutinizer-ci.com/code-intelligence)[![GitHub contributors](https://camo.githubusercontent.com/fe0dff810b7a40f5beebf3d6dcc8bbabc5c8f8b2533b4af7a3c2941afe72dde4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f67686f73746a61742f4e70)](https://camo.githubusercontent.com/fe0dff810b7a40f5beebf3d6dcc8bbabc5c8f8b2533b4af7a3c2941afe72dde4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f67686f73746a61742f4e70)[![GitHub commit activity](https://camo.githubusercontent.com/e4b06dd945a27276213ab74c3e24f2c7e34646e921532c5171fa963040a346ec/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d69742d61637469766974792f6d2f67686f73746a61742f4e70)](https://camo.githubusercontent.com/e4b06dd945a27276213ab74c3e24f2c7e34646e921532c5171fa963040a346ec/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d69742d61637469766974792f6d2f67686f73746a61742f4e70)[![GitHub last commit](https://camo.githubusercontent.com/941a54441828a6119967724f671b394256934b74a2a9785910489c763efc5126/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f67686f73746a61742f4e70)](https://camo.githubusercontent.com/941a54441828a6119967724f671b394256934b74a2a9785910489c763efc5126/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f67686f73746a61742f4e70)[![Packagist Version](https://camo.githubusercontent.com/0b013f5d8400ca6f7168145833278f0a064615a15c5b03cd8da469dec319285e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f67686f73746a61742f4e70)](https://camo.githubusercontent.com/0b013f5d8400ca6f7168145833278f0a064615a15c5b03cd8da469dec319285e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f67686f73746a61742f4e70)[![GitHub code size in bytes](https://camo.githubusercontent.com/94ae22207ffcfacc2d5a705dc85c288b3cd694f5f57f5970fdb2e056c81845c4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f67686f73746a61742f4e70)](https://camo.githubusercontent.com/94ae22207ffcfacc2d5a705dc85c288b3cd694f5f57f5970fdb2e056c81845c4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f67686f73746a61742f4e70)[![Lines of code](https://camo.githubusercontent.com/fa6b9ca3bc8202e7f1345c64eae4719ec3b2ec8ffdd6f2c23d068a445c193566/68747470733a2f2f696d672e736869656c64732e696f2f746f6b65692f6c696e65732f6769746875622f67686f73746a61742f4e70)](https://camo.githubusercontent.com/fa6b9ca3bc8202e7f1345c64eae4719ec3b2ec8ffdd6f2c23d068a445c193566/68747470733a2f2f696d672e736869656c64732e696f2f746f6b65692f6c696e65732f6769746875622f67686f73746a61742f4e70)[![GitHub top language](https://camo.githubusercontent.com/b8966b2d1da66daf85b3511e5776f5b40322441f851d7e4a74e71a29173db568/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f67686f73746a61742f4e70)](https://camo.githubusercontent.com/b8966b2d1da66daf85b3511e5776f5b40322441f851d7e4a74e71a29173db568/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f746f702f67686f73746a61742f4e70)

[![Np](https://github.com/ghostjat/numphp/raw/main/np.png)](https://github.com/ghostjat/numphp/blob/main/np.png)

Description
-----------

[](#description)

---

Lite, Fast &amp; Memory Efficient *Mathematical PHP library for scientific computing*

Np(numphp) is a library that provides objects for computing large sets of numbers in [PHP](https://php.net).

Installation
------------

[](#installation)

Install [Np](https://packagist.org/packages/ghostjat/np) into your project with [Composer](https://getcomposer.org/):

```
$ composer require ghostjat/np
```

\##Sample Code

```
require __DIR__ . '/../vendor/autoload.php';
use Np\matrix;

$ta = matrix::randn(1000, 1000);
$tb = matrix::randn(1000, 1000); // to generate random 2d matrix
$ta->dot($tb);                  // do a dot operation on given matrix
$ta->getMemory();              // get memory use
$ta->time();                  // get time
/**
 * 7.7mb
 * Time-Consumed:- 0.18390893936157
 */
```

*Synopsis*
----------

[](#synopsis)

WARNING:
This module is in its early stages and should be considered a Work in Progress.The interface is not final and may change in the future.

*Requirements*
--------------

[](#requirements)

- [PHP](https://php.net) 8+ 64bit with ffi &amp; #libblas, #liblapacke

Make sure you have all the necessary tools installed such as FFI, libblas, liblapacke.

*Performance*
-------------

[](#performance)

System Conf:- Intel(R) Core(TM) i3-2370M CPU @ 2.40GHz 64bit Memory:- 8GB php:- 8.0.5 64bit

*Current Benchmarks of this library*
------------------------------------

[](#current-benchmarks-of-this-library)

[![Benckmark](https://github.com/ghostjat/numphp/raw/main/npbm.png)](https://github.com/ghostjat/numphp/blob/main/npbm.png)

Data Size :- \[500x500\] Revolutions:- 5 Iterations:- 5

subjectmem\_peakbestmodemeanworststdevsum3.606mb0.014s0.014s0.015s0.015s0.000smultiply8.589mb0.070s0.071s0.071s0.071s0.000slu4.648mb0.064s0.065s0.065s0.068s0.001seign2.801mb0.085s0.086s0.086s0.088s0.001scholesky1.621mb0.001s0.001s0.001s0.001s0.000ssvd3.706mb0.126s0.126s0.127s0.133s0.002snormL21.621mb0.003s0.003s0.003s0.003s0.000sPinverse4.903mb0.156s0.156s0.158s0.163s0.003sinverse1.819mb0.016s0.016s0.016s0.017s0.000snormL11.621mb0.001s0.001s0.001s0.001s0.000sdotMatrix3.769mb0.006s0.006s0.006s0.006s0.000sdet4.662mb0.066s0.066s0.067s0.067s0.000srref1.529mb9.227s9.271s9.309s9.427s0.072sref1.818mb0.007s0.008s0.008s0.008s0.000sclip8.516mb0.073s0.076s0.075s0.077s0.002sclipUpper8.516mb0.055s0.056s0.057s0.059s0.002sclipLower8.516mb0.055s0.058s0.057s0.059s0.002sjoinBelow4.517mb0.027s0.027s0.027s0.028s0.000stranspose8.504mb0.057s0.057s0.058s0.059s0.001sjoinLeft4.511mb0.025s0.025s0.026s0.027s0.001spoisson1.590mb0.029s0.029s0.029s0.030s0.000sgaussian20.203mb0.056s0.056s0.056s0.056s0.000srandn1.528mb0.017s0.017s0.017s0.017s0.000suniform1.528mb0.021s0.021s0.021s0.022s0.000smultiply4.507mb0.042s0.042s0.043s0.045s0.001sPrevious BenchMark

benchmarksubjectsetrevsitsmem\_peakmoderstdeveignBencheign0152.699mb0.309s±4.51%svdBenchsvd0153.604mb0.148s±3.60%poissonMatrixBenchpoisson01511.738mb0.105s±7.07%gaussianMatrixBenchgaussian01511.738mb0.112s±17.12%randMatrixBenchrandn0151.429mb0.048s±2.37%uniformMatrixBenchuniform0151.429mb0.063s±8.16%matrixTransposeBenchtranspose0158.431mb0.120s±1.32%rrefBenchrref0151.501mb28.513s±1.90%refBenchref0151.731mb0.023s±7.24%sumMatrixBenchsum0152.434mb0.051s±3.59%matrixPseudoInverseBenchinverse0154.775mb0.222s±13.76%matrixInverseBenchinverse0151.731mb0.032s±127.50%dotMatrixBenchdotMatrix0153.656mb0.013s±27.94%matrixL1NormBenchnormL101101.525mb0.001s±0.80%matrixL2NormBenchnormL201101.525mb0.003s±1.63%License
-------

[](#license)

The code is licensed [MIT](LICENSE) and the documentation is licensed [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/).

Author
------

[](#author)

Shubham Chaudhary

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance12

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1800d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/64d55c44db241b5edf53d7f95b9209822731ed613173055ad2535f03137f119c?d=identicon)[ghostjat](/maintainers/ghostjat)

---

Top Contributors

[![ghostjat](https://avatars.githubusercontent.com/u/18235933?v=4)](https://github.com/ghostjat "ghostjat (86 commits)")[![imVedic](https://avatars.githubusercontent.com/u/84182365?v=4)](https://github.com/imVedic "imVedic (2 commits)")

---

Tags

blascalculuscomputingffilapacklibblaslinear-algebralitemathmatrixmemorynpnumphpphpphp-ffiphp8scientific-computingstatsticstrignometryvectorphpvectormatrixmatharithmeticRNGstatisticslinear algebracomputingtensorcomputationtrigonometryengineeringdecompositionscientific computingblaslapackreductionnpnormsrandom number generationstatsticsnumphp

### Embed Badge

![Health badge](/badges/ghostjat-np/health.svg)

```
[![Health](https://phpackages.com/badges/ghostjat-np/health.svg)](https://phpackages.com/packages/ghostjat-np)
```

###  Alternatives

[rubix/tensor

A library and extension that provides objects for scientific computing in PHP.

2751.4M5](/packages/rubix-tensor)[markrogoyski/math-php

Math Library for PHP. Features descriptive statistics and regressions; Continuous and discrete probability distributions; Linear algebra with matrices and vectors, Numerical analysis; special mathematical functions; Algebra

2.4k7.1M40](/packages/markrogoyski-math-php)[sciphp/numphp

PHP library for scientific computing.

6618.9k](/packages/sciphp-numphp)[savvot/random

Deterministic pseudo-random generators library with dozens of useful functions and several sources of randomness

21243.7k5](/packages/savvot-random)[rindow/rindow-math-matrix

The fundamental package for scientific matrix operation

13281.5k7](/packages/rindow-rindow-math-matrix)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
