# File lib/backports/1.9.2/stdlib/matrix.rb, line 671 def permutation? Matrix.Raise ErrDimensionMismatch unless square? cols = Array.new(column_size) rows.each_with_index do |row, i| found = false row.each_with_index do |e, j| if e == 1 return false if found || cols[j] found = cols[j] = true elsif e != 0 return false end end return false unless found end true end