Addition
extends Operator
in package
Table of Contents
Properties
- $columns : mixed
- Number of columns in the matrix
- $matrix : mixed
- Stored internally as a 2-dimension array of values
- $rows : mixed
- Number of rows in the matrix
Methods
- __construct() : mixed
- Create an new handler object for the operation
- execute() : $this
- Execute the addition
- result() : Matrix
- Return the result of the operation
- addMatrix() : $this
- Execute the addition for a matrix
- addScalar() : $this
- Execute the addition for a scalar
- validateMatchingDimensions() : void
- Compare the dimensions of the matrices being operated on to see if they are valid for addition/subtraction
- validateReflectingDimensions() : void
- Compare the dimensions of the matrices being operated on to see if they are valid for multiplication/division
Properties
$columns
Number of columns in the matrix
protected
mixed
$columns
$matrix
Stored internally as a 2-dimension array of values
protected
mixed
$matrix
$rows
Number of rows in the matrix
protected
mixed
$rows
Methods
__construct()
Create an new handler object for the operation
public
__construct(Matrix $matrix) : mixed
Parameters
- $matrix : Matrix
-
The base Matrix object on which the operation will be performed
execute()
Execute the addition
public
execute(mixed $value) : $this
Parameters
- $value : mixed
-
The matrix or numeric value to add to the current base value
Tags
Return values
$this —The operation object, allowing multiple additions to be chained
result()
Return the result of the operation
public
result() : Matrix
Return values
MatrixaddMatrix()
Execute the addition for a matrix
protected
addMatrix(Matrix $value) : $this
Parameters
- $value : Matrix
-
The numeric value to add to the current base value
Tags
Return values
$this —The operation object, allowing multiple additions to be chained
addScalar()
Execute the addition for a scalar
protected
addScalar(mixed $value) : $this
Parameters
- $value : mixed
-
The numeric value to add to the current base value
Return values
$this —The operation object, allowing multiple additions to be chained
validateMatchingDimensions()
Compare the dimensions of the matrices being operated on to see if they are valid for addition/subtraction
protected
validateMatchingDimensions(Matrix $matrix) : void
Parameters
- $matrix : Matrix
-
The second Matrix object on which the operation will be performed
Tags
validateReflectingDimensions()
Compare the dimensions of the matrices being operated on to see if they are valid for multiplication/division
protected
validateReflectingDimensions(Matrix $matrix) : void
Parameters
- $matrix : Matrix
-
The second Matrix object on which the operation will be performed