|
static | adjoint (Matrix $matrix) |
| Return the adjoint of this matrix The adjugate, classical adjoint, or adjunct of a square matrix is the transpose of its cofactor matrix. More...
|
|
static | cofactors (Matrix $matrix) |
| Return the cofactors of this matrix. More...
|
|
static | determinant (Matrix $matrix) |
| Return the determinant of this matrix. More...
|
|
static | diagonal (Matrix $matrix) |
| Return the diagonal of this matrix. More...
|
|
static | antidiagonal (Matrix $matrix) |
| Return the antidiagonal of this matrix. More...
|
|
static | identity (Matrix $matrix) |
| Return the identity matrix The identity matrix, or sometimes ambiguously called a unit matrix, of size n is the n × n square matrix with ones on the main diagonal and zeros elsewhere. More...
|
|
static | inverse (Matrix $matrix, string $type='inverse') |
| Return the inverse of this matrix. More...
|
|
static | minors (Matrix $matrix) |
| Return the minors of the matrix The minor of a matrix A is the determinant of some smaller square matrix, cut down from A by removing one or more of its rows or columns. More...
|
|
static | trace (Matrix $matrix) |
| Return the trace of this matrix The trace is defined as the sum of the elements on the main diagonal (the diagonal from the upper left to the lower right) of the matrix. More...
|
|
static | transpose (Matrix $matrix) |
| Return the transpose of this matrix. More...
|
|
Definition at line 5 of file Functions.php.
◆ adjoint()
static Matrix\Functions::adjoint |
( |
Matrix |
$matrix | ) |
|
|
static |
Return the adjoint of this matrix The adjugate, classical adjoint, or adjunct of a square matrix is the transpose of its cofactor matrix.
The adjugate has sometimes been called the "adjoint", but today the "adjoint" of a matrix normally refers to its corresponding adjoint operator, which is its conjugate transpose.
- Parameters
-
Matrix | $matrix | The matrix whose adjoint we wish to calculate |
- Returns
- Matrix
- Exceptions
-
Definition at line 32 of file Functions.php.
References Matrix\Matrix\isSquare().
35 throw new Exception(
'Adjoint can only be calculated for a square matrix');
38 return self::getAdjoint(
$matrix);
◆ antidiagonal()
static Matrix\Functions::antidiagonal |
( |
Matrix |
$matrix | ) |
|
|
static |
Return the antidiagonal of this matrix.
- Parameters
-
Matrix | $matrix | The matrix whose antidiagonal we wish to calculate |
- Returns
- Matrix
- Exceptions
-
Definition at line 188 of file Functions.php.
References $grid, $i, Matrix\Matrix\getValue(), Matrix\Matrix\isSquare(), and Matrix\Matrix\rows().
191 throw new Exception(
'Anti-Diagonal can only be extracted from a square matrix');
198 for (
$i = 0;
$i < $dimensions; ++
$i) {
static createFilledMatrix($fillValue, $rows, $columns=null)
Create a new matrix of specified dimensions, and filled with a specified value If the column argument...
Class for the creating "special" Matrices.
◆ cofactors()
static Matrix\Functions::cofactors |
( |
Matrix |
$matrix | ) |
|
|
static |
◆ determinant()
static Matrix\Functions::determinant |
( |
Matrix |
$matrix | ) |
|
|
static |
Return the determinant of this matrix.
- Parameters
-
Matrix | $matrix | The matrix whose determinant we wish to calculate |
- Returns
- float
- Exceptions
-
Definition at line 148 of file Functions.php.
References Matrix\Matrix\isSquare().
151 throw new Exception(
'Determinant can only be calculated for a square matrix');
154 return self::getDeterminant(
$matrix);
◆ diagonal()
static Matrix\Functions::diagonal |
( |
Matrix |
$matrix | ) |
|
|
static |
Return the diagonal of this matrix.
- Parameters
-
Matrix | $matrix | The matrix whose diagonal we wish to calculate |
- Returns
- Matrix
- Exceptions
-
Definition at line 164 of file Functions.php.
References $grid, $i, Matrix\Matrix\getValue(), Matrix\Matrix\isSquare(), and Matrix\Matrix\rows().
167 throw new Exception(
'Diagonal can only be extracted from a square matrix');
174 for (
$i = 0;
$i < $dimensions; ++
$i) {
static createFilledMatrix($fillValue, $rows, $columns=null)
Create a new matrix of specified dimensions, and filled with a specified value If the column argument...
Class for the creating "special" Matrices.
◆ getAdjoint()
static Matrix\Functions::getAdjoint |
( |
Matrix |
$matrix | ) |
|
|
staticprivate |
Calculate the adjoint of the matrix.
- Parameters
-
Matrix | $matrix | The matrix whose adjoint we wish to calculate |
- Returns
- Matrix
- Exceptions
-
Definition at line 15 of file Functions.php.
17 return self::transpose(
◆ getCofactors()
static Matrix\Functions::getCofactors |
( |
Matrix |
$matrix | ) |
|
|
staticprivate |
Calculate the cofactors of the matrix.
- Parameters
-
Matrix | $matrix | The matrix whose cofactors we wish to calculate |
- Returns
- Matrix
- Exceptions
-
Definition at line 49 of file Functions.php.
References $i, and Matrix\Matrix\rows().
51 $cofactors = self::getMinors(
$matrix);
55 for (
$i = 0;
$i < $dimensions; ++
$i) {
57 for ($j = 0; $j < $dimensions; ++$j) {
58 $cofactors[
$i][$j] *= $cofs;
64 return new Matrix($cofactors);
Class for the creating "special" Matrices.
◆ getDeterminant()
static Matrix\Functions::getDeterminant |
( |
Matrix |
$matrix | ) |
|
|
staticprivate |
Calculate the determinant of the matrix.
- Parameters
-
Matrix | $matrix | The matrix whose determinant we wish to calculate |
- Returns
- float
- Exceptions
-
Definition at line 113 of file Functions.php.
References $i, Matrix\Matrix\getValue(), and Matrix\Matrix\rows().
118 switch ($dimensions) {
120 $determinant =
$matrix->getValue(1, 1);
123 $determinant =
$matrix->getValue(1, 1) *
$matrix->getValue(2, 2) -
127 for (
$i = 1;
$i <= $dimensions; ++
$i) {
130 $determinant -= $det;
132 $determinant += $det;
◆ getDeterminantSegment()
static Matrix\Functions::getDeterminantSegment |
( |
Matrix |
$matrix, |
|
|
|
$row, |
|
|
|
$column |
|
) |
| |
|
staticprivate |
- Parameters
-
Matrix | $matrix | |
int | $row | |
int | $column | |
- Returns
- float
- Exceptions
-
Definition at line 91 of file Functions.php.
References $row, and Matrix\Matrix\toArray().
93 $tmpMatrix =
$matrix->toArray();
94 unset($tmpMatrix[
$row]);
97 function (&
$row) use ($column) {
102 return self::getDeterminant(
new Matrix($tmpMatrix));
Class for the creating "special" Matrices.
◆ getMinors()
static Matrix\Functions::getMinors |
( |
Matrix |
$matrix | ) |
|
|
staticprotected |
Calculate the minors of the matrix.
- Parameters
-
Matrix | $matrix | The matrix whose minors we wish to calculate |
- Returns
- array[]
- Exceptions
-
Definition at line 259 of file Functions.php.
References $i, Matrix\Matrix\rows(), and Matrix\Matrix\toArray().
263 if ($dimensions == 1) {
267 for (
$i = 0;
$i < $dimensions; ++
$i) {
268 for ($j = 0; $j < $dimensions; ++$j) {
269 $minors[
$i][$j] = self::getDeterminantSegment(
$matrix,
$i, $j);
◆ identity()
static Matrix\Functions::identity |
( |
Matrix |
$matrix | ) |
|
|
static |
Return the identity matrix The identity matrix, or sometimes ambiguously called a unit matrix, of size n is the n × n square matrix with ones on the main diagonal and zeros elsewhere.
- Parameters
-
Matrix | $matrix | The matrix whose identity we wish to calculate |
- Returns
- Matrix
- Exceptions
-
Definition at line 214 of file Functions.php.
References Matrix\Matrix\isSquare(), and Matrix\Matrix\rows().
217 throw new Exception(
'Identity can only be created for a square matrix');
static createIdentityMatrix($dimensions, $fillValue=null)
Create a new identity matrix of specified dimensions This will always be a square matrix...
◆ inverse()
static Matrix\Functions::inverse |
( |
Matrix |
$matrix, |
|
|
string |
$type = 'inverse' |
|
) |
| |
|
static |
◆ minors()
static Matrix\Functions::minors |
( |
Matrix |
$matrix | ) |
|
|
static |
Return the minors of the matrix The minor of a matrix A is the determinant of some smaller square matrix, cut down from A by removing one or more of its rows or columns.
Minors obtained by removing just one row and one column from square matrices (first minors) are required for calculating matrix cofactors, which in turn are useful for computing both the determinant and inverse of square matrices.
- Parameters
-
Matrix | $matrix | The matrix whose minors we wish to calculate |
- Returns
- Matrix
- Exceptions
-
Definition at line 288 of file Functions.php.
References Matrix\Matrix\isSquare().
291 throw new Exception(
'Minors can only be calculated for a square matrix');
Class for the creating "special" Matrices.
◆ trace()
static Matrix\Functions::trace |
( |
Matrix |
$matrix | ) |
|
|
static |
◆ transpose()
static Matrix\Functions::transpose |
( |
Matrix |
$matrix | ) |
|
|
static |
Return the transpose of this matrix.
- Parameters
-
Matrix | $matrix | The matrix whose transpose we wish to calculate |
- Returns
- Matrix
Definition at line 327 of file Functions.php.
References $grid, and Matrix\Matrix\toArray().
329 $array = array_values(array_merge([null],
$matrix->toArray()));
330 $grid = call_user_func_array(
Class for the creating "special" Matrices.
The documentation for this class was generated from the following file: