src/Malenki/Math/Matrix.php
public function isDiagonal()
    {
        $int_size = min((array) $this->size);

        if($int_size > 0){
            for($i = 0; $i < $int_size; $i++){
                $arr_row = $this->getRow($i);

                if($arr_row[$i] != 0){
                    unset($arr_row[$i]);

                    foreach($arr_row as $v){
                        if($v != 0){
                            return false;
                        }
                    }

                } else {
                    return false;
                }
            }

            return true;
        }

        return false;
    }
public function isDiagonal()
    {
        $int_size = min((array) $this->size);

        if($int_size > 0){
            for($i = 0; $i < $int_size; $i++){
                $arr_row = $this->getRow($i);

                if($arr_row[$i] != 0){
                    unset($arr_row[$i]);

                    foreach($arr_row as $v){
                        if($v != 0){
                            return false;
                        }
                    }

                } else {
                    return false;
                }
            }

            return true;
        }

        return false;
    }
Tests whether the current matrix is diagonal or not.

@access public
@return boolean