tmp/getmatrix: Referencing a matrix via different forms.

getmatrixR Documentation

Referencing a matrix via different forms.

Description

Returns a matrix, whether requested via an R matrix, bigmemory object, bigmemory descriptor or quoted name form.

Usage

getmatrix(m)

Arguments

m

Specification of the matrix, as either an R matrix, bigmemory object, bigmemory descriptor or quoted name.

Details

This utility function enables writing general Rdsm code, specifying a matrix via different forms.

Value

The requested matrix.

Author(s)

Norm Matloff

Examples

library(parallel)
c2 <- makeCluster(2)
mgrmakevar(c2,"u",2,2)  # u is a 2x2 bigmemory matrix
u[] <- 8  # fill u with 8s
u[]  # prints a 2x2 matrix of 8s
v <- getmatrix(u)  # get u and assign it to v
# u and v are both addresses, pointing to the same memory location
v[]  # prints all 8s
v[2,1] <- 3
v[]  # prints three 8s and a 3
u[]  # prints three 8s and a 3
w <- getmatrix("u")  # w will also be a copy of u
w[]  # same as u

matloff/Rdsm documentation built on June 13, 2025, 8 p.m.