This repository has been archived on 2020-06-07. You can view files and clone it, but cannot push or open issues or pull requests.
php-armadillo/README.md

45 lines
2.1 KiB
Markdown

# php-armadillo
[![Travis-CI](https://travis-ci.com/CismonX/php-armadillo.svg?branch=master)](https://travis-ci.com/CismonX/php-armadillo)
[![Codecov](https://codecov.io/gh/CismonX/php-armadillo/branch/master/graphs/badge.svg)](https://codecov.io/gh/CismonX/php-armadillo)
[![MIT license](https://img.shields.io/badge/licence-MIT-blue.svg)](https://opensource.org/licenses/MIT)
PHP bindings for [Armadillo](http://arma.sourceforge.net/).
## 1. Introduction
This extension aims at providing a high-performance and easy-to-use native linear algebra library for PHP, which contains PHP bindings for major functionalities of the Armadillo library.
This extension is currently **under development**. Many funtionalities are not yet implemented, or otherwise may change greatly in the future.
## 2. Requirements
| Dependency | Requirements |
| --- | --- |
| Operating system | Unix-like (Linux, macOS, ...) |
| PHP | version 7.1 and above |
| C++ compiler | has C++17 support (gcc 7, clang 5, ...) |
| Armadillo | latest stable [release](http://arma.sourceforge.net/download.html) |
## 3. Documentation
The documentation for php-armadillo is **coming soon**. Before that, the following items may help you understand how to use this extension.
* [API documentation for Armadillo](http://arma.sourceforge.net/docs.html)
* [Stubs](https://github.com/CismonX/php-armadillo/tree/master/stubs) (can be used as IDE helper)
## 4. Examples
Here is a simple example for using php-armadillo.
```PHP
// Create a 3x3 dense matrix with random complex numbers as elements.
$mat = Arma\CxDMat::init(3, 3, Arma\Fill::RANDN);
// Print the matrix to STDOUT.
$mat->print();
// Set the value of element at row 2 col 2 to 1.0+j2.0.
$mat->at(1, 1)->setTo(Arma\cx_double(1., 2.));
// Calculate the matrix inverse and save to file in HDF5 format.
$mat->i()->save('mat.hdf5', Arma\FileType::HDF5_BINARY);
```