class Matrix

## Properties

 protected int[]|float[] \$elements The array of elements. protected int \$width The matrix width. protected int \$height The matrix height.

## Methods

__construct(int \$width, int \$height, int[]|float[] \$elements = array())

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.

int
getWidth()

Get the matrix width.

int
getHeight()

Get the matrix height.

setElementAt(int \$x, int \$y, int|float \$value)

Set the value of a cell.

int|float
getElementAt(int \$x, int \$y)

Get the value of a cell.

int[]|float[]
getValueList()

Return all the matrix values, as a monodimensional array.

int[]|float[]
getMatrix()

Return all the matrix values, as a bidimensional array (every array item contains the values of a row).

normalize()

Returns a new Matrix instance, representing the normalized value of this matrix.

int
calculatePosition(int \$x, int \$y)

Calculate the offset position of a cell.

## Details

### at line 50``` __construct(int \$width, int \$height, int[]|float[] \$elements = array()) ```

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.

#### Parameters

 int \$width the matrix width int \$height he matrix height int[]|float[] \$elements the matrix elements

### at line 79``` int getWidth() ```

Get the matrix width.

 int

### at line 89``` int getHeight() ```

Get the matrix height.

 int

### at line 101``` setElementAt(int \$x, int \$y, int|float \$value) ```

Set the value of a cell.

#### Parameters

 int \$x int \$y int|float \$value

### at line 114``` int|float getElementAt(int \$x, int \$y) ```

Get the value of a cell.

#### Parameters

 int \$x int \$y

#### Return Value

 int|float

### at line 124``` int[]|float[] getValueList() ```

Return all the matrix values, as a monodimensional array.

#### Return Value

 int[]|float[]

### at line 134``` int[]|float[] getMatrix() ```

Return all the matrix values, as a bidimensional array (every array item contains the values of a row).

#### Return Value

 int[]|float[]

### at line 144``` Matrix normalize() ```

Returns a new Matrix instance, representing the normalized value of this matrix.

### at line 169``` protected int calculatePosition(int \$x, int \$y) ```

Calculate the offset position of a cell.

#### Parameters

 int \$x int \$y

 int