| cbind_rbind_methods {GPUmatrix} | R Documentation |
cbind_rbind_methods
Description
Mimics the 'base' functions 'cbind' and 'rbind' to operate on gpu.matrix objects. The 'base' functions 'cbind' and 'rbind' internally call the methods cbind2 and rbind2.
Therefore, ss done in cbind2 of the package 'Matrix', we have defined in 'GPUmatrix' the methods cbind2 and rbind2 to operate on gpu.matrix objects too.
Usage
## S4 method for signature 'ANY,gpu.matrix.tensorflow'
cbind2(x,y)
## S4 method for signature 'ANY,gpu.matrix.torch'
rbind2(x,y)
## S4 method for signature 'gpu.matrix.tensorflow,ANY'
cbind2(x,y,...)
## S4 method for signature 'gpu.matrix.torch,ANY'
rbind2(x,y)
Arguments
x, y |
a |
... |
(generalized) vectors or matrices. These can be given as named arguments. |
Value
The result of using these functions is equivalent to using the basic cbind and rbind functions. For more details see cbind.
Note that if one of the input values is a gpu.matrix-class object, then the output will also be a gpu.matrix-class object.
The data type of the values of the resulting gpu.matrix-class object (corresponding to the dtype parameter of the gpu.matrix function) is the one that allows the integration of all input values. That is, if you call cbind(a,b) where a is a gpu.matrix-class object with values of "int32" and b is a gpu.matrix-class with values of "float64", the result will be a gpu.matrix-class with values of "float64".
See Also
Examples
## Not run:
a <- gpu.matrix(1:9,nrow=3,ncol=3)
#add new row
newrow <- c(1,2,3)
a <- rbind2(a,newrow)
#add new column
newcolumn <- c(1,2,3,4)
a <- cbind(a,newcolumn)
#add new rows from other gpu.marix
b <- gpu.matrix(1:16,nrow=4,ncol=4)
d <- rbind(a,b)
#add new columns from other gpu.marix
b <- gpu.matrix(1:16,nrow=4,ncol=4)
d <- cbind(a,b)
## End(Not run)