PHP code example of rindow / rindow-matlib-ffi
1. Go to this page and download the library: Download rindow/rindow-matlib-ffi library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rindow / rindow-matlib-ffi example snippets
Interop\Polite\Math\Matrix\NDArray;
use Rindow\Matlib\FFI\MatlibFactory;
use Rindow\Math\Buffer\FFI\BufferFactory;
$factory = new MatlibFactory();
$math = $factory->Math();
$hostBufferFactory = new BufferFactory();
$NWITEMS = 64;
$x = $hostBufferFactory->Buffer(
$NWITEMS,NDArray::float32
);
for($i=0;$i<$NWITEMS;$i++) {
$x[$i] = $i;
}
$n = count($x);
$offsetX = 0;
$incX = 1;
$sum = $math->sum($n,$x,$offsetX,$incX);
var_dump($sum);
shell
C> copy rindowmatlib.dll C:\php
C> PATH %PATH%;C:\php