ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Division.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Matrix\Operators;
4 
7 use \Matrix\Matrix;
8 use \Matrix\Functions;
9 
10 class Division extends Multiplication
11 {
19  public function execute($value, string $type = 'division'): Operator
20  {
21  if (is_array($value)) {
22  $value = new Matrix($value);
23  }
24 
25  if (is_object($value) && ($value instanceof Matrix)) {
26  $value = Functions::inverse($value, $type);
27 
28  return $this->multiplyMatrix($value, $type);
29  } elseif (is_numeric($value)) {
30  return $this->multiplyScalar(1 / $value, $type);
31  }
32 
33  throw new Exception('Invalid argument for division');
34  }
35 }
execute($value, string $type='division')
Execute the division.
Definition: Division.php:19
$type
static inverse(Matrix $matrix, string $type='inverse')
Return the inverse of this matrix.
Definition: Functions.php:232
multiplyScalar($value, string $type='multiplication')
Execute the multiplication for a scalar.
Class for the creating "special" Matrices.
Definition: Builder.php:11
multiplyMatrix(Matrix $value, string $type='multiplication')
Execute the multiplication for a matrix.