public function __construct(array $A)
{
$this->A = $A;
$this->m = count($A);
$this->n = $this->m > 0 ? count($A[0]) : 0;
foreach ($A as $i => $row) {
if (count($row) !== $this->n) {
throw new Exception\BadDataException("Row {$i} has a different column count: " . count($row) . "; was expecting {$this->n}.");
}
}
}