as.gmatrix-methods: Methods for coercing an object to a GPU class

Description Arguments Details Value Author(s) See Also Examples


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


x, data

object to be coerced


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.


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.


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


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.


An object of type gmatrix or gvector


Nathan Morris

See Also

g, gmatrix and gvector



gmatrix documentation built on May 19, 2017, 11:43 a.m.
Search within the gmatrix package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.