public function rank() : int
    {
        $pivots = 0;

        foreach ($this->rref() as $row) {
            foreach ($row as $value) {
                if ($value != 0) {
                    $pivots++;

                    continue 2;
                }
            }
        }

        return $pivots;
    }
public function rank() : int
    {
        $pivots = 0;

        foreach ($this->rref() as $row) {
            foreach ($row as $value) {
                if ($value != 0) {
                    $pivots++;

                    continue 2;
                }
            }
        }

        return $pivots;
    }
public function rank ( ) : int { $ pivots = 0 ; foreach ( $ this -> rref ( ) as $ row ) { foreach ( $ row as $ value ) { if ( $ value != 0 ) { $ pivots ++ ; continue 2 ; } } } return $ pivots ; }
Calculate the rank of the matrix i.e the number of pivots
in its reduced row echelon form.

@return int
Calculate the rank of the matrix i . e the number of pivots in its reduced row echelon form .