Blame view

vendor/markbaker/matrix/classes/src/Decomposition/Decomposition.php 530 Bytes
2db47680   hexiaodong   chore: 初始提交 php 遗...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  <?php
  
  namespace Matrix\Decomposition;
  
  use Matrix\Exception;
  use Matrix\Matrix;
  
  class Decomposition
  {
      const LU = 'LU';
      const QR = 'QR';
  
      /**
       * @throws Exception
       */
      public static function decomposition($type, Matrix $matrix)
      {
          switch (strtoupper($type)) {
              case self::LU:
                  return new LU($matrix);
              case self::QR:
                  return new QR($matrix);
              default:
                  throw new Exception('Invalid Decomposition');
          }
      }
  }