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.
   1  <?php
   2  
   3  namespace Matrix\Decomposition;
   4  
   5  use Matrix\Exception;
   6  use Matrix\Matrix;
   7  
   8  class Decomposition
   9  {
  10      const LU = 'LU';
  11      const QR = 'QR';
  12  
  13      /**
  14       * @throws Exception
  15       */
  16      public static function decomposition($type, Matrix $matrix)
  17      {
  18          switch (strtoupper($type)) {
  19              case self::LU:
  20                  return new LU($matrix);
  21              case self::QR:
  22                  return new QR($matrix);
  23              default:
  24                  throw new Exception('Invalid Decomposition');
  25          }
  26      }
  27  }