Compute the full weighted Jaccard similarity matrix for a
dgCMatrix, returning a dense matrix (or a
dist-layout vector).
Usage
c_weighted_jaccard_dense(
x,
transpose = FALSE,
threads = NULL,
triangle = FALSE,
distance = FALSE
)Arguments
- x
A dgCMatrix (sparse column-compressed matrix)
- transpose
If
FALSE, compare columns; ifTRUE, compare rows- threads
Number of threads for parallel computation. The default
NULLapplies the package thread policy (respectinggetOption("Ncpus")and theOMP_THREAD_LIMITenvironment variable, else 2). Set to 0 to use all available cores.- triangle
If
TRUE, return only the lower triangle as a flat numeric vector indistlayout. IfFALSE(default), return a full square matrix.- distance
If
TRUE, return distance (1 - similarity) instead of similarity. DefaultFALSE.
Value
A dense numeric similarity matrix, or a numeric vector in
dist layout when triangle = TRUE.
Details
Uses an adaptive dense accumulation strategy: for small output matrices a feature-oriented loop, switching to a column-oriented loop for larger outputs for better cache performance.
See also
c_weighted_jaccard_sparse for the sparse equivalent