Definition at line 8 of file DirectSum.php.
◆ directSumMatrix()
Matrix\Operators\DirectSum::directSumMatrix |
( |
|
$value | ) |
|
|
private |
Execute the direct sum for a matrix.
- Parameters
-
Matrix | $value | The numeric value to concatenate/direct sum with the current base value |
- Returns
- $this The operation object, allowing multiple additions to be chained
Definition at line 36 of file DirectSum.php.
References $row, and Matrix\Operators\Operator\$rows.
Referenced by Matrix\Operators\DirectSum\execute().
38 $originalColumnCount = count($this->matrix[0]);
39 $originalRowCount = count($this->matrix);
40 $valColumnCount = $value->columns;
41 $valRowCount = $value->rows;
42 $value = $value->toArray();
45 $this->matrix[
$row] = array_merge($this->matrix[
$row], array_fill(0, $valColumnCount, 0));
48 $this->matrix = array_merge(
50 array_fill(0, $valRowCount, array_fill(0, $originalColumnCount, 0))
53 for (
$row = $originalRowCount;
$row < $originalRowCount + $valRowCount; ++
$row) {
58 $value[$row - $originalRowCount]
$rows
Number of rows in the matrix.
◆ execute()
Matrix\Operators\DirectSum::execute |
( |
|
$value | ) |
|
Execute the addition.
- Parameters
-
mixed | $value | The matrix or numeric value to add to the current base value |
- Returns
- $this The operation object, allowing multiple additions to be chained
- Exceptions
-
Exception | If the provided argument is not appropriate for the operation |
Definition at line 17 of file DirectSum.php.
References Matrix\Operators\DirectSum\directSumMatrix().
19 if (is_array($value)) {
20 $value =
new Matrix($value);
23 if ($value instanceof
Matrix) {
27 throw new Exception(
'Invalid argument for addition');
Class for the creating "special" Matrices.
directSumMatrix($value)
Execute the direct sum for a matrix.
The documentation for this class was generated from the following file:
- libs/composer/vendor/markbaker/matrix/classes/src/Operators/DirectSum.php