You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
530 B
27 lines
530 B
<?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'); |
|
} |
|
} |
|
}
|
|
|