extract_gpu.matrix {GPUmatrix}R Documentation

extract_gpu.matrix

Description

These operators mimic the base operators [,[<-, [[, and [[<- to compute on gpu.matrix-class objects.

Usage

## S4 method for signature 'gpu.matrix.tensorflow,missing'
e1 - e2
## S4 method for signature 'gpu.matrix.torch,missing'
e1 - e2
## S4 method for signature 'gpu.matrix.tensorflow,index,index'
x[i,j]
## S4 method for signature 'gpu.matrix.tensorflow,index,missing'
x[i,j,...,drop = TRUE]
## S4 method for signature 'gpu.matrix.tensorflow,matrix,missing'
x[i,j,...,drop = TRUE]
## S4 method for signature 'gpu.matrix.tensorflow,missing,index'
x[i,j]
## S4 method for signature 'gpu.matrix.torch,index,index'
x[i,j]
## S4 method for signature 'gpu.matrix.torch,index,missing'
x[i,j,...,drop = TRUE]
## S4 method for signature 'gpu.matrix.torch,matrix,missing'
x[i,j,...,drop = TRUE]
## S4 method for signature 'gpu.matrix.torch,missing,index'
x[i,j]
## S4 replacement method for signature 'gpu.matrix.tensorflow,index,index'
x[i,j] <- value
## S4 replacement method for signature 'gpu.matrix.tensorflow,index,missing'
x[i,j] <- value
## S4 replacement method for signature 'gpu.matrix.tensorflow,matrix,missing'
x[i,j] <- value
## S4 replacement method for signature 'gpu.matrix.tensorflow,missing,index'
x[i,j] <- value
## S4 replacement method for signature 'gpu.matrix.torch,index,index'
x[i,j] <- value
## S4 replacement method for signature 'gpu.matrix.torch,index,missing'
x[i,j] <- value
## S4 replacement method for signature 'gpu.matrix.torch,matrix,missing'
x[i,j] <- value
## S4 replacement method for signature 'gpu.matrix.torch,missing,index'
x[i,j] <- value
## S4 method for signature 'gpu.matrix.tensorflow,index'
x[[i,j,...]]
## S4 method for signature 'gpu.matrix.torch,index'
x[[i,j,...]]
## S4 replacement method for signature 'gpu.matrix.tensorflow,index'
x[[i]] <- value
## S4 replacement method for signature 'gpu.matrix.torch,index'
x[[i]] <- value

Arguments

e1

a gpu.matrix.

e2

a gpu.matrix.

x

a gpu.matrix object from which extract element(s) or in which to replace element(s)

i, j, ...

indices specifying elements to extract or replace.

value

typically an array-like R object of a similar class as x.

drop

For matrices and arrays. If TRUE the result is coerced to the lowest possible dimension

Details

When replacing a value or values in a gpu.matrix, the gpu.matrix will not change its datatype (corresponding to the parameter dtype of the function gpu.matrix) based on the datatype in value. For example, the code x[1,1] <- value where the array x is a gpu.matrix with integer values and value has 'double' values, only the integer part of value will be stored in x[1,1].

See Also

See Also Extract.

Examples



## Not run: 

a <- gpu.matrix(1:9,nrow=3,ncol=3)
rownames(a) <- c("R1","R2","R3")
colnames(a) <- c("C1","C2","C3")

#return
a[3,3] # the element row 3 and column 3
a[6] # the 6th element
a[1,] # the first row
a[c(1,2),] # the first and second row
a[c(1,1),] # the first row twice
a[,1] # the first column
a[,c(1,2)] # the first and second column
a[,c(1,1)] # the first column twice

#replace
a[3,3] <- 100 # replace the element 3,3
a[1,] <- c(1,2,1) # replace the first row
a[,2] <- c(0,0,0) # replace the second column
a[c(1,2),] <- matrix(1:6,nrow = 2) # replace the first and second row




## End(Not run)


[Package GPUmatrix version 1.0.2 Index]