gpumat-class: gpumat class

Description Details Methods

Description

Storage and methods for GPU matrix data.

Details

Data is held in an external pointer.

Methods

Public methods


Method new()

Usage
gpumatR6$new(card, nrows = 0, ncols = 0, type = "double")
Arguments
card

A GPU card object; the return of card(). See ?card.

nrows, ncols

The dimension of the matrix.

type

Storage type for the matrix. Should be one of 'int', 'float', or 'double'.

Details

Class initializer. See also ?gpumat.


Method resize()

Usage
gpumatR6$resize(nrows, ncols)
Arguments
nrows, ncols

The new dimension.

Details

Change the dimension of the matrix object.


Method info()

Usage
gpumatR6$info()
Details

Print one-line information about the matrix.


Method dupe()

Usage
gpumatR6$dupe()
Details

Duplicate the matrix in a deep copy.


Method print()

Usage
gpumatR6$print(ndigits = 4)
Arguments
ndigits

Number of decimal digits to print.

Details

Print the data.


Method fill_zero()

Usage
gpumatR6$fill_zero()
Details

Fill all entries with zero.


Method fill_val()

Usage
gpumatR6$fill_val(v)
Arguments
v

Value to set all entries to.

Details

Fill all entries with supplied value.


Method fill_linspace()

Usage
gpumatR6$fill_linspace(start, stop)
Arguments
start, stop

Beginning/end of the linear spacing.

Details

Fill the matrix (column-wise) with linearly-spaced values.


Method fill_eye()

Usage
gpumatR6$fill_eye()
Details

Fill diagonal values to 1 and non-diagonal values to 0.


Method fill_diag()

Usage
gpumatR6$fill_diag(v)
Arguments
v

A gpuvec object.

Details

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.


Method fill_runif()

Usage
gpumatR6$fill_runif(seed, min = 0, max = 1)
Arguments
seed

Seed for the generator. Can be left blank.

min, max

Parameters for the generator.

Details

Fill the matrix with random unifmorm data.


Method fill_rnorm()

Usage
gpumatR6$fill_rnorm(seed, mean = 0, sd = 1)
Arguments
seed

Seed for the generator. Can be left blank.

mean, sd

Parameters for the generator.

Details

Fill the matrix with random normal data.


Method diag()

Usage
gpumatR6$diag(v)
Arguments
v

A gpuvec object.

Details

Get diagonal entries of the matrix.


Method antidiag()

Usage
gpumatR6$antidiag(v)
Arguments
v

A gpuvec object.

Details

Get anti-diagonal entries of the matrix.


Method scale()

Usage
gpumatR6$scale(s)
Arguments
s

Value to scale all entries by.

Details

Scale all entries by the supplied value.


Method rev_rows()

Usage
gpumatR6$rev_rows()
Details

Reverse rows.


Method rev_cols()

Usage
gpumatR6$rev_cols()
Details

Reverse columns.


Method get()

Usage
gpumatR6$get(i, j)
Arguments
i, j

Indices (0-based).

Details

Get element from the matrix.


Method set()

Usage
gpumatR6$set(i, j, v)
Arguments
i, j

Indices (0-based).

v

Value.

Details

Set element of the matrix.


Method get_row()

Usage
gpumatR6$get_row(i, v)
Arguments
i

Index (0-based).

v

A gpuvec object.

Details

Get the specified row.


Method get_col()

Usage
gpumatR6$get_col(j, v)
Arguments
j

Index (0-based).

v

A gpuvec object.

Details

Get the specified column.


Method dim()

Usage
gpumatR6$dim()
Details

Returns number of rows and columns of the matrix.


Method nrows()

Usage
gpumatR6$nrows()
Details

Returns number of rows of the matrix.


Method ncols()

Usage
gpumatR6$ncols()
Details

Returns number of columns of the matrix.


Method get_card()

Usage
gpumatR6$get_card()
Details

Returns the internal card object.


Method data_ptr()

Usage
gpumatR6$data_ptr()
Details

Returns the external pointer data. For developers only.


Method get_type()

Usage
gpumatR6$get_type()
Details

Returns the integer code for the underlying storage type. For developers only.


Method get_type_str()

Usage
gpumatR6$get_type_str()
Details

Returns the string code for the underlying storage type. For developers only.


Method get_class()

Usage
gpumatR6$get_class()
Details

Returns the integer code the class type, in this case CLASS_MAT.


Method to_robj()

Usage
gpumatR6$to_robj()
Details

Returns an R matrix containing a copy of the class data.


Method from_robj()

Usage
gpumatR6$from_robj(robj)
Arguments
robj

R matrix.

Details

Copies the values of the input to the class data. See also ?as_gpumat.


Method clone()

The objects of this class are cloneable with this method.

Usage
gpumatR6$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


fml-fam/fmlr documentation built on Jan. 16, 2022, 9:27 a.m.