gpuMatrix: gpuMatrix class

Description Usage Arguments Details Value Examples

View source: R/gpuMatix-class.R

Description

gpuMatrix class

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
gpuMatrix(data, type = "auto", device = "auto")

gpuEmptMatrix(row = 1, col = 1, type = "auto", device = "auto")

upload(x)

download(x)

## S4 method for signature 'gpuMatrix'
download(x)

## S4 method for signature 'ANY'
download(x)

nrow(x)

## S4 method for signature 'gpuMatrix'
dim(x)

## S4 method for signature 'gpuMatrix'
length(x)

getSize(x)

Arguments

data

It can be a matrix or an R object that can be converted into a matrix.

type

The precision that is used to store the data, the default is gpuMagic.getOptions('default.float').

device

The device that the data is sent to, the default is the first device.

row, col

the row and column number of the matrix

x

an gpuMatrix object

Details

gpuMatrix(): Create a matrix in an openCL device

gpuEmptMatrix(): Create an empty matrix without initialization in an openCL device

upload(): The function will automatically be called when an gpuMatrix object is created. It is only needed when you want to update value of the matrix.

download(): Get the data from the device. You should explicitly call it when you want to collect the data from the device.

nrow(),ncol(): return the number of rows or columns present in x

dim(): Retrieve the dimension of an gpuMatrix object

length(): Get the length of an gpuMatrix object.

'getSize()': Get the matrix size in byte

Value

gpuMatrix(): A gpuMatrix object

gpuEmptMatrix(): A gpuMatrix object

Examples

1
2
3
4
5
6
7
8
n=10
m=20
A=matrix(runif(n*m),n,m)
#Create a 64 bit floating point GPU matrix
A_dev=gpuMatrix(A,'double')

#Create an empty matrix
B_dev=gpuEmptMatrix(row=n,col=m)

gpuMagic documentation built on Nov. 8, 2020, 5:15 p.m.