class MatrixIndex

encoding : utf-8

An index of a binary matrix Copyright GPL 3 – Joseph J. Simpson – 2014 11-22-2014

Attributes

mi[RW]

Public Class Methods

new(size) click to toggle source
# File lib/matrix_index.rb, line 7
def initialize(size)
  @mi = Array.new(size) { |i| Array.new(1, i + 1) }
end

Public Instance Methods

compress_index(index_1, index_2) click to toggle source
# File lib/matrix_index.rb, line 11
def compress_index(index_1, index_2)
  temp_mi = mi.dup
  i1 = temp_mi.index([index_1])
  i2 = temp_mi.index([index_2])
  temp_mi[i1].push(temp_mi[i2])
  temp_mi.delete_at(i2)
  mi = temp_mi
  mi
end