|
Moodle PHP Documentation 4.5
Moodle 4.5.5+ (Build: 20250711) (ce34e8ff087)
|
A simple 2D-Matrix class. More...
Public Member Functions | |
| __construct ($a=1, $b=0, $c=0, $d=1, $e=0, $f=0) | |
| __construct (array $grid) | |
| __call (string $functionName, $arguments) | |
| Returns the result of the function call or operation. | |
| __get (string $propertyName) | |
| Access specific properties as read-only (no setters) | |
| columns () | |
| Returns a Generator that will yield each column of the matrix in turn as a vector matrix or the value of each cell if the matrix is a row vector. | |
| dropColumns (int $column, int $columnCount=1) | |
| Return a new matrix as a subset of columns from this matrix, dropping columns starting at column number $column, and $columnCount columns A negative $columnCount value will drop columns until that many columns from the end of the matrix A $columnCount value of 0 will remove all columns of the matrix from $column. | |
| dropRows (int $row, int $rowCount=1) | |
| Return a new matrix as a subset of rows from this matrix, dropping rows starting at row number $row, and $rowCount rows A negative $rowCount value will drop rows until that many rows from the end of the matrix A $rowCount value of 0 will remove all rows of the matrix from $row. | |
| getColumns (int $column, int $columnCount=1) | |
| Return a new matrix as a subset of columns from this matrix, starting at column number $column, and $columnCount columns A $columnCount value of 0 will return all columns of the matrix from $column A negative $columnCount value will return columns until that many columns from the end of the matrix. | |
| getRows (int $row, int $rowCount=1) | |
| Return a new matrix as a subset of rows from this matrix, starting at row number $row, and $rowCount rows A $rowCount value of 0 will return all rows of the matrix from $row A negative $rowCount value will return rows until that many rows from the end of the matrix. | |
| getValue (int $row, int $column) | |
| Return a value from this matrix, from the "cell" identified by the row and column numbers Note that row and column numbers start from 1, not from 0. | |
| getValues () | |
| isSquare () | |
| Identify if the row and column dimensions of this matrix are equal, i.e. | |
| isVector () | |
| Identify if this matrix is a vector i.e. | |
| multiply (self $by) | |
| rows () | |
| Returns a Generator that will yield each row of the matrix in turn as a vector matrix or the value of each cell if the matrix is a column vector. | |
| solve (Matrix $B) | |
| Solve A*X = B. | |
| toArray () | |
| Return the matrix as a 2-dimensional array. | |
Static Public Member Functions | |
| static | validateColumn (int $column) |
| Validate that a column number is a positive integer. | |
| static | validateRow (int $row) |
| Validate that a row number is a positive integer. | |
Protected Member Functions | |
| buildFromArray (array $grid) | |
| validateColumnInRange (int $column) | |
| Validate that a column number falls within the set of columns for this matrix. | |
| validateRowInRange (int $row) | |
| Validate that a row number falls within the set of rows for this matrix. | |
Protected Attributes | |
| float | $a |
| float | $b |
| float | $c |
| $columns | |
| float | $d |
| float | $e |
| float | $f |
| $grid = [] | |
| $rows | |
Static Protected Attributes | |
| static | $functions |
| static | $getters |
| static | $operations |
A simple 2D-Matrix class.
| Matrix::__construct | ( | $a = 1, | |
| $b = 0, | |||
| $c = 0, | |||
| $d = 1, | |||
| $e = 0, | |||
| $f = 0 ) |
| int | float | $a | |
| int | float | $b | |
| int | float | $c | |
| int | float | $d | |
| int | float | $e | |
| int | float | $f |
| Matrix::__call | ( | string | $functionName, |
| $arguments ) |
Returns the result of the function call or operation.
| string | $functionName | |
| mixed[] | $arguments |
| Matrix|float |
| Exception |
| Matrix::__get | ( | string | $propertyName | ) |
Access specific properties as read-only (no setters)
| string | $propertyName |
| mixed |
| Exception |
| Matrix::columns | ( | ) |
Returns a Generator that will yield each column of the matrix in turn as a vector matrix or the value of each cell if the matrix is a row vector.
| Generator|Matrix[]|mixed[] |
| Matrix::dropColumns | ( | int | $column, |
| int | $columnCount = 1 ) |
Return a new matrix as a subset of columns from this matrix, dropping columns starting at column number $column, and $columnCount columns A negative $columnCount value will drop columns until that many columns from the end of the matrix A $columnCount value of 0 will remove all columns of the matrix from $column.
Note that column numbers start from 1, not from 0
| int | $column | |
| int | $columnCount |
| static |
| Exception |
| Matrix::dropRows | ( | int | $row, |
| int | $rowCount = 1 ) |
Return a new matrix as a subset of rows from this matrix, dropping rows starting at row number $row, and $rowCount rows A negative $rowCount value will drop rows until that many rows from the end of the matrix A $rowCount value of 0 will remove all rows of the matrix from $row.
Note that row numbers start from 1, not from 0
| int | $row | |
| int | $rowCount |
| static |
| Exception |
| Matrix::getColumns | ( | int | $column, |
| int | $columnCount = 1 ) |
Return a new matrix as a subset of columns from this matrix, starting at column number $column, and $columnCount columns A $columnCount value of 0 will return all columns of the matrix from $column A negative $columnCount value will return columns until that many columns from the end of the matrix.
Note that column numbers start from 1, not from 0
| int | $column | |
| int | $columnCount |
| Matrix |
| Exception |
| Matrix::getRows | ( | int | $row, |
| int | $rowCount = 1 ) |
Return a new matrix as a subset of rows from this matrix, starting at row number $row, and $rowCount rows A $rowCount value of 0 will return all rows of the matrix from $row A negative $rowCount value will return rows until that many rows from the end of the matrix.
Note that row numbers start from 1, not from 0
| int | $row | |
| int | $rowCount |
| static |
| Exception |
| Matrix::getValue | ( | int | $row, |
| int | $column ) |
Return a value from this matrix, from the "cell" identified by the row and column numbers Note that row and column numbers start from 1, not from 0.
| int | $row | |
| int | $column |
| mixed |
| Exception |
| Matrix::getValues | ( | ) |
| float[] |
| Matrix::isSquare | ( | ) |
Identify if the row and column dimensions of this matrix are equal, i.e.
if it is a "square" matrix
| bool |
| Matrix::isVector | ( | ) |
Identify if this matrix is a vector i.e.
if it comprises only a single row or a single column
| bool |
| Matrix::rows | ( | ) |
Returns a Generator that will yield each row of the matrix in turn as a vector matrix or the value of each cell if the matrix is a column vector.
| Generator|Matrix[]|mixed[] |
| Matrix::solve | ( | Matrix | $B | ) |
| Matrix::toArray | ( | ) |
Return the matrix as a 2-dimensional array.
| array |
|
static |
Validate that a column number is a positive integer.
| int | $column |
| int |
| Exception |
|
protected |
Validate that a column number falls within the set of columns for this matrix.
| int | $column |
| int |
| Exception |
|
static |
Validate that a row number is a positive integer.
| int | $row |
| int |
| Exception |
|
protected |
Validate that a row number falls within the set of rows for this matrix.
| int | $row |
| int |
| Exception |
|
staticprotected |
|
staticprotected |
|
staticprotected |