Storage and methods for MPI matrix data.

Details

Data is held in an external pointer.

Methods

Public methods


Method new()

Usage

mpimatR6$new(
  grid,
  nrows = 0,
  ncols = 0,
  bf_rows = 16,
  bf_cols = 16,
  type = "double"
)

Arguments

grid

An MPI grid object; the return of grid(). See ?grid.

nrows, ncols

The dimension of the matrix.

bf_rows, bf_cols

The blocking factor.

type

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

Details

Class initializer. See also ?mpimat.


Method resize()

Usage

mpimatR6$resize(nrows, ncols)

Arguments

nrows, ncols

The new dimension.

Details

Change the dimension of the matrix object.


Method dupe()

Usage

mpimatR6$dupe()

Details

Duplicate the matrix in a deep copy.


Method info()

Usage

mpimatR6$info()

Details

Print one-line information about the matrix.


Method print()

Usage

mpimatR6$print(ndigits = 4)

Arguments

ndigits

Number of decimal digits to print.

Details

Print the data.


Method fill_zero()

Usage

mpimatR6$fill_zero()

Details

Fill all entries with zero.


Method fill_val()

Usage

mpimatR6$fill_val(v)

Arguments

v

Value to set all entries to.

Details

Fill all entries with supplied value.


Method fill_linspace()

Usage

mpimatR6$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

mpimatR6$fill_eye()

Details

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


Method fill_diag()

Usage

mpimatR6$fill_diag(v)

Arguments

v

A cpuvec 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

mpimatR6$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

mpimatR6$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

mpimatR6$diag(v)

Arguments

v

A cpuvec object.

Details

Get diagonal entries of the matrix.


Method antidiag()

Usage

mpimatR6$antidiag(v)

Arguments

v

A cpuvec object.

Details

Get anti-diagonal entries of the matrix.


Method scale()

Usage

mpimatR6$scale(s)

Arguments

s

Value to scale all entries by.

Details

Scale all entries by the supplied value.


Method rev_rows()

Usage

mpimatR6$rev_rows()

Details

Reverse rows.


Method rev_cols()

Usage

mpimatR6$rev_cols()

Details

Reverse columns.


Method get()

Usage

mpimatR6$get(i, j)

Arguments

i, j

Indices (0-based).

Details

Get element from the matrix.


Method set()

Usage

mpimatR6$set(i, j, v)

Arguments

i, j

Indices (0-based).

v

Value.

Details

Set element of the matrix.


Method get_row()

Usage

mpimatR6$get_row(i, v)

Arguments

i

Index (0-based).

v

A cpuvec object.

Details

Get the specified row.


Method get_col()

Usage

mpimatR6$get_col(j, v)

Arguments

j

Index (0-based).

v

A cpuvec object.

Details

Get the specified column.


Method dim()

Usage

mpimatR6$dim()

Details

Returns number of rows and columns of the matrix.


Method nrows()

Usage

mpimatR6$nrows()

Details

Returns number of rows of the matrix.


Method ncols()

Usage

mpimatR6$ncols()

Details

Returns number of columns of the matrix.


Method ldim()

Usage

mpimatR6$ldim()

Details

Returns number of rows and columns of the matrix.


Method nrows_local()

Usage

mpimatR6$nrows_local()

Details

Returns number of columns of the matrix.


Method ncols_local()

Usage

mpimatR6$ncols_local()

Details

Returns number of columns of the matrix.


Method bfdim()

Usage

mpimatR6$bfdim()

Details

Returns number of rows and columns of the matrix.


Method bf_rows()

Usage

mpimatR6$bf_rows()

Details

Returns number of columns of the matrix.


Method bf_cols()

Usage

mpimatR6$bf_cols()

Details

Returns number of columns of the matrix.


Method get_grid()

Usage

mpimatR6$get_grid()

Details

Returns the internal grid object.


Method data_ptr()

Usage

mpimatR6$data_ptr()

Details

Returns the external pointer data. For developers only.


Method get_type()

Usage

mpimatR6$get_type()

Details

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


Method get_type_str()

Usage

mpimatR6$get_type_str()

Details

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


Method get_class()

Usage

mpimatR6$get_class()

Details

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


Method to_robj()

Usage

mpimatR6$to_robj()

Details

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


Method from_robj()

Usage

mpimatR6$from_robj(robj)

Arguments

robj

R matrix.

Details

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


Method clone()

The objects of this class are cloneable with this method.

Usage

mpimatR6$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.