Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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

(no description)

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

Defines 1 class

Matrix:: (23 methods):
  __construct()
  fromFlatArray()
  toArray()
  toScalar()
  getRows()
  getColumns()
  getColumnValues()
  getDeterminant()
  isSquare()
  transpose()
  multiply()
  divideByScalar()
  multiplyByScalar()
  add()
  subtract()
  inverse()
  crossOut()
  isSingular()
  frobeniusNorm()
  transposeArray()
  dot()
  sum()
  getIdentity()


Class: Matrix  - X-Ref

__construct(array $matrix, bool $validate = true)   X-Ref


fromFlatArray(array $array)   X-Ref
No description

toArray()   X-Ref
No description

toScalar()   X-Ref
No description

getRows()   X-Ref
No description

getColumns()   X-Ref
No description

getColumnValues(int $column)   X-Ref


getDeterminant()   X-Ref

return: float|int

isSquare()   X-Ref
No description

transpose()   X-Ref
No description

multiply(self $matrix)   X-Ref
No description

divideByScalar($value)   X-Ref

param: float|int $value

multiplyByScalar($value)   X-Ref

param: float|int $value

add(self $other)   X-Ref
Element-wise addition of the matrix with another one


subtract(self $other)   X-Ref
Element-wise subtracting of another matrix from this one


inverse()   X-Ref
No description

crossOut(int $row, int $column)   X-Ref
No description

isSingular()   X-Ref
No description

frobeniusNorm()   X-Ref
Frobenius norm (Hilbert–Schmidt norm, Euclidean norm) (‖A‖F)
Square root of the sum of the square of all elements.

https://en.wikipedia.org/wiki/Matrix_norm#Frobenius_norm

_____________
/ᵐ   ⁿ
‖A‖F = √ Σ   Σ  |aᵢⱼ|²
ᵢ₌₁ ᵢ₌₁

transposeArray(array $array)   X-Ref
Returns the transpose of given array


dot(array $array1, array $array2)   X-Ref
Returns the dot product of two arrays<br>
Matrix::dot(x, y) ==> x.y'


sum(self $other, int $sign = 1)   X-Ref
Element-wise addition or substraction depending on the given sign parameter


getIdentity()   X-Ref
Returns diagonal identity matrix of the same size of this matrix