src/LinearAlgebra/Eigenvector.php
private static function countSolutions(Matrix $M): int
    {
        $number_of_solutions = 0;
        // There are solutions to be found.
        $more_solutions = true;
        $m = $M->getM();
        // We will count the number of rows with all zeros, starting at the bottom.
        for ($i = $m - 1; $i >= 0 && $more_solutions; $i--) {
            // Every row of zeros is a degree of freedom (a solution) with that eigenvalue
            if ($M->getRow($i) == array_fill(0, $m, 0)) {
                $number_of_solutions++;
            } else {
                 // Once we find a row with nonzero values, there are no more.
                 $more_solutions = false;
            }
        }
        return $number_of_solutions;
    }
private static function countSolutions(Matrix $M): int
    {
        $number_of_solutions = 0;
        // There are solutions to be found.
        $more_solutions = true;
        $m = $M->getM();
        // We will count the number of rows with all zeros, starting at the bottom.
        for ($i = $m - 1; $i >= 0 && $more_solutions; $i--) {
            // Every row of zeros is a degree of freedom (a solution) with that eigenvalue
            if ($M->getRow($i) == array_fill(0, $m, 0)) {
                $number_of_solutions++;
            } else {
                 // Once we find a row with nonzero values, there are no more.
                 $more_solutions = false;
            }
        }
        return $number_of_solutions;
    }
private static function countSolutions ( Matrix $ M ) : int { $ number_of_solutions = 0 ; // There are solutions to be found. $ more_solutions = true ; $ m = $ M -> getM ( ) ; // We will count the number of rows with all zeros, starting at the bottom. for ( $ i = $ m - 1 ; $ i >= 0 && $ more_solutions ; $ i -- ) { // Every row of zeros is a degree of freedom (a solution) with that eigenvalue if ( $ M -> getRow ( $ i ) == array_fill ( 0 , $ m , 0 ) ) { $ number_of_solutions ++ ; } else { // Once we find a row with nonzero values, there are no more. $ more_solutions = false ; } } return $ number_of_solutions ; }
Count the number of rows that contain all zeroes, starting at the bottom.
In reduced row echelon form, all the rows of zero will be on the bottom.

@param Matrix $M

@return int
Count the number of rows that contain all zeroes starting at the bottom . In reduced row echelon form all the rows of zero will be on the bottom .