vector
        
        extends nd
    
    
            
            in package
            
        
    
    
            
            Uses
                            ops,                             linAlg                    
    
        
            A fast lite memory efficient Scientific Computing in php Vector (rank-1)
Tags
Table of Contents
- DOUBLE = 2
- EPSILON = 1.0E-8
- FLOAT = 1
- INT = 3
- TWO_PI = 2.0 * M_PI
- $data : mixed
- $_mem : mixed
- $_time : mixed
- __toString() : mixed
- abs() : matrix|vector
- acos() : matrix|vector
- add() : matrix|vector
- ar() : vector
- Build a new vector from a php array.
- argMax() : int
- Return the index of the maximum element in the vector.
- argMin() : int
- Return the index of the minimum element in the vector.
- asArray() : mixed
- asin() : matrix|vector
- atan() : matrix|vector
- ceil() : matrix|vector
- checkDimensions() : mixed
- checkDtype() : mixed
- checkShape() : mixed
- clip() : matrix
- Clip the elements in the matrix to be between given minimum and maximum and return a new matrix.
- clipLower() : matrix
- Clip the matrix|vector to be lower bounded by a given minimum.
- clipUpper() : matrix
- Clip the matrix|vector to be upper bounded by a given maximum.
- convolve() : vector
- copy() : matrix|vector
- make a copy of matrix|vector;
- cos() : matrix|vector
- degToRad() : matrix|vector
- divide() : matrix|vector
- dot() : matrix|vector
- get dot product of m.m | m.v | v.v
- dotMatrix() : vector
- Compute the vector-matrix dot product of this vector and matrix .
- exp() : matrix|vector
- exp1() : matrix|vector
- factory() : vector
- Factory method to build a new vector.
- floor() : matrix|vector
- free() : void
- full() : vector
- create a vector with given scalar value
- gaussian() : self
- Return a Gaussian random vector with mean 0 and unit variance.
- getDtype() : mixed
- getMemory() : mixed
- set memory dog, get total memory
- getSize() : int
- get the size of vector
- inner() : mixed
- Return the inner product of two vectors.
- inverse() : matrix|null
- FIXEME:-Bug noticed on 10/06/21 Compute the multiplicative inverse of the matrix.
- linspace() : vector
- Return a vector of n evenly spaced numbers between minimum and maximum.
- log() : matrix|vector
- log1p() : matrix|vector
- map() : matrix|vector
- Run a function over all of the elements in the matrix|vector.
- max() : mixed
- mean() : int|float
- median() : int|float
- min() : mixed
- mod() : matrix|vector
- multiply() : matrix|vector
- normL1() : float
- Calculate the L1 norm of the vector.
- normL2() : mixed
- normMax() : mixed
- normP() : mixed
- null() : vector
- create a null like vector
- ones() : vector
- create one like vector
- poisson() : vector
- Generate a vector with n elements from a Poisson distribution.
- pow() : matrix|vector
- printVector() : mixed
- product() : int|float
- Return the product of the vector.
- pseudoInverse() : matrix|null
- FIXEME:-Bug noticed on 10/06/21 Compute the (Moore-Penrose) pseudo inverse of the general matrix.
- radToDeg() : matrix|vector
- randn() : vector
- Return vector with random values
- range() : vector
- Return evenly spaced values within a given interval.
- reciprocal() : self
- Return the reciprocal of the vector element-wise.
- reshape() : matrix
- return a reshaped data buffer as matrix
- setData() : mixed
- set data to vector
- sin() : matrix|vector
- sort() : mixed
- sort the vector
- sqrt() : matrix|vector
- square() : vector
- subtract() : matrix|vector
- sum() : float
- The sum of the vector.
- tan() : matrix|vector
- time() : mixed
- set Timer, get total time
- uniform() : vector
- Return vector with uniform values
- variance() : mixed
- zeros() : vector
- Build a vector of zeros with n elements.
- __construct() : mixed
- _dimensionaMisMatchErr() : dimensionalityMismatch
- _dtypeErr() : dtypeException
- _err() : runtimeException
- _invalidArgument() : invalidArgumentException
- _ndDouble() : mixed
- _ndFloat() : mixed
- _ndInt() : mixed
- addMatrix() : matrix
- addScalar() : vector
- addVector() : vector
- divideMatrix() : matrix
- divideScalar() : vector
- divideVector() : vector
- dotVector() : vector
- get dot product of matrix & a vector
- modMatrix() : matrix
- modScalar() : mixed
- modVector() : vector
- multiplyMatrix() : matrix
- multiplyScalar() : vector
- multiplyVector() : vector
- powMatrix() : matrix
- powScalar() : vector
- powVector() : vector
- substractScalar() : vector
- subtractMatrix() : matrix
- subtractVector() : vector
Constants
DOUBLE
    public
    mixed
    DOUBLE
    = 2
    
    
