Storage and methods for GPU matrix data.
Data is held in an external pointer.
new()
gpumatR6$new(card, nrows = 0, ncols = 0, type = "double")
Class initializer. See also ?gpumat
.
resize()
gpumatR6$resize(nrows, ncols)
nrows, ncols
The new dimension.
Change the dimension of the matrix object.
info()
gpumatR6$info()
Print one-line information about the matrix.
dupe()
gpumatR6$dupe()
Duplicate the matrix in a deep copy.
print()
gpumatR6$print(ndigits = 4)
ndigits
Number of decimal digits to print.
Print the data.
fill_zero()
gpumatR6$fill_zero()
Fill all entries with zero.
fill_val()
gpumatR6$fill_val(v)
v
Value to set all entries to.
Fill all entries with supplied value.
fill_linspace()
gpumatR6$fill_linspace(start, stop)
start, stop
Beginning/end of the linear spacing.
Fill the matrix (column-wise) with linearly-spaced values.
fill_eye()
gpumatR6$fill_eye()
Fill diagonal values to 1 and non-diagonal values to 0.
fill_diag()
gpumatR6$fill_diag(v)
v
A gpuvec object.
Set diagonal entries of the matrix to those in the vector. If the vector is smaller than the matrix diagonal, the vector will recycle until the matrix diagonal is filled.
fill_runif()
gpumatR6$fill_runif(seed, min = 0, max = 1)
seed
Seed for the generator. Can be left blank.
min, max
Parameters for the generator.
Fill the matrix with random unifmorm data.
fill_rnorm()
gpumatR6$fill_rnorm(seed, mean = 0, sd = 1)
seed
Seed for the generator. Can be left blank.
mean, sd
Parameters for the generator.
Fill the matrix with random normal data.
diag()
gpumatR6$diag(v)
v
A gpuvec object.
Get diagonal entries of the matrix.
antidiag()
gpumatR6$antidiag(v)
v
A gpuvec object.
Get anti-diagonal entries of the matrix.
scale()
gpumatR6$scale(s)
s
Value to scale all entries by.
Scale all entries by the supplied value.
rev_rows()
gpumatR6$rev_rows()
Reverse rows.
rev_cols()
gpumatR6$rev_cols()
Reverse columns.
get()
gpumatR6$get(i, j)
i, j
Indices (0-based).
Get element from the matrix.
set()
gpumatR6$set(i, j, v)
i, j
Indices (0-based).
v
Value.
Set element of the matrix.
get_row()
gpumatR6$get_row(i, v)
i
Index (0-based).
v
A gpuvec object.
Get the specified row.
get_col()
gpumatR6$get_col(j, v)
j
Index (0-based).
v
A gpuvec object.
Get the specified column.
dim()
gpumatR6$dim()
Returns number of rows and columns of the matrix.
nrows()
gpumatR6$nrows()
Returns number of rows of the matrix.
ncols()
gpumatR6$ncols()
Returns number of columns of the matrix.
get_card()
gpumatR6$get_card()
Returns the internal card object.
data_ptr()
gpumatR6$data_ptr()
Returns the external pointer data. For developers only.
get_type()
gpumatR6$get_type()
Returns the integer code for the underlying storage type. For developers only.
get_type_str()
gpumatR6$get_type_str()
Returns the string code for the underlying storage type. For developers only.
get_class()
gpumatR6$get_class()
Returns the integer code the class type, in this case CLASS_MAT.
to_robj()
gpumatR6$to_robj()
Returns an R matrix containing a copy of the class data.
from_robj()
gpumatR6$from_robj(robj)
robj
R matrix.
Copies the values of the input to the class data. See also ?as_gpumat
.
clone()
The objects of this class are cloneable with this method.
gpumatR6$clone(deep = FALSE)
deep
Whether to make a deep clone.