Storage and methods for CPU vector data.
Data is held in an external pointer.
new()cpuvecR6$new(size = 0, type = "double")
sizeThe length of the vector.
typeStorage type for the vector. Should be one of 'int', 'float', or 'double'.
Class initializer. See also ?cpuvec.
resize()cpuvecR6$resize(size)
sizeThe new length.
Change the length of the vector object.
inherit()cpuvecR6$inherit(data)
dataR vector.
Set the data in the cpuvec object to point to the array in 'data'. See
also ?as_cpuvec.
dupe()cpuvecR6$dupe()
Duplicate the vector in a deep copy.
info()cpuvecR6$info()
Print one-line information about the vector.
print()cpuvecR6$print(ndigits = 4)
ndigitsNumber of decimal digits to print.
Print the data.
fill_zero()cpuvecR6$fill_zero()
Fill all entries with zero.
fill_val()cpuvecR6$fill_val(v)
vValue to set all entries to.
Fill all entries with supplied value.
fill_linspace()cpuvecR6$fill_linspace(start, stop)
start, stopBeginning/end of the linear spacing.
Fill the vector (column-wise) with linearly-spaced values.
scale()cpuvecR6$scale(s)
sValue to scale all entries by.
Scale all entries by the supplied value.
pow()cpuvecR6$pow(s)
pValue to raise all entries to.
Exponentiate all entries by the supplied value.
rev()cpuvecR6$rev()
Reverse rows.
sum()cpuvecR6$sum()
Sum the vector.
Returns the sum.
min()cpuvecR6$min()
Finds the minimum value of the vector.
Returns the min.
max()cpuvecR6$max()
Finds the maximum value of the vector.
Returns the max.
get()cpuvecR6$get(i)
iIndex (0-based).
Get element from the vector.
set()cpuvecR6$set(i, v)
iIndex (0-based).
vValue.
Set element of the vector.
size()cpuvecR6$size()
Returns length of the vector.
data_ptr()cpuvecR6$data_ptr()
Returns the external pointer data. For developers only.
get_type()cpuvecR6$get_type()
Returns the integer code for the underlying storage type. For developers only.
get_type_str()cpuvecR6$get_type_str()
Returns the string code for the underlying storage type. For developers only.
get_class()cpuvecR6$get_class()
Returns the integer code the class type, in this case CLASS_VEC.
to_robj()cpuvecR6$to_robj()
Returns an R vector containing a copy of the class data.
from_robj()cpuvecR6$from_robj(robj)
robjR vector.
Copies the values of the input to the class data. See also ?as_cpuvec.
clone()The objects of this class are cloneable with this method.
cpuvecR6$clone(deep = FALSE)
deepWhether to make a deep clone.