EPSILON
    public
    mixed
    EPSILON
    = 1.0E-8
    
    
FLOAT
    public
    mixed
    FLOAT
    = 1
    
    
INT
    public
    mixed
    INT
    = 3
    
    
TWO_PI
    public
    mixed
    TWO_PI
    = 2.0 * M_PI
    
    
Properties
$data
    public
        mixed
    $data
    
    
    
$_mem
    protected
        mixed
    $_mem
     = null
    
    
$_time
    protected
        mixed
    $_time
     = null
    
    
Methods
__toString()
    public
                __toString() : mixed
    
    
    
        Return values
mixed —abs()
    public
                abs() : matrix|vector
    
    
    
        Return values
matrix|vector —acos()
    public
                acos() : matrix|vector
    
    
    
        Return values
matrix|vector —add()
    public
                add(int|float|matrix|vector $d) : matrix|vector
        
        Parameters
Return values
matrix|vector —ar()
Build a new vector from a php array.
    public
            static    ar(array<string|int, mixed> $data[, int $dtype = self::FLOAT ]) : vector
        
        Parameters
- $data : array<string|int, mixed>
- $dtype : int = self::FLOAT
Return values
vector —argMax()
Return the index of the maximum element in the vector.
    public
                argMax() : int
        
    
    
        Return values
int —argMin()
Return the index of the minimum element in the vector.
    public
                argMin() : int
        
    
    
        Return values
int —asArray()
    public
                asArray() : mixed
    
    
    
        Return values
mixed —asin()
    public
                asin() : matrix|vector
    
    
    
        Return values
matrix|vector —atan()
    public
                atan() : matrix|vector
    
    
    
        Return values
matrix|vector —ceil()
    public
                ceil() : matrix|vector
    
    
    
        Return values
matrix|vector —checkDimensions()
    public
                checkDimensions(matrix|vector $Obj1, matrix $Obj2) : mixed
    
        Parameters
Return values
mixed —checkDtype()
    public
                checkDtype(matrix|vector $Obj1, matrix|vector $Obj2) : mixed
    
        Parameters
Return values
mixed —checkShape()
    public
                checkShape(matrix|vector $Obj1, matrix|vector $Obj2) : mixed
    
        Parameters
Return values
mixed —clip()
Clip the elements in the matrix to be between given minimum and maximum and return a new matrix.
    public
                clip(float $min, float $max) : matrix
        
        Parameters
- $min : float
- $max : float
Return values
matrix —clipLower()
Clip the matrix|vector to be lower bounded by a given minimum.
    public
                clipLower(float $min) : matrix
        
        Parameters
- $min : float
Return values
matrix —clipUpper()
Clip the matrix|vector to be upper bounded by a given maximum.
    public
                clipUpper(float $max) : matrix
        
        Parameters
- $max : float
Return values
matrix —convolve()
    public
                convolve(vector $v[, int $stride = 1 ]) : vector
        
        Parameters
- $v : vector
- $stride : int = 1
Return values
vector —copy()
make a copy of matrix|vector;
    public
                copy() : matrix|vector
        
    
    
        Return values
