Module: Pgvector
- Defined in:
- lib/pgvector.rb,
lib/pgvector/pg.rb,
lib/pgvector/pg/text_decoder/vector.rb,
lib/pgvector/pg/binary_decoder/vector.rb
Defined Under Namespace
Modules: PG
Class Method Summary collapse
Class Method Details
.decode(string) ⇒ Object
8 9 10 |
# File 'lib/pgvector.rb', line 8 def self.decode(string) string[1..-2].split(",").map(&:to_f) end |
.encode(data) ⇒ Object
4 5 6 |
# File 'lib/pgvector.rb', line 4 def self.encode(data) "[#{data.to_a.map(&:to_f).join(",")}]" end |