Added independent symmetry check

This commit is contained in:
Dennis Eichhorn 2018-05-31 17:38:36 +02:00
parent 31209d2b30
commit e611105b60

View File

@ -278,7 +278,14 @@ class Matrix implements \ArrayAccess, \Iterator
*/
public function isSymmetric() : bool
{
return (new EigenvalueDecomposition($this))->isSymmetric();
$isSymmetric = true;
for ($j = 0; ($j < $this->m) & $isSymmetric; ++$j) {
for ($i = 0; ($i < $this->n) & $isSymmetric; ++$i) {
$isSymmetric = ($this->matrix[$i][$j] === $this->matrix[$j][$i]);
}
}
return $isSymmetric;
}
/**