dither 0.0.2 → 0.0.3
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 +6 -5
- data/lib/dither/version.rb +1 -1
- 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: b9e1b376480253aa00c65aee4b4d3747968e3373
|
4
|
+
data.tar.gz: 49b946da8ead53930d5258eda1208956c8c31260
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0060b07d6b8868e8fe49cdb8b00c6a5243eec64f8bbad4c780149aa1338f9900be7d7a5a26fc5afceb7df0c3b8b50ee0dc322e88c1d25cd11aeb284798bf4ba0
|
7
|
+
data.tar.gz: 90df44c2af7881c6bd4241094086cff169f9c0bd3cf712111cce5b13540e8b4398a78000298f94582c428cbe2d496656b9f061f2cceb0605c1ffdc4906635290
|
data/lib/dither/ipog.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
module Dither
|
3
3
|
class IPOG
|
4
|
-
attr_reader :params, :t, :
|
5
|
-
private :params, :t, :
|
4
|
+
attr_reader :params, :t, :constraints
|
5
|
+
private :params, :t, :constraints
|
6
6
|
|
7
7
|
def initialize(params, t, opts = {})
|
8
8
|
@params = params
|
@@ -13,7 +13,6 @@ module Dither
|
|
13
13
|
.map { |a| a.map { |b| Param.new(*b) } }
|
14
14
|
.map(&:to_set)
|
15
15
|
end
|
16
|
-
@prng = Random.new
|
17
16
|
raise 't must be >= 2' if t < 2
|
18
17
|
raise 't must be <= params.length' if t > params.length
|
19
18
|
params.each do |param|
|
@@ -51,6 +50,8 @@ module Dither
|
|
51
50
|
|
52
51
|
ts.map { |a| fill_unbound(a) }
|
53
52
|
.delete_if(&:nil?)
|
53
|
+
.to_set
|
54
|
+
.to_a
|
54
55
|
end
|
55
56
|
|
56
57
|
def violates_constraints?(params)
|
@@ -96,9 +97,9 @@ module Dither
|
|
96
97
|
|
97
98
|
arr.each_with_index do |e, i|
|
98
99
|
if e.nil?
|
99
|
-
j =
|
100
|
+
j = 0
|
100
101
|
arr[i] = params[i][j]
|
101
|
-
data << Param.new(i,j)
|
102
|
+
data << Param.new(i, j)
|
102
103
|
end
|
103
104
|
end
|
104
105
|
return nil if violates_constraints?(data)
|
data/lib/dither/version.rb
CHANGED