2017 © Pedro Peláez
 

library mat-lab-php

Some Math operations on PHP with MatLab syntaxis.

image

royopa/mat-lab-php

Some Math operations on PHP with MatLab syntaxis.

  • Saturday, August 20, 2016
  • by royopa
  • Repository
  • 3 Watchers
  • 2 Stars
  • 104 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

MatLabPHP

http://royopa.github.io/mat-lab-php, (*1)

Some Math operations on PHP with MatLab syntaxis., (*2)

Build Status Scrutinizer Code Quality Code Coverage, (*3)

Requiring/Loading

If you're using Composer to manage dependencies, you can include the following in your composer.json file:, (*4)

{
    "require": {
        "royopa/mat-lab-php": "dev-master"
    }
}

or, (*5)

composer require royopa/mat-lab-php

Then, after running composer update or php composer.phar update, you can load the class using Composer's autoloading:, (*6)

require 'vendor/autoload.php';

Otherwise, you can simply require the file directly:, (*7)

require_once 'path/to/MatLabPHP/src/MatLabPHP.php';

And in either case, I'd suggest using an alias., (*8)

use MatLabPHP\MatLabPHP as M;

Methods

stringToVector()

$matLabPHP->stringToVector(string $str);
  • description
    • Transform a vector in the format of [1 2 3] to an array(1,2,3);
  • parameters
    • Number, Vector or Matrix. Ex: 1 or [1 2 3] or [1 2 ; 3 4]
  • return
    • Array of Number, Vector or Matrix to operate in the class.
$matLabPHP = new MatLabPHP();
$matLabPHP->stringToVector("[3 1 2; 5 4 7; 6 9 7]");
    //array(
        0 => array(
            0 => '3',
            1 => '1',
            2 => '2'
        ),
        1 => array(
            0 => '5',
            1 => '4',
            2 => '7'
        ),
        2 => array(
            0 => '6',
            1 => '9',
            2 => '7'
        )
    );

eye()

$matLabPHP->eye($cols, $rows = 'eq');
  • description
    • Create the identity matrix;
  • parameters
    • cols and rows.
  • return
    • Eye matrix

zeros()

$matLabPHP->zeros($cols, $rows = 'eq');
  • description
    • Create the a matrix of zeros;
  • parameters
    • cols and rows.
  • return
    • Zero matrix

length()

$matLabPHP->length($vector, $ret = 0);
  • description
    • Gives back the max between cols and rows of a matrix
  • parameters
    • vector or matrix
  • return
    • int

sum()

$matLabPHP->sum($sumA, $sumB);
  • description
    • Sumes two matrix or vectors or numbers
  • parameters
    • two vector or matrix or numbers
  • return
    • result

mean()

$matLabPHP->mean($array);
  • description
    • Calculate mean (simple arithmetic average).
  • parameters
    • array $values
  • return
    • string Mean

stddev()

$matLabPHP->stddev(array $a, $isSample = false);
  • description -
  • parameters -
  • return -

variance()

$matLabPHP->variance($a, $isSample);
  • description -
  • parameters -
  • return -

covariance()

$matLabPHP->covariance(array $x_values, array $y_values);
  • description -
  • parameters -
  • return -

correlation()

$matLabPHP->correlation(array $x_values, array $y_values, $isSample = false);
  • description -
  • parameters -
  • return -

Tests

From the project directory, tests can be ran using:, (*9)

./vendor/bin/phpunit

The Versions

20/08 2016

dev-master

9999999-dev https://github.com/royopa/mat-lab-php

Some Math operations on PHP with MatLab syntaxis.

  Sources   Download

MIT

The Requires

 

The Development Requires

helpers math utils multibyte utf matlab