% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/S3_decompositions.R
\name{svd.HDF5Matrix}
\alias{svd.HDF5Matrix}
\title{Singular Value Decomposition of an HDF5Matrix}
\usage{
\method{svd}{HDF5Matrix}(
  x,
  nu = min(dim(x)),
  nv = min(dim(x)),
  center = TRUE,
  scale = TRUE,
  k = 2L,
  q = 1L,
  method = "auto",
  rankthreshold = 0,
  overwrite = FALSE,
  threads = -1L,
  ...
)
}
\arguments{
\item{x}{An \code{HDF5Matrix} object.}

\item{nu}{Number of left  singular vectors to compute (default = \code{min(dim(x))}).}

\item{nv}{Number of right singular vectors to compute (default = \code{min(dim(x))}).}

\item{center}{Logical.  Center columns before decomposition (default \code{TRUE}).}

\item{scale}{Logical.  Scale  columns before decomposition (default \code{TRUE}).}

\item{k}{Number of local SVDs per incremental level (default 2).}

\item{q}{Number of incremental levels (default 1).}

\item{method}{Computation method: \code{"auto"} (default), \code{"blocks"},
or \code{"full"}.}

\item{rankthreshold}{Numeric in \code{[0, 0.1]}.  Rank approximation
threshold (default 0).}

\item{overwrite}{Logical.  Overwrite existing SVD results (default \code{FALSE}).}

\item{threads}{Integer.  OpenMP threads (\code{-1} = auto-detect).}

\item{...}{Ignored (S3 compatibility).}
}
\value{
Named list with:
\describe{
\item{\code{d}}{Numeric vector of non-negative singular values, decreasing.}
\item{\code{u}}{HDF5Matrix of left  singular vectors, \code{nrow(x) x nu}.}
\item{\code{v}}{HDF5Matrix of right singular vectors, \code{ncol(x) x nv}.}
}
}
\description{
Block-wise SVD entirely on disk.  The matrix \code{x} is decomposed
into \code{x = u \%*\% diag(d) \%*\% t(v)}.
}
\details{
Singular values \code{d} are loaded into a plain numeric vector
(they are always small: at most \code{min(nrow(x), ncol(x))} values).
\code{u} and \code{v} are returned as \code{HDF5Matrix} objects.
}
\examples{
\donttest{
tmp <- tempfile(fileext = ".h5")
X   <- hdf5_create_matrix(tmp, "data/M", data = matrix(rnorm(500), 50, 10))
res <- svd(X)
length(res$d)   # 10  (min(50,10))
dim(res$u)      # 50 x 10
dim(res$v)      # 10 x 10
X$close()
res$u$close(); res$v$close()
unlink(tmp)
}

}
