private static function checkParams(array $A, int $n = null) : bool
{
if (empty($A)) {
throw new Exception\BadDataException('Array data not provided for Matrix creation');
}
if (isset($A[0]) && is_array($A[0])) {
$column_count = count($A[0]);
foreach ($A as $i => $row) {
if (count($row) !== $column_count) {
throw new Exception\MatrixException("Row {$i} has a different column count: " . count($row) . "; was expecting {$column_count}.");
}
}
}
return true;
}