getmatrix: Referencing a matrix via different forms.

Description Usage Arguments Details Value Author(s) Examples

View source: R/Rdsm.R

Description

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

Usage

1

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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

Rdsm documentation built on May 1, 2019, 10:52 p.m.