def determinant_by_elimination
      m = dup
      det = ground.unity
      each_j do |d|
        if i = (d...size).find{|i| !m[i, d].zero?}
          if i != d
            m.sswap_r!(d, i)
            det = -det
          end
          c = m[d, d]
          det *= c
          (d+1...size).each do |i0|
            r = m.row!(i0)
            q = ground.unity * m[i0, d] / c #this lets the entries be in ground
            (d+1...size).each do |j0|
              r[j0] -= q * m[d, j0]
            end
          end
        else
          return ground.zero
        end
      end
      det
    end
def determinant_by_elimination
      m = dup
      det = ground.unity
      each_j do |d|
        if i = (d...size).find{|i| !m[i, d].zero?}
          if i != d
            m.sswap_r!(d, i)
            det = -det
          end
          c = m[d, d]
          det *= c
          (d+1...size).each do |i0|
            r = m.row!(i0)
            q = ground.unity * m[i0, d] / c #this lets the entries be in ground
            (d+1...size).each do |j0|
              r[j0] -= q * m[d, j0]
            end
          end
        else
          return ground.zero
        end
      end
      det
    end
ground ring must be a field