cii-text-analysis/vendor/rubix/tensor
Jéremy Munsch f68d2ac333
premier poc
2026-02-11 08:24:04 +01:00
..
.github premier poc 2026-02-11 08:24:04 +01:00
benchmarks premier poc 2026-02-11 08:24:04 +01:00
docs premier poc 2026-02-11 08:24:04 +01:00
ext premier poc 2026-02-11 08:24:04 +01:00
lib/JAMA premier poc 2026-02-11 08:24:04 +01:00
optimizers premier poc 2026-02-11 08:24:04 +01:00
src premier poc 2026-02-11 08:24:04 +01:00
tensor premier poc 2026-02-11 08:24:04 +01:00
tests premier poc 2026-02-11 08:24:04 +01:00
.gitattributes premier poc 2026-02-11 08:24:04 +01:00
.gitignore premier poc 2026-02-11 08:24:04 +01:00
.php_cs.dist premier poc 2026-02-11 08:24:04 +01:00
build-ext premier poc 2026-02-11 08:24:04 +01:00
build-ext.bat premier poc 2026-02-11 08:24:04 +01:00
CHANGELOG.md premier poc 2026-02-11 08:24:04 +01:00
composer.json premier poc 2026-02-11 08:24:04 +01:00
config.json premier poc 2026-02-11 08:24:04 +01:00
CONTRIBUTING.md premier poc 2026-02-11 08:24:04 +01:00
LICENSE premier poc 2026-02-11 08:24:04 +01:00
package.xml premier poc 2026-02-11 08:24:04 +01:00
phpbench.json.dist premier poc 2026-02-11 08:24:04 +01:00
phpstan.neon premier poc 2026-02-11 08:24:04 +01:00
phpunit.xml premier poc 2026-02-11 08:24:04 +01:00
README.md premier poc 2026-02-11 08:24:04 +01:00

Tensor: Scientific Computing for PHP

PHP from Packagist Latest Stable Version Build Compile extension Downloads from Packagist GitHub

Tensor is a library and extension that provides objects for scientific computing in PHP. The multithreaded extension is especially suited for computing large sets of numbers. In some cases, the extension is 230X faster than the same operation in PHPland. Tensor is used by libraries such as Rubix ML to build and accelerate machine learning algorithms such as linear regression, dimensionality reduction, and neural networks.

Installation

Follow the instructions below to install either Tensor PHP or the Tensor extension.

Tensor PHP

Install Tensor PHP into your project with Composer:

$ composer require rubix/tensor

Tensor Extension

Install the Tensor extension via PECL:

$ pecl install tensor

Note: If both the library and extension are installed, the extension will take precedence.

Requirements

  • PHP 7.2 or above

Optional To Compile Extension

Manually Compiling the Extension

Clone the repository locally using Git:

$ git clone https://github.com/RubixML/Tensor

Make sure you have all the necessary build tools installed such as a C compiler and make tools. For example, on an Ubuntu linux system you can enter the following on the command line to install the necessary dependencies.

$ sudo apt-get install make gcc gfortran php-dev libopenblas-dev liblapacke-dev re2c build-essential

Then, change into the ext directory from the project root and run the following commands from the terminal. See this guide for more information on compiling PHP extensions with PHPize.

$ cd ./ext
$ phpize
$ ./configure
$ make
$ sudo make install

Finally, add the following line to your php.ini configuration to install the extension.

extension=tensor.so

To confirm that the extension is loaded in PHP, you can run the following command.

php -m | grep tensor

Performance Comparison

Tensor Performance MNIST

Tensor Performance Benchmarks

Funding

Rubix ML is funded by donations from the community. You can become a sponsor by making a contribution to one of our funding sources below.

Contributing

See CONTRIBUTING.md for guidelines.

License

The code is licensed MIT and the documentation is licensed CC BY-NC 4.0.