\Matrix\OperatorsAddition

Summary

Methods
Properties
Constants
__construct()
result()
execute()
No public properties found
No constants found
validateMatchingDimensions()
validateReflectingDimensions()
addScalar()
addMatrix()
$matrix
$rows
$columns
N/A
No private methods found
No private properties found
N/A

Properties

$matrix

$matrix

Stored internally as a 2-dimension array of values

$rows

$rows

Number of rows in the matrix

$columns

$columns

Number of columns in the matrix

Methods

__construct()

__construct(\Matrix\Matrix  $matrix) : mixed

Create an new handler object for the operation

Parameters

\Matrix\Matrix $matrix

The base Matrix object on which the operation will be performed

Returns

mixed —

result()

result() : \Matrix\Matrix

Return the result of the operation

Returns

\Matrix\Matrix —

execute()

execute(mixed  $value) : $this

Execute the addition

Parameters

mixed $value

The matrix or numeric value to add to the current base value

Throws

\Matrix\Exception

If the provided argument is not appropriate for the operation

Returns

$this —

The operation object, allowing multiple additions to be chained

validateMatchingDimensions()

validateMatchingDimensions(\Matrix\Matrix  $matrix) : void

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

Parameters

\Matrix\Matrix $matrix

The second Matrix object on which the operation will be performed

Throws

\Matrix\Exception

validateReflectingDimensions()

validateReflectingDimensions(\Matrix\Matrix  $matrix) : void

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

Parameters

\Matrix\Matrix $matrix

The second Matrix object on which the operation will be performed

Throws

\Matrix\Exception

addScalar()

addScalar(mixed  $value) : $this

Execute the addition for a scalar

Parameters

mixed $value

The numeric value to add to the current base value

Returns

$this —

The operation object, allowing multiple additions to be chained

addMatrix()

addMatrix(\Matrix\Matrix  $value) : $this

Execute the addition for a matrix

Parameters

\Matrix\Matrix $value

The numeric value to add to the current base value

Throws

\Matrix\Exception

If the provided argument is not appropriate for the operation

Returns

$this —

The operation object, allowing multiple additions to be chained