This is the main entry point for distance computation.
Usage
build_cost_matrix(
left,
right,
vars,
distance = "euclidean",
weights = NULL,
scale = FALSE,
sigma = NULL,
memory_mode = "auto",
caller_supports_lazy = TRUE
)Arguments
- memory_mode
One of "auto" (default), "dense", or "lazy". "auto" warns (or, when the caller supports it, switches) when the dense matrix would consume a large fraction of free system RAM.
memory_mode = "lazy"returns alazy_cost_specinstead of a matrix when the calling path and distance metric support it (built-in metrics viaassignment()withmethod = "jv"/"auction"); otherwise it errors clearly rather than silently falling back to dense.- caller_supports_lazy
Whether the calling code path can actually consume a
lazy_cost_specresult. Defaults toTRUE; callers whose downstream solve path has not been made lazy-aware (e.g.full_match(), which uses an entirely different min-cost-flow backend) passFALSEsomemory_mode = "auto"never promotes to lazy for them, and an explicitmemory_mode = "lazy"request errors clearly instead of returning alazy_cost_specthe caller cannot use.