21 if (!is_array($matrixValues)) {
22 $matrixValues = [[$matrixValues]];
26 foreach ($matrixValues as $matrixRow) {
27 if (!is_array($matrixRow)) {
28 $matrixRow = [$matrixRow];
31 foreach ($matrixRow as $matrixCell) {
32 if ((is_string($matrixCell)) || ($matrixCell === null)) {
35 $matrixData[
$row][$column] = $matrixCell;
41 return new Matrix($matrixData);
59 $matrix = self::getMatrix($matrixValues);
65 return $e->getMessage();
81 public static function inverse($matrixValues)
84 $matrix = self::getMatrix($matrixValues);
86 return $matrix->inverse()->toArray();
90 return $e->getMessage();
102 public static function multiply($matrixData1, $matrixData2)
105 $matrixA = self::getMatrix($matrixData1);
106 $matrixB = self::getMatrix($matrixData2);
108 return $matrixA->multiply($matrixB)->toArray();
112 return $e->getMessage();
129 for (
$x = 0;
$x < $dimension; ++
$x) {
135 return $e->getMessage();
static validateNumericNullBool($number)
Many functions accept null/false/true argument treated as 0/0/1.
static createFilledMatrix($fillValue, $rows, $columns=null)
Create a new matrix of specified dimensions, and filled with a specified value If the column argument...
static identity($dimension)
MUnit.
static multiply($matrixData1, $matrixData2)
MMULT.
static getMatrix($matrixValues)
Convert parameter to matrix.
static inverse($matrixValues)
MINVERSE.
Class for the creating "special" Matrices.
static determinant($matrixValues)
MDETERM.
static validatePositive($number, ?string $except=null)
Confirm number > 0.