Functions
in package
Table of Contents
Methods
- adjoint() : Matrix
- Return the adjoint of this matrix The adjugate, classical adjoint, or adjunct of a square matrix is the transpose of its cofactor matrix.
- antidiagonal() : Matrix
- Return the antidiagonal of this matrix
- cofactors() : Matrix
- Return the cofactors of this matrix
- determinant() : float
- Return the determinant of this matrix
- diagonal() : Matrix
- Return the diagonal of this matrix
- identity() : 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
- inverse() : Matrix
- Return the inverse of this matrix
- minors() : 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.
- trace() : float
- 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
- transpose() : Matrix
- Return the transpose of this matrix
- getMinors() : array<string|int, array<string|int, mixed>>
- Calculate the minors of the matrix
- getAdjoint() : Matrix
- Calculate the adjoint of the matrix
- getCofactors() : Matrix
- Calculate the cofactors of the matrix
- getDeterminant() : float
- Calculate the determinant of the matrix
- getDeterminantSegment() : float
- validateMatrix() : Matrix
- Validates an array of matrix, converting an array to a matrix if required.
Methods
adjoint()
Return the adjoint of this matrix The adjugate, classical adjoint, or adjunct of a square matrix is the transpose of its cofactor matrix.
public
static adjoint(Matrix|array<string|int, mixed> $matrix) : 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|array<string|int, mixed>
-
The matrix whose adjoint we wish to calculate
Tags
Return values
Matrixantidiagonal()
Return the antidiagonal of this matrix
public
static antidiagonal(Matrix|array<string|int, mixed> $matrix) : Matrix
Parameters
- $matrix : Matrix|array<string|int, mixed>
-
The matrix whose antidiagonal we wish to calculate
Tags
Return values
Matrixcofactors()
Return the cofactors of this matrix
public
static cofactors(Matrix|array<string|int, mixed> $matrix) : Matrix
Parameters
- $matrix : Matrix|array<string|int, mixed>
-
The matrix whose cofactors we wish to calculate
Tags
Return values
Matrixdeterminant()
Return the determinant of this matrix
public
static determinant(Matrix|array<string|int, mixed> $matrix) : float
Parameters
- $matrix : Matrix|array<string|int, mixed>
-
The matrix whose determinant we wish to calculate
Tags
Return values
floatdiagonal()
Return the diagonal of this matrix
public
static diagonal(Matrix|array<string|int, mixed> $matrix) : Matrix
Parameters
- $matrix : Matrix|array<string|int, mixed>
-
The matrix whose diagonal we wish to calculate
Tags
Return values
Matrixidentity()
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
public
static identity(Matrix|array<string|int, mixed> $matrix) : Matrix
Parameters
- $matrix : Matrix|array<string|int, mixed>
-
The matrix whose identity we wish to calculate
Tags
Return values
Matrixinverse()
Return the inverse of this matrix
public
static inverse(Matrix|array<string|int, mixed> $matrix[, string $type = 'inverse' ]) : Matrix
Parameters
- $matrix : Matrix|array<string|int, mixed>
-
The matrix whose inverse we wish to calculate
- $type : string = 'inverse'
Tags
Return values
Matrixminors()
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.
public
static minors(Matrix|array<string|int, mixed> $matrix) : Matrix
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|array<string|int, mixed>
-
The matrix whose minors we wish to calculate
Tags
Return values
Matrixtrace()
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
public
static trace(Matrix|array<string|int, mixed> $matrix) : float
Parameters
- $matrix : Matrix|array<string|int, mixed>
-
The matrix whose trace we wish to calculate
Tags
Return values
floattranspose()
Return the transpose of this matrix
public
static transpose(Matrix|a $matrix) : Matrix
Parameters
- $matrix : Matrix|a
-
The matrix whose transpose we wish to calculate
Return values
MatrixgetMinors()
Calculate the minors of the matrix
protected
static getMinors(Matrix $matrix) : array<string|int, array<string|int, mixed>>
Parameters
- $matrix : Matrix
-
The matrix whose minors we wish to calculate
Tags
Return values
array<string|int, array<string|int, mixed>>getAdjoint()
Calculate the adjoint of the matrix
private
static getAdjoint(Matrix $matrix) : Matrix
Parameters
- $matrix : Matrix
-
The matrix whose adjoint we wish to calculate
Tags
Return values
MatrixgetCofactors()
Calculate the cofactors of the matrix
private
static getCofactors(Matrix $matrix) : Matrix
Parameters
- $matrix : Matrix
-
The matrix whose cofactors we wish to calculate
Tags
Return values
MatrixgetDeterminant()
Calculate the determinant of the matrix
private
static getDeterminant(Matrix $matrix) : float
Parameters
- $matrix : Matrix
-
The matrix whose determinant we wish to calculate
Tags
Return values
floatgetDeterminantSegment()
private
static getDeterminantSegment(Matrix $matrix, int $row, int $column) : float
Parameters
- $matrix : Matrix
- $row : int
- $column : int
Tags
Return values
floatvalidateMatrix()
Validates an array of matrix, converting an array to a matrix if required.
private
static validateMatrix(Matrix|array<string|int, mixed> $matrix) : Matrix
Parameters
- $matrix : Matrix|array<string|int, mixed>
-
Matrix or an array to treat as a matrix.
Tags
Return values
Matrix —The new matrix