# Class: Matrix

## Matrix()

#### new Matrix()

MaiaScript matrix library.

Source:
  - Matrix.js, line 24

### Methods

#### avg(mtx, r1, c1, r2, c2) → {number}

Returns the mean and standard deviation of the values contained in a matrix.

##### Parameters:

Name | Type | Description
--- | --- | ---
`mtx` | object | The matrix.
`r1` | number | First row.
`c1` | number | First column.
`r2` | number | Last row.
`c2` | number | Last column.

Source:
  - Matrix.js, line 43

##### Returns:

Mean and standard deviation of the values contained in a matrix.

Type
  number

#### count(mtx, r1, c1, r2, c2) → {number}

Returns the number of non-zero elements in the matrix.

##### Parameters:

Name | Type | Description
--- | --- | ---
`mtx` | object | The matrix.
`r1` | number | First row.
`c1` | number | First column.
`r2` | number | Last row.
`c2` | number | Last column.

Source:
  - Matrix.js, line 121

##### Returns:

The number of non-zero elements in the matrix.

Type
  number

#### cross(a, b) → {array}

Calculates the cross product of two vectors A and B.

##### Parameters:

Name | Type | Description
--- | --- | ---
`a` | object | The matrix A.
`b` | object | The matrix B.

Source:
  - Matrix.js, line 184

##### Returns:

A (rows x columns) matrix.

Type
  array

#### dot(a, b) → {array}

Calculates the dot product of two vectors A and B.

##### Parameters:

Name | Type | Description
--- | --- | ---
`a` | object | The matrix A.
`b` | object | The matrix B.

Source:
  - Matrix.js, line 215

##### Returns:

A (rows x columns) matrix.

Type
  array

#### max(mtx, r1, c1, r2, c2) → {number}

Returns the largest value in an array.

##### Parameters:

Name | Type | Description
--- | --- | ---
`mtx` | object | The matrix.
`r1` | number | First row.
`c1` | number | First column.
`r2` | number | Last row.
`c2` | number | Last column.

Source:
  - Matrix.js, line 245

##### Returns:

The smallest value in an array.

Type
  number

#### min(mtx, r1, c1, r2, c2) → {number}

Returns the smallest value in an array.

##### Parameters:

Name | Type | Description
--- | --- | ---
`mtx` | object | The matrix.
`r1` | number | First row.
`c1` | number | First column.
`r2` | number | Last row.
`c2` | number | Last column.

Source:
  - Matrix.js, line 319

##### Returns:

The smallest value in an array.

Type
  number

#### sum(mtx, r1, c1, r2, c2) → {number}

Calculates the sum of all cells in the matrix.

##### Parameters:

Name | Type | Description
--- | --- | ---
`mtx` | object | The matrix.
`r1` | number | First row.
`c1` | number | First column.
`r2` | number | Last row.
`c2` | number | Last column.

Source:
  - Matrix.js, line 392

##### Returns:

Sum of the values contained in a matrix.

Type
  number

#### sum2(mtx, r1, c1, r2, c2) → {number}

Calculates the squared sum of all cells in the matrix.

##### Parameters:

Name | Type | Description
--- | --- | ---
`mtx` | object | The matrix.
`r1` | number | First row.
`c1` | number | First column.
`r2` | number | Last row.
`c2` | number | Last column.

Source:
  - Matrix.js, line 456

##### Returns:

Sum of the values contained in a matrix.

Type
  number

#### trans(mtx, r1, c1, r2, c2) → {number}

Returns the transpose of an array.

##### Parameters:

Name | Type | Description
--- | --- | ---
`mtx` | object | The matrix.
`r1` | number | First row.
`c1` | number | First column.
`r2` | number | Last row.
`c2` | number | Last column.

Source:
  - Matrix.js, line 520

##### Returns:

The transpose of an array.

Type
  number

#### triang(mtx) → {array}

Calculates the triangular equivalent matrix.

##### Parameters:

Name | Type | Description
--- | --- | ---
`mtx` | object | The matrix to calculate the triangular equivalent matrix.

Source:
  - Matrix.js, line 562

##### Returns:

A (rows x columns) matrix.

Type
  array

#### (inner) init()

Creates the attributes of the class.

Source:
  - Matrix.js, line 30