21 if (is_array($value)) {
22 $value =
new Matrix($value);
25 if (is_object($value) && ($value instanceof
Matrix)) {
27 } elseif (is_numeric($value)) {
31 throw new Exception(
"Invalid argument for $type");
45 $this->matrix[
$row][$column] *= $value;
49 throw new Exception(
"Invalid argument for $type");
72 for ($column = 0; $column < $newColumns; ++$column) {
73 $columnData = $value->
getColumns($column + 1)->toArray();
74 foreach ($this->matrix[
$row] as
$key => $valueData) {
80 throw new Exception(
"Invalid argument for $type");
static createFilledMatrix($fillValue, $rows, $columns=null)
Create a new matrix of specified dimensions, and filled with a specified value If the column argument...
$rows
Number of rows in the matrix.
$columns
Number of columns in the matrix.
columns()
Returns a Generator that will yield each column of the matrix in turn as a vector matrix or the value...
multiplyScalar($value, string $type='multiplication')
Execute the multiplication for a scalar.
validateReflectingDimensions(Matrix $matrix)
Compare the dimensions of the matrices being operated on to see if they are valid for multiplication/...
execute($value, string $type='multiplication')
Execute the multiplication.
Class for the creating "special" Matrices.
getColumns(int $column, int $columnCount=1)
Return a new matrix as a subset of columns from this matrix, starting at column number $column...
multiplyMatrix(Matrix $value, string $type='multiplication')
Execute the multiplication for a matrix.