Matrix
in package
Table of Contents
Properties
- $elements : array<string|int, int>|array<string|int, float>
- The array of elements.
- $height : int
- The matrix height.
- $width : int
- The matrix width.
Methods
- __construct() : mixed
- The given $elements get arranged as follows: The elements will be set from left to right in a row until the row is full. Then, the next line begins alike and so on.
- getElementAt() : int|float
- Get the value of a cell.
- getHeight() : int
- Get the matrix height.
- getMatrix() : array<string|int, int>|array<string|int, float>
- Return all the matrix values, as a bidimensional array (every array item contains the values of a row).
- getValueList() : array<string|int, int>|array<string|int, float>
- Return all the matrix values, as a monodimensional array.
- getWidth() : int
- Get the matrix width.
- normalize() : static
- Returns a new Matrix instance, representing the normalized value of this matrix.
- setElementAt() : mixed
- Set the value of a cell.
- calculatePosition() : int
- Calculate the offset position of a cell.
Properties
$elements
The array of elements.
protected
array<string|int, int>|array<string|int, float>
$elements
= array()
$height
The matrix height.
protected
int
$height
$width
The matrix width.
protected
int
$width
Methods
__construct()
The given $elements get arranged as follows: The elements will be set from left to right in a row until the row is full. Then, the next line begins alike and so on.
public
__construct(int $width, int $height[, array<string|int, int>|array<string|int, float> $elements = array() ]) : mixed
Parameters
- $width : int
-
the matrix width
- $height : int
-
he matrix height
- $elements : array<string|int, int>|array<string|int, float> = array()
-
the matrix elements
Tags
getElementAt()
Get the value of a cell.
public
getElementAt(int $x, int $y) : int|float
Parameters
- $x : int
- $y : int
Return values
int|floatgetHeight()
Get the matrix height.
public
getHeight() : int
Return values
intgetMatrix()
Return all the matrix values, as a bidimensional array (every array item contains the values of a row).
public
getMatrix() : array<string|int, int>|array<string|int, float>
Return values
array<string|int, int>|array<string|int, float>getValueList()
Return all the matrix values, as a monodimensional array.
public
getValueList() : array<string|int, int>|array<string|int, float>
Return values
array<string|int, int>|array<string|int, float>getWidth()
Get the matrix width.
public
getWidth() : int
Return values
intnormalize()
Returns a new Matrix instance, representing the normalized value of this matrix.
public
normalize() : static
Return values
staticsetElementAt()
Set the value of a cell.
public
setElementAt(int $x, int $y, int|float $value) : mixed
Parameters
- $x : int
- $y : int
- $value : int|float
calculatePosition()
Calculate the offset position of a cell.
protected
calculatePosition(int $x, int $y) : int
Parameters
- $x : int
- $y : int