public function diagonalAsVector() : Vector
    {
        if (!$this->isSquare()) {
            throw new RuntimeException('Cannot trace diagonal of a'
                . ' non square matrix.');
        }

        $b = [];

        for ($i = 0; $i < $this->m; $i++) {
            $b[] = $this->a[$i][$i];
        }

        return Vector::quick($b);
    }
public function diagonalAsVector() : Vector
    {
        if (!$this->isSquare()) {
            throw new RuntimeException('Cannot trace diagonal of a'
                . ' non square matrix.');
        }

        $b = [];

        for ($i = 0; $i < $this->m; $i++) {
            $b[] = $this->a[$i][$i];
        }

        return Vector::quick($b);
    }
public function diagonalAsVector ( ) : Vector { if ( ! $ this -> isSquare ( ) ) { throw new RuntimeException ( 'Cannot trace diagonal of a' . ' non square matrix.' ) ; } $ b = [ ] ; for ( $ i = 0 ; $ i < $ this -> m ; $ i ++ ) { $ b [ ] = $ this -> a [ $ i ] [ $ i ] ; } return Vector :: quick ( $ b ) ; }
Return the diagonal elements of a square matrix as a vector.

@throws \RuntimeException
@return \Rubix\Tensor\Vector
Return the diagonal elements of a square matrix as a vector .