public static function create(array $A, int $n = null) : Matrix
{
self::checkParams($A, $n);
$matrix_type = self::determineMatrixType($A, $n);
switch ($matrix_type) {
case 'matrix':
return new Matrix($A);
case 'square':
return new SquareMatrix($A);
case 'diagonal':
return new DiagonalMatrix($A);
case 'vandermonde':
return new VandermondeMatrix($A, $n);
case 'function':
return new FunctionMatrix($A);
case 'vandermonde_square':
return new VandermondeSquareMatrix($A, $n);
case 'function_square':
return new FunctionSquareMatrix($A);
}
throw new Exception\IncorrectTypeException('Unknown matrix type');
}