fastSMatrixEVs: Computation of the k leading eigenvectors of the s-matrix...

View source: R/locStra.r

fastSMatrixEVsR Documentation

Computation of the k leading eigenvectors of the s-matrix (the weighted Jaccard similarity matrix) for a (sparse) input matrix. Note that in contrast to the parameters of the function sMatrix, the choice phased=FALSE cannot be modified for the fast eigenvector computation.

Description

Computation of the k leading eigenvectors of the s-matrix (the weighted Jaccard similarity matrix) for a (sparse) input matrix. Note that in contrast to the parameters of the function sMatrix, the choice phased=FALSE cannot be modified for the fast eigenvector computation.

Usage

fastSMatrixEVs(m, k, useCpp = TRUE, sparse = TRUE, Djac = FALSE, q = 2)

Arguments

m

A (sparse) matrix for which the eigenvectors of its s-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.

Djac

Flag to switch between the unweighted (Djac=TRUE) or weighted (Djac=FALSE) version. Default is Djac=FALSE.

q

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

Value

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

References

Daniel Schlauch (2016). Implementation of the stego algorithm - Similarity Test for Estimating Genetic Outliers. https://github.com/dschlauch/stego

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(fastSMatrixEVs(sparseM,k=2,useCpp=FALSE))


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