pdist 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pdist.rb +6 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f6118cbd2a20a7657698ccb221e3eca96f0b06c
4
- data.tar.gz: 595fa6bc50c46f3ea10c70236b3a6e3a47e39012
3
+ metadata.gz: 60af35948ee406fc8869882d08b86638d9d451ae
4
+ data.tar.gz: b03e2749c3e332d2348e9d960fbcb944be1195ce
5
5
  SHA512:
6
- metadata.gz: d0f6b88bdd1b539087fa21eefffd16eb382e3b5879dbf3573fcfc08e07488a0296693824d8e3c6a6f9be14aedcbcf4879002c25ec4b9726f8173d1324e9b68c4
7
- data.tar.gz: de356c84860ba351714b360bc88dc833632feb4802bf186b797b639971fbff39929b6bf3a8de5854328c18d98f2f66ff3f5eb0d71edc8e01608f2bef552c9f8c
6
+ metadata.gz: cde3314e504ce289b30b271e584aef46a9026a8281e69469b4e5786ba769092d649aa2170028bbd2d0ea2b499f09332e0026aecc89a1a89a90869f906f380a71
7
+ data.tar.gz: bebfc1d120e68ecd67a93b736fdc7276eac1e8e3c958887efee64893cc848993fbc77cddb5662617000727b23c9ae91eac1ecd1147e1cfe98d531490b0a971fc
@@ -37,8 +37,8 @@ class PDist
37
37
  def self.hamming(original, permutation)
38
38
  x = 0
39
39
  hds = [] # hamming distances
40
- permutation.each do |frag_id| # hamming distances are 0 when object's have same index in original and permutation, and 1 when not
41
- if frag_id == original[x]
40
+ permutation.each do |object| # hamming distances are 0 when object's have same index in original and permutation, and 1 when not
41
+ if object == original[x]
42
42
  hds << 0
43
43
  else
44
44
  hds << 1
@@ -77,11 +77,11 @@ class PDist
77
77
  n = permutation.length
78
78
  x = 0
79
79
  kt = []
80
- n.times do
80
+ original.each do |original_x| # for each of the objects in original...
81
81
  y = 0
82
- n.times do
83
- if original[x] < original[y] && permutation[x] > permutation[y]
84
- kt << 1
82
+ n.times do # ... iterate over both original and permutation
83
+ if original_x < original[y] && permutation[x] > permutation[y] # every time object y comes before object x in permutation, where it comes after in original...
84
+ kt << 1 # ... 1 is added
85
85
  else
86
86
  kt << 0
87
87
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edward Chalstrey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-28 00:00:00.000000000 Z
11
+ date: 2014-05-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'Ruby gem to compare permutations using distance measures/metrics. github:
14
14
  https://github.com/edwardchalstrey1/pdist'