Description What are raw indices? Motivation Author(s) See Also Examples
An overview of what raw indices mean for neighbor-search implementations that contain a rearranged matrix in the BiocNeighborIndex object.
Consider the following call:
1 2 | index <- buildKmknn(vals)
out <- findKmknn(precomputed=index, k=k, raw.index=TRUE)
|
This yields the same output as:
1 2 |
When raw.index=TRUE
in the first call, the indices in out$index
matrix can be imagined to refer to columns of PRE
in the second call.
Moreover, all function arguments that previously referred to rows of X
(e.g., subset
) are now considered to refer to columns of PRE
.
The same reasoning applies to all functions where precomputed
can be specified in place of X
.
This includes query-based searches (e.g., queryKmknn
) and range searches (rangeFindKmknn
).
Setting raw.index=TRUE
is intended for scenarios where the reordered data in precomputed
is used elsewhere.
By returning indices to the reordered data, the user does not need to hold onto the original data and/or switch between the original ordering and that in precomputed
.
This simplifies downstream code and provides a slight speed boost by avoiding the need for re-indexing.
Neighbor search implementations can only return raw indices if their index construction involves transposing X
and reordering its columns.
This tends to be the case for most implementations as transposition allows efficient column-major distance calculations and reordering improves data locality.
Both the KMKNN and VP tree implementations fulfill these requirements and thus have the raw.index
option.
Note that setting raw.index=TRUE
makes little sense when precomputed
is not specified.
When precomputed=NULL
, a temporary index will be constructed that is not visible in the calling scope.
As index construction may be stochastic, the raw indices will not refer to anything that is meaningful to the end-user.
Aaron Lun
findKmknn
and findVptree
for examples where raw indices are used.
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.