Definition at line 10 of file Multiplication.php.
◆ execute()
Matrix\Operators\Multiplication::execute |
( |
|
$value, |
|
|
string |
$type = 'multiplication' |
|
) |
| |
Execute the multiplication.
- Parameters
-
mixed | $value | The matrix or numeric value to multiply the current base value by |
- Exceptions
-
Exception | If the provided argument is not appropriate for the operation |
- Returns
- $this The operation object, allowing multiple multiplications to be chained
Definition at line 19 of file Multiplication.php.
References $type, Matrix\Operators\Multiplication\multiplyMatrix(), and Matrix\Operators\Multiplication\multiplyScalar().
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");
multiplyScalar($value, string $type='multiplication')
Execute the multiplication for a scalar.
Class for the creating "special" Matrices.
multiplyMatrix(Matrix $value, string $type='multiplication')
Execute the multiplication for a matrix.
◆ multiplyMatrix()
Matrix\Operators\Multiplication::multiplyMatrix |
( |
Matrix |
$value, |
|
|
string |
$type = 'multiplication' |
|
) |
| |
|
protected |
Execute the multiplication for a matrix.
- Parameters
-
Matrix | $value | The numeric value to multiply with the current base value |
- Returns
- $this The operation object, allowing multiple mutiplications to be chained
- Exceptions
-
Exception | If the provided argument is not appropriate for the operation |
Definition at line 62 of file Multiplication.php.
References $key, Matrix\Operators\Operator\$matrix, $row, Matrix\Operators\Operator\$rows, Matrix\Matrix\columns(), Matrix\Builder\createFilledMatrix(), Matrix\Matrix\getColumns(), and Matrix\Operators\Operator\validateReflectingDimensions().
Referenced by Matrix\Operators\Division\execute(), and Matrix\Operators\Multiplication\execute().
67 $newColumns = $value->columns;
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.
validateReflectingDimensions(Matrix $matrix)
Compare the dimensions of the matrices being operated on to see if they are valid for multiplication/...
◆ multiplyScalar()
Matrix\Operators\Multiplication::multiplyScalar |
( |
|
$value, |
|
|
string |
$type = 'multiplication' |
|
) |
| |
|
protected |
The documentation for this class was generated from the following file: