Class: Faiss::PCAMatrix

Inherits:
Object
  • Object
show all
Defined in:
lib/faiss/pca_matrix.rb

Instance Method Summary collapse

Instance Method Details

#apply(objects) ⇒ Object



8
9
10
11
12
13
# File 'lib/faiss/pca_matrix.rb', line 8

def apply(objects)
  objects = Numo::SFloat.cast(objects) unless objects.is_a?(Numo::SFloat)
  n = objects.shape[0]
  res = _apply(n, objects)
  Numo::SFloat.from_binary(res).reshape(n, d_out)
end

#train(objects) ⇒ Object



3
4
5
6
# File 'lib/faiss/pca_matrix.rb', line 3

def train(objects)
  objects = Numo::SFloat.cast(objects) unless objects.is_a?(Numo::SFloat)
  _train(objects.shape[0], objects)
end