Methods for coercing an object to a GPU class

Description

The as.gmatrix and as.gvector methods may be used to coerce an object to a given GPU class (i.e. gmatrix or gvector).

Arguments

x, data

object to be coerced

type

The type to convert the object to. There are three different ways to specify this. One may use the "double", "single", "integer" or "logical" notation. Alternatively the short form "d", "s", "i" or "s" notation may be used. Finally the internal integer representation of 0L, 1L, 2L or 3L may be used.

dup

This may be set to 'FALSE' to avoid duplicating x in the event that it is on the GPU allready and the original type is the same as the type argument.

nrow,ncol,byrow,dimnames

these attributes should generally only be set by a direct call to gmatrix

Details

The as.gmatrix and as.gvector methods may be used to move an R object to the current GPU device and returns an object of class gmatrix or gvector respectively. The methods have the following arguments:

as.gmatrix(data = NA, nrow = 1L, ncol = 1L, byrow = FALSE, dimnames = NULL, type = NULL, dup = TRUE) as.gvector(x, type=NULL, dup=TRUE)

The dup argument is used only when the input argument (data) is all ready on the GPU. dup=FALSE will return the original data without duplicating it on the GPU.

Value

An object of type gmatrix or gvector

Author(s)

Nathan Morris

See Also

g, gmatrix and gvector

Examples

1
2
A=matrix(1:10,2,5)
B=as.gmatrix(A)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.