gpuSolve {gputools}R Documentation

Estimate the solution to a matrix vector equation

Description

This function estimates the solution to an equation of the form x * b = y where x is a matrix, b is an unkown vector, and y is a known vector. It does much calculation on a GPU.

Usage

        gpuSolve(x, y)

Arguments

x a matrix of floating point numbers.
y a vector of floating point numbers of length nrow(x).

Value

a vector of floating point numbers of length ncol(x) which is an estimate of the b from x * b = y.

References

Bjorck, Ake (1996) Numerical methods for least squares problems. SIAM.

Examples

        # get some random data of any shape at all
        x <- matrix(runif(1000), 50, 20)
        y <- runif(50)
        b <- gpuSolve(x, y)
        cat("Solution:\n")
        print(b)
        cat("x * b\n")
        print(x %*% b)
        cat("original y\n")
        print(y)

[Package gputools version 0.1-1 Index]