Class MatrixFactory
Static factory to create the various standard numerical matrices
Methods summary
public static
Chippyash\Math\Matrix\NumericMatrix
|
#
create( string $type, array $data )
|
public static
Chippyash\Math\Matrix\ComplexMatrix
|
#
createComplex( array $data )
Create and return a complex number matrix
$data elements are either:
- a ComplexType
- string representations of complex number
- a 2 item array representing r & i e.g. [2,-4] = '2-4i'
Create and return a complex number matrix
$data elements are either: - a ComplexType - string representations of complex number - a 2 item array representing r & i e.g. [2,-4] = '2-4i'
Parameters
Returns
Throws
|
public static
Chippyash\Math\Matrix\RationalMatrix
|
#
createRational( array $data )
Create and return a rational number matrix
$data elements are either:
- a RationalType
- string representations of rational number
- a PHP float
- a 2 item array representing numerator & denominator e.g. [2,-4] = '-2/4'
Create and return a rational number matrix
$data elements are either: - a RationalType - string representations of rational number - a PHP float - a 2 item array representing numerator & denominator e.g. [2,-4] = '-2/4'
Parameters
Returns
Throws
|
public static
Chippyash\Math\Matrix\NumericMatrix
|
#
createNumeric( array $data )
Create and return a numeric value matrix
Create and return a numeric value matrix
Parameters
Returns
|
public static
Chippyash\Math\Matrix\ComplexMatrix |Chippyash\Math\Matrix\NumericMatrix |Chippyash\Math\Matrix\RationalMatrix
|
#
createFromFunction( callable $fn, Chippyash\Type\Number\IntType $rows, Chippyash\Type\Number\IntType $cols, string $type = 'numeric' )
Construct a complete matrix whose entries are a result of a function
Construct a complete matrix whose entries are a result of a function
The function must accept two parameters e.g. $function($row, $col) {return $row - $col;}
$row and $col are 1 based
Parameters
- $fn
- $rows
- Number of required rows
- $cols
- Number or required columns
- $type
- ['numeric'|'rational'|'complex']
Returns
Throws
InvalidArgumentException
|
public static
Chippyash\Math\Matrix\RationalMatrix
|
#
createFromComplex( Chippyash\Type\Number\Complex\ComplexType $c )
Create a matrix representation of a complex number
For z = a+bi
Returns [[a, -b]
[b, a]]
Create a matrix representation of a complex number
For z = a+bi
Returns [[a, -b] [b, a]]
Parameters
Returns
|