Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]
Class for the management of Matrices
Copyright: | Copyright (c) 2018 Mark Baker (https://github.com/MarkBaker/PHPMatrix) |
License: | https://opensource.org/licenses/MIT MIT |
File Size: | 400 lines (11 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
Matrix:: (18 methods):
__construct()
buildFromArray()
validateRow()
validateColumn()
validateRowInRange()
validateColumnInRange()
getRows()
getColumns()
dropRows()
dropColumns()
getValue()
rows()
columns()
isSquare()
isVector()
toArray()
__get()
__call()
__construct(array $grid) X-Ref |
No description |
buildFromArray(array $grid) X-Ref |
No description |
validateRow($row) X-Ref |
No description |
validateColumn($column) X-Ref |
Validate that a column number is a positive integer param: int $column return: int |
validateRowInRange($row) X-Ref |
Validate that a row number falls within the set of rows for this matrix param: int $row return: int |
validateColumnInRange($column) X-Ref |
Validate that a column number falls within the set of columns for this matrix param: int $column return: int |
getRows($row, $rowCount = 1) X-Ref |
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 param: int $row param: int $rowCount return: static |
getColumns($column, $columnCount = 1) X-Ref |
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 param: int $column param: int $columnCount return: Matrix |
dropRows($row, $rowCount = 1) X-Ref |
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 param: int $row param: int $rowCount return: static |
dropColumns($column, $columnCount = 1) X-Ref |
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 param: int $column param: int $columnCount return: static |
getValue($row, $column) X-Ref |
No description |
rows() X-Ref |
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 vector return: \Generator|Matrix[]|mixed[] |
columns() X-Ref |
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 vector return: \Generator|Matrix[]|mixed[] |
isSquare() X-Ref |
Identify if the row and column dimensions of this matrix are equal, i.e. if it is a "square" matrix return: bool |
isVector() X-Ref |
Identify if this matrix is a vector i.e. if it comprises only a single row or a single column return: bool |
toArray() X-Ref |
Return the matrix as a 2-dimensional array return: array |
__get($propertyName) X-Ref |
Access specific properties as read-only (no setters) param: string $propertyName return: mixed |
__call($functionName, $arguments) X-Ref |
Returns the result of the function call or operation param: string $functionName param: mixed[] $arguments return: Matrix|float |