ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Matrix\Operators\Division Class Reference
+ Inheritance diagram for Matrix\Operators\Division:
+ Collaboration diagram for Matrix\Operators\Division:

Public Member Functions

 execute ($value, string $type='division')
 Execute the division. More...
 
- Public Member Functions inherited from Matrix\Operators\Multiplication
 execute ($value, string $type='multiplication')
 Execute the multiplication. More...
 
- Public Member Functions inherited from Matrix\Operators\Operator
 __construct (Matrix $matrix)
 Create an new handler object for the operation. More...
 
 result ()
 Return the result of the operation. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Matrix\Operators\Multiplication
 multiplyScalar ($value, string $type='multiplication')
 Execute the multiplication for a scalar. More...
 
 multiplyMatrix (Matrix $value, string $type='multiplication')
 Execute the multiplication for a matrix. More...
 
- Protected Member Functions inherited from Matrix\Operators\Operator
 validateMatchingDimensions (Matrix $matrix)
 Compare the dimensions of the matrices being operated on to see if they are valid for addition/subtraction. More...
 
 validateReflectingDimensions (Matrix $matrix)
 Compare the dimensions of the matrices being operated on to see if they are valid for multiplication/division. More...
 
- Protected Attributes inherited from Matrix\Operators\Operator
 $matrix
 
 $rows
 Number of rows in the matrix. More...
 
 $columns
 Number of columns in the matrix. More...
 

Detailed Description

Definition at line 10 of file Division.php.

Member Function Documentation

◆ execute()

Matrix\Operators\Division::execute (   $value,
string  $type = 'division' 
)

Execute the division.

Parameters
mixed$valueThe matrix or numeric value to divide the current base value by
Exceptions
ExceptionIf the provided argument is not appropriate for the operation
Returns
$this The operation object, allowing multiple divisions to be chained

Definition at line 19 of file Division.php.

References $type, Matrix\Functions\inverse(), Matrix\Operators\Multiplication\multiplyMatrix(), and Matrix\Operators\Multiplication\multiplyScalar().

19  : 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  }
$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.
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: