Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]

(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()
  _add()
  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'


_add(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