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

Public Member Functions

 __construct (Matrix $matrix)
 Create an new handler object for the operation. More...
 
 result ()
 Return the result of the operation. More...
 

Protected Member Functions

 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

 $matrix
 
 $rows
 Number of rows in the matrix. More...
 
 $columns
 Number of columns in the matrix. More...
 

Detailed Description

Definition at line 8 of file Operator.php.

Constructor & Destructor Documentation

◆ __construct()

Matrix\Operators\Operator::__construct ( Matrix  $matrix)

Create an new handler object for the operation.

Parameters
Matrix$matrixThe base Matrix object on which the operation will be performed

Definition at line 36 of file Operator.php.

References Matrix\Matrix\columns(), Matrix\Matrix\rows(), and Matrix\Matrix\toArray().

37  {
38  $this->rows = $matrix->rows;
39  $this->columns = $matrix->columns;
40  $this->matrix = $matrix->toArray();
41  }
+ Here is the call graph for this function:

Member Function Documentation

◆ result()

Matrix\Operators\Operator::result ( )

Return the result of the operation.

Returns
Matrix

Definition at line 74 of file Operator.php.

74  : Matrix
75  {
76  return new Matrix($this->matrix);
77  }
Class for the creating "special" Matrices.
Definition: Builder.php:11

◆ validateMatchingDimensions()

Matrix\Operators\Operator::validateMatchingDimensions ( Matrix  $matrix)
protected

Compare the dimensions of the matrices being operated on to see if they are valid for addition/subtraction.

Parameters
Matrix$matrixThe second Matrix object on which the operation will be performed
Exceptions
Exception

Definition at line 49 of file Operator.php.

References Matrix\Matrix\columns(), and Matrix\Matrix\rows().

Referenced by Matrix\Operators\Addition\addMatrix(), and Matrix\Operators\Subtraction\subtractMatrix().

49  : void
50  {
51  if (($this->rows != $matrix->rows) || ($this->columns != $matrix->columns)) {
52  throw new Exception('Matrices have mismatched dimensions');
53  }
54  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validateReflectingDimensions()

Matrix\Operators\Operator::validateReflectingDimensions ( Matrix  $matrix)
protected

Compare the dimensions of the matrices being operated on to see if they are valid for multiplication/division.

Parameters
Matrix$matrixThe second Matrix object on which the operation will be performed
Exceptions
Exception

Definition at line 62 of file Operator.php.

References Matrix\Matrix\rows().

Referenced by Matrix\Operators\Multiplication\multiplyMatrix().

62  : void
63  {
64  if ($this->columns != $matrix->rows) {
65  throw new Exception('Matrices have mismatched dimensions');
66  }
67  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $columns

◆ $matrix

Matrix\Operators\Operator::$matrix
protected

Definition at line 15 of file Operator.php.

Referenced by Matrix\Operators\Multiplication\multiplyMatrix().

◆ $rows


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