matrix|vector —cos()
    public
                cos() : matrix|vector
    
    
    
        Return values
matrix|vector —degToRad()
    public
                degToRad() : matrix|vector
    
    
    
        Return values
matrix|vector —divide()
    public
                divide(int|float|matrix|vector $d) : matrix|vector
        
        Parameters
Return values
matrix|vector —dot()
get dot product of m.m | m.v | v.v
    public
                dot(matrix|vector $d) : matrix|vector
        
        Parameters
Return values
matrix|vector —dotMatrix()
Compute the vector-matrix dot product of this vector and matrix .
    public
                dotMatrix(matrix $m) : vector
        
        Parameters
- $m : matrix
Return values
vector —exp()
    public
                exp() : matrix|vector
    
    
    
        Return values
matrix|vector —exp1()
    public
                exp1() : matrix|vector
    
    
    
        Return values
matrix|vector —factory()
Factory method to build a new vector.
    public
            static    factory(int $col[, int $dtype = self::FLOAT ]) : vector
        
        Parameters
- $col : int
- $dtype : int = self::FLOAT
Return values
vector —floor()
    public
                floor() : matrix|vector
    
    
    
        Return values
matrix|vector —free()
    public
                free() : void
    
    
    
        Return values
void —full()
create a vector with given scalar value
    public
            static    full(int $col, int|float $val[, int $dtype = self::FLOAT ]) : vector
        
        Parameters
- $col : int
- $val : int|float
- $dtype : int = self::FLOAT
Return values
vector —gaussian()
Return a Gaussian random vector with mean 0 and unit variance.
    public
            static    gaussian(int $n[, int $dtype = self::FLOAT ]) : self
        
        Parameters
- $n : int
- $dtype : int = self::FLOAT
Return values
self —getDtype()
    public
                getDtype() : mixed
    
    
    
        Return values
mixed —getMemory()
set memory dog, get total memory
    public
                getMemory() : mixed
        
    
    
        Return values
mixed —getSize()
get the size of vector
    public
                getSize() : int
        
    
    
        Return values
int —inner()
Return the inner product of two vectors.
    public
                inner(vector $vector) : mixed
        
        Parameters
- $vector : vector
Return values
mixed —inverse()
FIXEME:-Bug noticed on 10/06/21 Compute the multiplicative inverse of the matrix.
    public
                inverse() : matrix|null
        
    
    
        Return values
matrix|null —linspace()
Return a vector of n evenly spaced numbers between minimum and maximum.
    public
            static    linspace(float $min, float $max, int $n[, int $dtype = self::FLOAT ]) : vector
        
        Parameters
- $min : float
- $max : float
- $n : int
- $dtype : int = self::FLOAT
Tags
Return values
vector —log()
    public
                log([float $b = M_E ]) : matrix|vector
    
        Parameters
- $b : float = M_E
Return values
matrix|vector —log1p()
    public
                log1p() : matrix|vector
    
    
    
        Return values
matrix|vector —map()
Run a function over all of the elements in the matrix|vector.
    public
                map(callable $func) : matrix|vector
        
        Parameters
- $func : callable
Return values
matrix|vector —max()
    public
                max() : mixed
    
    
    
        Return values
mixed —mean()
    public
                mean() : int|float
        
    
    
        Return values
int|float —median()
    public
                median() : int|float
        
    
    
        Return values
int|float —min()
    public
                min() : mixed
    
    
    
        Return values
mixed —mod()
    public
                mod(int|float|matrix|vector $d) : matrix|vector
        
        Parameters
Return values
matrix|vector —multiply()
    public
                multiply(int|float|matrix|vector $d) : matrix|vector
        
        Parameters
Return values
matrix|vector —normL1()
Calculate the L1 norm of the vector.
    public
                normL1() : float
        
    
    
        Return values
float —normL2()
    public
                normL2() : mixed
    
    
    
        Return values
mixed —normMax()
    public
                normMax() : mixed
    
    
    
        Return values
mixed —normP()
    public
                normP([float $p = 2.5 ]) : mixed
    
        Parameters
- $p : float = 2.5
Return values
mixed —null()
create a null like vector
    public
            static    null(int $col[, int $dtype = self::FLOAT ]) : vector
        
        Parameters
- $col : int
- $dtype : int = self::FLOAT
Return values
vector —ones()
create one like vector
    public
            static    ones(int $col[, int $dtype = self::FLOAT ]) : vector
        
        Parameters
- $col : int
- $dtype : int = self::FLOAT
Return values
vector —poisson()
Generate a vector with n elements from a Poisson distribution.
    public
            static    poisson(int $n[, float $lambda = 1.0 ][, int $dtype = self::FLOAT ]) : vector
        
        Parameters
- $n : int
- $lambda : float = 1.0
- $dtype : int = self::FLOAT
Return values
vector —pow()
    public
                pow(int|float|matrix|vector $d) : matrix|vector
        
        Parameters
Return values
matrix|vector —printVector()
    public
                printVector() : mixed
    
    
    
        Return values
mixed —product()
Return the product of the vector.
    public
                product() : int|float
        
    
    
        Return values
int|float —pseudoInverse()
FIXEME:-Bug noticed on 10/06/21 Compute the (Moore-Penrose) pseudo inverse of the general matrix.
    public
                pseudoInverse() : matrix|null
        
    
    
        Return values
matrix|null —radToDeg()
    public
                radToDeg() : matrix|vector
    
    
    
        Return values
matrix|vector —randn()
Return vector with random values
    public
            static    randn(int $col[, int $dtype = self::FLOAT ]) : vector
        
        Parameters
- $col : int
- $dtype : int = self::FLOAT
Return values
vector —range()
Return evenly spaced values within a given interval.
    public
            static    range(int|float $start, int|float $end[, int|float $interval = 1 ][, int $dtype = self::FLOAT ]) : vector
        
        Parameters
- $start : int|float
- $end : int|float
- $interval : int|float = 1
- $dtype : int = self::FLOAT
Return values
vector —reciprocal()
Return the reciprocal of the vector element-wise.
    public
                reciprocal() : self
        
    
    
        Return values
self —reshape()
return a reshaped data buffer as matrix
    public
                reshape(int $row, int $col) : matrix
        
        Parameters
- $row : int
- $col : int
Return values
matrix —setData()
set data to vector
    public
                setData(int|float|array<string|int, mixed> $data) : mixed
        
        Parameters
- $data : int|float|array<string|int, mixed>
Return values
mixed —sin()
    public
                sin() : matrix|vector
    
    
    
        Return values
matrix|vector —sort()
sort the vector
    public
                sort([string $type = 'i' ]) : mixed
        
        Parameters
- $type : string = 'i'
- 
                    i or d 
Return values
mixed —sqrt()
    public
                sqrt() : matrix|vector
    
    
    
        Return values
matrix|vector —square()
    public
                square() : vector
        
    
    
        Return values
vector —subtract()
    public
                subtract(int|float|matrix|vector $d) : matrix|vector
        
        Parameters
Return values
matrix|vector —sum()
The sum of the vector.
    public
                sum() : float
        
    
    
        Return values
float —tan()
    public
                tan() : matrix|vector
    
    
    
        Return values
matrix|vector —time()
set Timer, get total time
    public
                time() : mixed
        
    
    
        Return values
mixed —uniform()
Return vector with uniform values
    public
            static    uniform(int $col[, int $dtype = self::FLOAT ]) : vector
        
        Parameters
- $col : int
- $dtype : int = self::FLOAT
Return values
vector —variance()
    public
                variance([mixed $mean = null ]) : mixed
    
        Parameters
- $mean : mixed = null
Return values
mixed —zeros()
Build a vector of zeros with n elements.
    public
            static    zeros(int $col[, int $dtype = self::FLOAT ]) : vector
        
        Parameters
