summaryrefslogblamecommitdiffstats
path: root/vendor/markbaker/matrix/classes/src/Decomposition/Decomposition.php
blob: d4e76f92d9647e3fe54ee3bac1a9f8c10fe15eda (plain) (tree)


























                                                                
<?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');
        }
    }
}