Skip to contents

Prepare a bigmemory::big.matrix reference for repeated exact search

Usage

knn_prepare_bigmatrix(
  x,
  metric = "euclidean",
  block_size = knn_default_block_size(),
  plan = NULL,
  validate = TRUE,
  cache_path = NULL
)

Arguments

x

A bigmemory::big.matrix or an external pointer referencing the reference matrix.

metric

Distance metric. Supported values are "euclidean", "sqeuclidean", and "cosine".

block_size

Number of rows to process per query and reference block.

plan

Optional execution plan returned by knn_plan_bigmatrix().

validate

Logical flag controlling whether the preparation pass checks for finite, metric-compatible rows while building the cache.

cache_path

Optional path where a serializable prepared-reference cache should be written with saveRDS().

Value

An object of class "bigknn_prepared" containing the reference pointer, metric-specific row cache, and metadata reused by later exact search calls.