Storage and methods for GPU vector data.

Details

Data is held in an external pointer.

Methods

Public methods


Method new()

Usage

gpuvecR6$new(card, size = 0, type = "double")

Arguments

card

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

size

The length of the vector.

type

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

Details

Class initializer. See also ?gpuvec.


Method resize()

Usage

gpuvecR6$resize(size)

Arguments

size

The new length.

Details

Change the length of the vector object.


Method dupe()

Usage

gpuvecR6$dupe()

Details

Duplicate the vector in a deep copy.


Method info()

Usage

gpuvecR6$info()

Details

Print one-line information about the vector.


Method print()

Usage

gpuvecR6$print(ndigits = 4)

Arguments

ndigits

Number of decimal digits to print.

Details

Print the data.


Method fill_zero()

Usage

gpuvecR6$fill_zero()

Details

Fill all entries with zero.


Method fill_val()

Usage

gpuvecR6$fill_val(v)

Arguments

v

Value to set all entries to.

Details

Fill all entries with supplied value.


Method fill_linspace()

Usage

gpuvecR6$fill_linspace(start, stop)

Arguments

start, stop

Beginning/end of the linear spacing.

Details

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


Method scale()

Usage

gpuvecR6$scale(s)

Arguments

s

Value to scale all entries by.

Details

Scale all entries by the supplied value.


Method pow()

Usage

gpuvecR6$pow(s)

Arguments

p

Value to raise all entries to.

Details

Exponentiate all entries by the supplied value.


Method rev()

Usage

gpuvecR6$rev()

Details

Reverse rows.


Method sum()

Usage

gpuvecR6$sum()

Details

Sum the vector.

Returns

Returns the sum.


Method min()

Usage

gpuvecR6$min()

Details

Finds the minimum value of the vector.

Returns

Returns the min.


Method max()

Usage

gpuvecR6$max()

Details

Finds the maximum value of the vector.

Returns

Returns the max.


Method get()

Usage

gpuvecR6$get(i)

Arguments

i

Index (0-based).

Details

Get element from the vector.


Method set()

Usage

gpuvecR6$set(i, v)

Arguments

i

Index (0-based).

v

Value.

Details

Set element of the vector.


Method size()

Usage

gpuvecR6$size()

Details

Returns length of the vector.


Method get_card()

Usage

gpuvecR6$get_card()

Details

Returns the internal card object.


Method data_ptr()

Usage

gpuvecR6$data_ptr()

Details

Returns the external pointer data. For developers only.


Method get_type()

Usage

gpuvecR6$get_type()

Details

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


Method get_type_str()

Usage

gpuvecR6$get_type_str()

Details

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


Method get_class()

Usage

gpuvecR6$get_class()

Details

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


Method to_robj()

Usage

gpuvecR6$to_robj()

Details

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


Method from_robj()

Usage

gpuvecR6$from_robj(robj)

Arguments

robj

R vector.

Details

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


Method clone()

The objects of this class are cloneable with this method.

Usage

gpuvecR6$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.