| gpuSolve | R Documentation |
Solves x b = y for b on the GPU, like solve. If y is
omitted, returns the inverse of x.
A square x is solved by LU decomposition with partial pivoting, as
solve does (NVIDIA's cuSOLVER, getrf/getrs).
An x with more rows than columns is solved in the least-squares sense
by Householder QR (geqrf/ormqr), and its "inverse" is
the pseudo-inverse.
gpuSolve(x, y=NULL,
precision = getOption("gputools.precision", "single"))
x |
a matrix of floating point numbers. |
y |
a vector of length nrow(x), or a matrix with nrow(x) rows. |
precision |
|
b: a vector of length ncol(x) if y is a vector, otherwise a matrix
with ncol(x) rows. If y is omitted, the ncol(x) by nrow(x) inverse (or
pseudo-inverse) of x. Rows are named by the columns of x, as with
solve.
A square x that is exactly singular is an error, as with solve;
so is an overdetermined x whose columns are linearly dependent, since
the least-squares solution is then not unique.
x <- matrix(runif(100), 10, 10)
y <- runif(10)
b <- gpuSolve(x, y)
cat("Solution:\n")
print(b)
x.inverse <- gpuSolve(x)
cat("an estimate of a pseudo inverse for x:\n")
print(x.inverse)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.