dither 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dither/ipog.rb +4 -0
- data/lib/dither/version.rb +1 -1
- data/spec/dither/dither_spec.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd7dc97ac31f5097009170b509d7ce2e86dd451a
|
4
|
+
data.tar.gz: 37986e3680cb1e927794e307bf17eec619b22f7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f6cfd8559eea4bba2f626c6c050a20379e61a2cfbe58907a8143acc7007abe2fe7b521bebcd639d6006e4680c7ee93400c86b8d58915e41e7da6df4e95537a5
|
7
|
+
data.tar.gz: b0d9d084bd338c6d473a7fd095c0598bae59ed0fd4fcf1e5063181e8dc503b9619666c272cfc0c9a7c3f530761ac51693deefc6f81f7459528609d997cb0883e
|
data/lib/dither/ipog.rb
CHANGED
@@ -90,6 +90,9 @@ module Dither
|
|
90
90
|
private
|
91
91
|
|
92
92
|
def fill_unbound(data)
|
93
|
+
@bound_sets ||= []
|
94
|
+
return nil if @bound_sets.any? { |a| data.subset?(a) }
|
95
|
+
|
93
96
|
arr = Array.new(params.length)
|
94
97
|
data.each do |param|
|
95
98
|
arr[param.i] = params[param.i][param.j]
|
@@ -102,6 +105,7 @@ module Dither
|
|
102
105
|
data << Param.new(i, j)
|
103
106
|
end
|
104
107
|
end
|
108
|
+
@bound_sets << data
|
105
109
|
return nil if violates_constraints?(data)
|
106
110
|
arr
|
107
111
|
end
|
data/lib/dither/version.rb
CHANGED
data/spec/dither/dither_spec.rb
CHANGED
@@ -25,6 +25,18 @@ describe Dither do
|
|
25
25
|
[:c, :d, :h],
|
26
26
|
[:c, :e, :i],
|
27
27
|
[:c, :f, :h]])
|
28
|
+
results = Dither.all_pairs([
|
29
|
+
(0...2).to_a,
|
30
|
+
(0...2).to_a,
|
31
|
+
(0...3).to_a,
|
32
|
+
(0...3).to_a,
|
33
|
+
(0...4).to_a,
|
34
|
+
(0...6).to_a,
|
35
|
+
(0...2).to_a,
|
36
|
+
(0...7).to_a,
|
37
|
+
(0...3).to_a,
|
38
|
+
], 2)
|
39
|
+
puts results.count
|
28
40
|
end
|
29
41
|
|
30
42
|
it 'can compute 2-way ipog' do
|