fastJaccardEVs: Computation of the k leading eigenvectors of the Jaccard...

View source: R/locStra.r

fastJaccardEVsR Documentation

Computation of the k leading eigenvectors of the Jaccard similarity matrix for a (sparse) input matrix. Note that this computation is only approximate and does not necessarily coincide with the result obtained by extracting the k leading eigenvectors of the Jaccard matrix computed with the function jaccardMatrix.

Description

Computation of the k leading eigenvectors of the Jaccard similarity matrix for a (sparse) input matrix. Note that this computation is only approximate and does not necessarily coincide with the result obtained by extracting the k leading eigenvectors of the Jaccard matrix computed with the function jaccardMatrix.

Usage

fastJaccardEVs(m, k, useCpp = TRUE, sparse = TRUE, q = 2)

Arguments

m

A (sparse) matrix for which the eigenvectors of its Jaccard matrix are sought. The input matrix is assumed to be oriented to contain the data for one individual per column.

k

The number of leading eigenvectors.

useCpp

Flag to switch between R or C++ implementations. Default is useCpp=TRUE.

sparse

Flag to switch between purpose-built dense or sparse implementations. Default is sparse=TRUE.

q

The number of power iteration steps (default is q=2).

Value

The k leading eigenvectors of the Jaccard matrix of m as a column matrix.

References

Dmitry Prokopenko, Julian Hecker, Edwin Silverman, Marcello Pagano, Markus Noethen, Christian Dina, Christoph Lange and Heide Fier (2016). Utilizing the Jaccard index to reveal population stratification in sequencing data: a simulation study and an application to the 1000 Genomes Project. Bioinformatics, 32(9):1366-1372.

N. Halko, P.G. Martinsson, and J.A. Tropp (2011). Finding Structure with Randomness: Probabilistic Algorithms for Constructing Approximate Matrix Decompositions. SIAM Review: 53(2), pp. 217–288.

Examples

require(locStra)
require(Matrix)
m <- matrix(sample(0:1,100,replace=TRUE),ncol=5)
sparseM <- Matrix(m,sparse=TRUE)
print(fastJaccardEVs(sparseM,k=2,useCpp=FALSE))


locStra documentation built on April 13, 2022, 1:07 a.m.