dim_and_names {GPUmatrix} | R Documentation |
Number of rows and columns and its corresponding names
Description
These functions mimic the 'base' functions rownames
, colnames
, dimnames
, dim
, length
, ncol
, nrow
to operate on gpu.matrix-class objects.
The "dim
family functions" set or get the dimension of a gpu.matrix-class object.
The "rownames
and colnames
family functions" set or get the corresponding names of rows and columns of a gpu.matrix-class object.
Usage
## S4 method for signature 'gpu.matrix.tensorflow'
rownames(x)
## S4 method for signature 'gpu.matrix.torch'
rownames(x)
## S4 method for signature 'gpu.matrix.tensorflow'
colnames(x)
## S4 method for signature 'gpu.matrix.torch'
colnames(x)
## S4 method for signature 'gpu.matrix.tensorflow'
dim(x)
## S4 method for signature 'gpu.matrix.torch'
dim(x)
## S4 method for signature 'gpu.matrix.tensorflow'
dimnames(x)
## S4 method for signature 'gpu.matrix.torch'
dimnames(x)
## S4 method for signature 'gpu.matrix.tensorflow'
length(x)
## S4 method for signature 'gpu.matrix.torch'
length(x)
## S4 method for signature 'gpu.matrix.tensorflow'
ncol(x)
## S4 method for signature 'gpu.matrix.torch'
ncol(x)
## S4 method for signature 'gpu.matrix.tensorflow'
nrow(x)
## S4 method for signature 'gpu.matrix.torch'
nrow(x)
## S4 replacement method for signature 'gpu.matrix.tensorflow,vector'
dim(x) <- value
## S4 replacement method for signature 'gpu.matrix.torch,vector'
dim(x) <- value
## S4 replacement method for signature 'gpu.matrix.tensorflow,vector'
dimnames(x) <- value
## S4 replacement method for signature 'gpu.matrix.torch,vector'
dimnames(x) <- value
Arguments
x |
a |
value |
For |
Value
rownames
returns the names of the rows of a gpu.matrix-class object.
colnames
returns the names of the columns of a gpu.matrix-class object.
dim
returns the number of rows and columns of a gpu.matrix-class object and
dim <-
sets the number of rows and columns of a gpu.matrix-class object.
dimnames
returns the names of the rows and columns of a gpu.matrix-class object and
dimnames <-
sets the names of the rows and columns of a gpu.matrix-class object.
length
returns the length (ncol*nrow) of a gpu.matrix-class object.
ncol
returns the number of columns of a gpu.matrix-class object.
nrow
returns the number of rows of a gpu.matrix-class object.
See Also
For more information:
rownames
,
colnames
,
dim
,
dim<-
,
dimnames
,
dimnames<-
,
length
,
ncol
,
nrow
.
Examples
## Not run:
a <- gpu.matrix(rnorm(9))
dim(a) <- c(3,3) #sets the number of rows and columns.
dim(a) #shows the number of rows and the number of columns
ncol(a) #shows the number of columns
nrow(a) #shows the number of rows
length(a) #shows the lenght of the matrix (nrow*ncol)
dimnames(a) <- list(c("r1","r2","r3"),c("c1","c2","c3")) #sets rows and column names
dimnames(a) #shows both the row and the col names
#these functions are equivalent to the following:
rownames(a) <- c("r1","r2","r3") #adds rownames to a.
colnames(a) <- c("c1","c2","c3") #adds colnames to a.
rownames(a) #shows rownames.
colnames(a) #shows colnames.
## End(Not run)