- $col : int
- $dtype : int = self::FLOAT
Return values
vector —__construct()
    protected
                __construct(int $col[, int $dtype = self::FLOAT ]) : mixed
    
        Parameters
- $col : int
- $dtype : int = self::FLOAT
Return values
mixed —_dimensionaMisMatchErr()
    protected
            static    _dimensionaMisMatchErr(mixed $msg) : dimensionalityMismatch
    
        Parameters
- $msg : mixed
Return values
dimensionalityMismatch —_dtypeErr()
    protected
            static    _dtypeErr(mixed $msg) : dtypeException
    
        Parameters
- $msg : mixed
Return values
dtypeException —_err()
    protected
            static    _err(mixed $msg) : runtimeException
    
        Parameters
- $msg : mixed
Return values
runtimeException —_invalidArgument()
    protected
            static    _invalidArgument(mixed $argument) : invalidArgumentException
    
        Parameters
- $argument : mixed
Return values
invalidArgumentException —_ndDouble()
    protected
            static    _ndDouble(int $size) : mixed
    
        Parameters
- $size : int
Return values
mixed —_ndFloat()
    protected
            static    _ndFloat(int $size) : mixed
    
        Parameters
- $size : int
Return values
mixed —_ndInt()
    protected
            static    _ndInt(int $size) : mixed
    
        Parameters
- $size : int
Return values
mixed —addMatrix()
    protected
                addMatrix(matrix $m) : matrix
        
        Parameters
- $m : matrix
Return values
matrix —addScalar()
    protected
                addScalar(int|float $s) : vector
        
        Parameters
- $s : int|float
Return values
vector —addVector()
    protected
                addVector(vector $vector) : vector
        
        Parameters
- $vector : vector
Return values
vector —divideMatrix()
    protected
                divideMatrix(matrix $m) : matrix
        
        Parameters
- $m : matrix
Return values
matrix —divideScalar()
    protected
                divideScalar(int|float $s) : vector
        
        Parameters
- $s : int|float
Return values
vector —divideVector()
    protected
                divideVector(vector $v) : vector
        
        Parameters
- $v : vector
Return values
vector —dotVector()
get dot product of matrix & a vector
    protected
                dotVector(vector $vector) : vector
        
        Parameters
- $vector : vector
Return values
vector —modMatrix()
    protected
                modMatrix(matrix $m) : matrix
        
        Parameters
- $m : matrix
Return values
matrix —modScalar()
    protected
                modScalar(int|float $s) : mixed
        
        Parameters
- $s : int|float
Return values
mixed —modVector()
    protected
                modVector(vector $vector) : vector
        
        Parameters
- $vector : vector
Return values
vector —multiplyMatrix()
    protected
                multiplyMatrix(matrix $m) : matrix
        
        Parameters
- $m : matrix
Return values
matrix —multiplyScalar()
    protected
                multiplyScalar(int|float $s) : vector
        
        Parameters
- $s : int|float
Return values
vector —multiplyVector()
    protected
                multiplyVector(vector $vector) : vector
        
        Parameters
- $vector : vector
Return values
vector —powMatrix()
    protected
                powMatrix(matrix $m) : matrix
        
        Parameters
- $m : matrix
Return values
matrix —powScalar()
    protected
                powScalar(int|float $s) : vector
        
        Parameters
- $s : int|float
Return values
vector —powVector()
    protected
                powVector(vector $vector) : vector
        
        Parameters
- $vector : vector
Return values
vector —substractScalar()
    protected
                substractScalar(vector $scalar) : vector
        
        Parameters
- $scalar : vector
Return values
vector —subtractMatrix()
    protected
                subtractMatrix(matrix $m) : matrix
        
        Parameters
- $m : matrix
Return values
matrix —subtractVector()
    protected
                subtractVector(vector $vector) : vector
        
        Parameters
- $vector : vector
