Class: ArtDecomp::UVRelevanceGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/art-decomp/uv_relevance_generator.rb

Instance Method Summary collapse

Instance Method Details

#uv_pairs(fsm, archs, method) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/art-decomp/uv_relevance_generator.rb', line 3

def uv_pairs fsm, archs, method
  relevance   = fsm.send(method).reverse
  max_v_sizes = archs.map(&:pins).to_set
  cache       = Set[]
  Enumerator.new do |yielder|
    (0...2**relevance.size).each do |vector|
      bits = vector.bits
      next unless max_v_sizes.include? bits.size
      v = relevance.values_at(*bits).compact.to_set
      u = (relevance - v.to_a).compact.to_set
      yielder.yield fsm.expand_x(v), u, v unless cache.include? v
      cache << v
    end
  end
end