NAME

PDL::FAISS - FAISS vector similarity search bindings for PDL

SYNOPSIS

use PDL;
use PDL::FAISS qw(flat_l2 flat_ip);

my $index = flat_l2(4);
my $db    = float([[1,0,0,0], [0,1,0,0], [0,0,1,0]]);
$index->add($db);

my ($distances, $indices) = $index->search(float([[0,1,0,0]]), 2);

DESCRIPTION

PDL::FAISS binds PDL ndarrays to Facebook AI Similarity Search (FAISS) for fast L2 and inner-product k-NN vector search.

FUNCTIONS

flat_l2

Create a PDL::FAISS::Index using exact L2 (Euclidean) distance for vectors of dimension $dim.

$index = flat_l2($dim);

flat_ip

Create a PDL::FAISS::Index using exact inner-product similarity for vectors of dimension $dim.

$index = flat_ip($dim);

SEE ALSO

PDL, PDL::Torch, PDL::XGBoost, PDL::ONNX, PDL::GGML

AUTHOR

C.J. Collier <cjac@google.com>

LICENSE

Licensed under the Apache License, Version 2.0.