as_methods | R Documentation |
These functions mimic the 'base' functions of R that have the same name to operate on gpu.matrix-class objects:
Function as.matrix
attempts to turn its argument into a matrix.
Function as.list
attempts to turn its argument into a list.
Function as.numeric
attempts to turn its argument into a numeric.
Function as.array
attempts to turn its argument into an array.
Function as.vector
attempts to turn its argument into a vector.
Function is.numeric
is a general test of an object being interpretable as numbers.
## S4 method for signature 'gpu.matrix.tensorflow'
as.array(x,...)
## S4 method for signature 'gpu.matrix.torch'
as.array(x,...)
## S4 method for signature 'gpu.matrix.tensorflow'
as.list(x,...)
## S4 method for signature 'gpu.matrix.torch'
as.list(x,...)
## S4 method for signature 'gpu.matrix.tensorflow'
as.matrix(x,...)
## S4 method for signature 'gpu.matrix.torch'
as.matrix(x,...)
## S4 method for signature 'gpu.matrix.tensorflow'
as.numeric(x,...)
## S4 method for signature 'gpu.matrix.torch'
as.numeric(x,...)
## S4 method for signature 'gpu.matrix.tensorflow'
as.vector(x,mode)
## S4 method for signature 'gpu.matrix.torch'
as.vector(x,mode)
## S4 method for signature 'gpu.matrix.torch'
is.numeric(x)
## S4 method for signature 'gpu.matrix.tensorflow'
is.numeric(x)
x |
a |
... |
(generalized) vectors or matrices. These can be given as named arguments. |
mode |
Argument for |
Note that, if the input is a gpu.matrix with complex numbers: the function is.numeric
will return FALSE, and the function as.numeric
will only returns the real part and the following warning message: "In asMethod(object) : imaginary parts discarded in coercion".
The parameter mode
of the function as.vector
determines the storage mode of the result. For more details see typeof
.
Given a gpu.matrix-class object:
Function as.matrix
turns the input gpu.matrix to a 'matrix' object.
Function as.list
turns the input gpu.matrix into a list.
Function as.numeric
turns the input gpu.matrix into a numeric vector.
Function as.array
turns the input gpu.matrix into an array (Since the gpu.matrix objects are always two-dimensional, this function is equivalent to as.matrix
.).
Function as.vector
turns the input gpu.matrix into a vector.
Function is.numeric
returns TRUE or FAALSE if input can be interpretable as numbers.
numeric
,
array
,
list
,
matrix
,
## Not run:
a <- gpu.matrix(c(rnorm(8),2+1i),nrow=3,ncol=3)
as.array(a)
as.list(a)
as.matrix(a)
as.numeric(a)
is.numeric(a)
as.character(a)
as.vector(a,mode = "list")
as.vector(a,mode = "character")
as.vector(a,mode = "logical")
as.vector(a,mode = "integer")
as.vector(a,mode = "double")
as.vector(a,mode = "complex")
as.vector(a,mode = "raw")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.