Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402]
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: | 423 lines (12 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
Matrix:: (19 methods):
__construct()
buildFromArray()
validateRow()
validateColumn()
validateRowInRange()
validateColumnInRange()
getRows()
getColumns()
dropRows()
dropColumns()
getValue()
rows()
columns()
isSquare()
isVector()
toArray()
solve()
__get()
__call()
__construct(array $grid) X-Ref |
No description |
buildFromArray(array $grid) X-Ref |
No description |
validateRow(int $row) X-Ref |
No description |
validateColumn(int $column) X-Ref |
Validate that a column number is a positive integer param: int $column return: int |
validateRowInRange(int $row) X-Ref |
Validate that a row number falls within the set of rows for this matrix param: int $row return: int |
validateColumnInRange(int $column) X-Ref |
Validate that a column number falls within the set of columns for this matrix param: int $column return: int |
getRows(int $row, int $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(int $column, int $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(int $row, int $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(int $column, int $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(int $row, int $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 column 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 row 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 |
solve(Matrix $B) X-Ref |
Solve A*X = B. param: Matrix $B Right hand side return: Matrix ... Solution if A is square, least squares solution otherwise |
__get(string $propertyName) X-Ref |
Access specific properties as read-only (no setters) param: string $propertyName return: mixed |
__call(string $functionName, $arguments) X-Ref |
Returns the result of the function call or operation param: string $functionName param: mixed[] $arguments return: Matrix|float |