defineBuilder | R Documentation |
Define a builder object that can construct C++ indices for neighbor searches.
defineBuilder(BNPARAM)
BNPARAM |
A BiocNeighborParam object specifying the type of index to be constructed.
If |
The external pointer returned in builder
should refer to a BiocNeighbors::Builder
object,
see the definition in system.file("include", "BiocNeighbors.h", package="BiocNeighbors")
for details.
If a developer defines a defineBuilder
method for a search algorithm, they do not have to define a new buildIndex
method.
The existing buildIndex
methods will automatically create an instance of the appropriate BiocNeighborGenericIndex subclass based on class
,
which can be immediately used in all generics (e.g., findKNN
, queryNeighbors
) without further effort.
Note that the pointer returned by defineBuilder
should not be used as the ptr
in the BiocNeighborIndex subclasses.
The ptr
slot is expected to contain a pointer referring to a BiocNeighbors::Prebuilt
object, as returned by the default buildIndex
.
Using the pointer from builder
will probably crash the R session.
Needless to say, users should not attempt to serialize the external pointer returned by this generic.
Attempting to use a deserialized pointer in buildIndex
will cause the R session to crash.
List containing:
builder
, a pointer to a builder instance that can be used to construct a prebuilt index in buildIndex
.
class
, the constructor for a BiocNeighborGenericIndex subclass that accepts ptr
and names
arguments.
Aaron Lun
defineBuilder,KmknnParam-method
,
defineBuilder,VptreeParam-method
,
defineBuilder,AnnoyParam-method
and defineBuilder,HnswParam-method
for specific methods.
(out <- defineBuilder())
(out2 <- defineBuilder(AnnoyParam()))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.