Storage and methods for MPI matrix data.
Data is held in an external pointer.
new()
mpimatR6$new( grid, nrows = 0, ncols = 0, bf_rows = 16, bf_cols = 16, type = "double" )
Class initializer. See also ?mpimat
.
resize()
mpimatR6$resize(nrows, ncols)
nrows, ncols
The new dimension.
Change the dimension of the matrix object.
dupe()
mpimatR6$dupe()
Duplicate the matrix in a deep copy.
info()
mpimatR6$info()
Print one-line information about the matrix.
print()
mpimatR6$print(ndigits = 4)
ndigits
Number of decimal digits to print.
Print the data.
fill_zero()
mpimatR6$fill_zero()
Fill all entries with zero.
fill_val()
mpimatR6$fill_val(v)
v
Value to set all entries to.
Fill all entries with supplied value.
fill_linspace()
mpimatR6$fill_linspace(start, stop)
start, stop
Beginning/end of the linear spacing.
Fill the matrix (column-wise) with linearly-spaced values.
fill_eye()
mpimatR6$fill_eye()
Fill diagonal values to 1 and non-diagonal values to 0.
fill_diag()
mpimatR6$fill_diag(v)
v
A cpuvec 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()
mpimatR6$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()
mpimatR6$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()
mpimatR6$diag(v)
v
A cpuvec object.
Get diagonal entries of the matrix.
antidiag()
mpimatR6$antidiag(v)
v
A cpuvec object.
Get anti-diagonal entries of the matrix.
scale()
mpimatR6$scale(s)
s
Value to scale all entries by.
Scale all entries by the supplied value.
rev_rows()
mpimatR6$rev_rows()
Reverse rows.
rev_cols()
mpimatR6$rev_cols()
Reverse columns.
get()
mpimatR6$get(i, j)
i, j
Indices (0-based).
Get element from the matrix.
set()
mpimatR6$set(i, j, v)
i, j
Indices (0-based).
v
Value.
Set element of the matrix.
get_row()
mpimatR6$get_row(i, v)
i
Index (0-based).
v
A cpuvec object.
Get the specified row.
get_col()
mpimatR6$get_col(j, v)
j
Index (0-based).
v
A cpuvec object.
Get the specified column.
dim()
mpimatR6$dim()
Returns number of rows and columns of the matrix.
nrows()
mpimatR6$nrows()
Returns number of rows of the matrix.
ncols()
mpimatR6$ncols()
Returns number of columns of the matrix.
ldim()
mpimatR6$ldim()
Returns number of rows and columns of the matrix.
nrows_local()
mpimatR6$nrows_local()
Returns number of columns of the matrix.
ncols_local()
mpimatR6$ncols_local()
Returns number of columns of the matrix.
bfdim()
mpimatR6$bfdim()
Returns number of rows and columns of the matrix.
bf_rows()
mpimatR6$bf_rows()
Returns number of columns of the matrix.
bf_cols()
mpimatR6$bf_cols()
Returns number of columns of the matrix.
get_grid()
mpimatR6$get_grid()
Returns the internal grid object.
data_ptr()
mpimatR6$data_ptr()
Returns the external pointer data. For developers only.
get_type()
mpimatR6$get_type()
Returns the integer code for the underlying storage type. For developers only.
get_type_str()
mpimatR6$get_type_str()
Returns the string code for the underlying storage type. For developers only.
get_class()
mpimatR6$get_class()
Returns the integer code the class type, in this case CLASS_MAT.
to_robj()
mpimatR6$to_robj()
Returns an R matrix containing a copy of the class data.
from_robj()
mpimatR6$from_robj(robj)
robj
R matrix.
Copies the values of the input to the class data. See also ?as_mpimat
.
clone()
The objects of this class are cloneable with this method.
mpimatR6$clone(deep = FALSE)
deep
Whether to make a deep clone.