lsh 0.4.0-java → 0.4.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/lsh/index.rb +3 -3
  2. metadata +2 -2
data/lib/lsh/index.rb CHANGED
@@ -18,7 +18,7 @@ module LSH
18
18
 
19
19
  class Index
20
20
 
21
- attr_reader :projections, :buckets, :storage
21
+ attr_reader :storage
22
22
 
23
23
  def initialize(parameters = {}, storage = LSH::Storage::Memory.new)
24
24
  @storage = storage
@@ -111,7 +111,7 @@ module LSH
111
111
 
112
112
  def hash(vector, projection, bias = true)
113
113
  hash = []
114
- dot_products = (vector * projection).row(0).to_a
114
+ dot_products = (projection * vector.transpose).column(0).to_a
115
115
  window = storage.parameters[:window]
116
116
  dot_products.each do |dot_product|
117
117
  if window == Float::INFINITY # Binary LSH
@@ -159,7 +159,7 @@ module LSH
159
159
  end
160
160
 
161
161
  def generate_projection(dim, k)
162
- MathUtil.random_gaussian_matrix(dim, k)
162
+ MathUtil.random_gaussian_matrix(k, dim)
163
163
  end
164
164
 
165
165
  def similarity(v1, v2)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lsh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: java
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-18 00:00:00.000000000 Z
12
+ date: 2013-03-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jblas-ruby