Skip to contents

Principal components of a data matrix, as prcomp computes them, with the singular value decomposition on the GPU (gpuSvd).

Usage

gpuPrcomp(x, retx = TRUE, center = TRUE, scale. = FALSE, tol = NULL,
  rank. = NULL, precision = getOption("gputools.precision", "single"))

Arguments

x, retx, center, scale., tol, rank.

as for prcomp.

precision

"single" or "double": the floating point precision the GPU computes in. Single precision is the default, set with options(gputools.precision = "double"); it runs many times faster on most consumer GPUs. Results are returned as doubles either way.

Value

An object of class "prcomp", as prcomp returns, so summary, predict, biplot and screeplot work on it. Each component's sign is arbitrary, as with any principal components, so a column of rotation and of x can be the negative of prcomp's.

See also

Examples

if (FALSE) { # gpuAvailable()
pc <- gpuPrcomp(USArrests, scale. = TRUE)
summary(pc)
head(predict(pc, USArrests), 3)
}