Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401]

(no description)

File Size: 376 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Functions:: (16 methods):
  validateMatrix()
  getAdjoint()
  adjoint()
  getCofactors()
  cofactors()
  getDeterminantSegment()
  getDeterminant()
  determinant()
  diagonal()
  antidiagonal()
  identity()
  inverse()
  getMinors()
  minors()
  trace()
  transpose()


Class: Functions  - X-Ref

validateMatrix($matrix)   X-Ref
Validates an array of matrix, converting an array to a matrix if required.

param: Matrix|array $matrix Matrix or an array to treat as a matrix.
return: Matrix The new matrix

getAdjoint(Matrix $matrix)   X-Ref
Calculate the adjoint of the matrix

param: Matrix $matrix The matrix whose adjoint we wish to calculate
return: Matrix

adjoint($matrix)   X-Ref
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.

param: Matrix|array $matrix The matrix whose adjoint we wish to calculate
return: Matrix

getCofactors(Matrix $matrix)   X-Ref
Calculate the cofactors of the matrix

param: Matrix $matrix The matrix whose cofactors we wish to calculate
return: Matrix

cofactors($matrix)   X-Ref
Return the cofactors of this matrix

param: Matrix|array $matrix The matrix whose cofactors we wish to calculate
return: Matrix

getDeterminantSegment(Matrix $matrix, $row, $column)   X-Ref

param: Matrix $matrix
param: int $row
param: int $column
return: float

getDeterminant(Matrix $matrix)   X-Ref
No description

determinant($matrix)   X-Ref
Return the determinant of this matrix

param: Matrix|array $matrix The matrix whose determinant we wish to calculate
return: float

diagonal($matrix)   X-Ref
Return the diagonal of this matrix

param: Matrix|array $matrix The matrix whose diagonal we wish to calculate
return: Matrix

antidiagonal($matrix)   X-Ref
Return the antidiagonal of this matrix

param: Matrix|array $matrix The matrix whose antidiagonal we wish to calculate
return: Matrix

identity($matrix)   X-Ref
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

param: Matrix|array $matrix The matrix whose identity we wish to calculate
return: Matrix

inverse($matrix, string $type = 'inverse')   X-Ref
Return the inverse of this matrix

param: Matrix|array $matrix The matrix whose inverse we wish to calculate
return: Matrix

getMinors(Matrix $matrix)   X-Ref
Calculate the minors of the matrix

param: Matrix $matrix The matrix whose minors we wish to calculate
return: array[]

minors($matrix)   X-Ref
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.

param: Matrix|array $matrix The matrix whose minors we wish to calculate
return: Matrix

trace($matrix)   X-Ref
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

param: Matrix|array $matrix The matrix whose trace we wish to calculate
return: float

transpose($matrix)   X-Ref
Return the transpose of this matrix

param: Matrix|\a $matrix The matrix whose transpose we wish to calculate
return: Matrix