describe, attach.big.matrix {bigmemory}R Documentation

The basic shared “big.matrix” operations.

Description

The attach.big.matrix creates a new big.matrix object which references previously allocated shared memory or file-backed matrices.

The describe function returns the description needed by the attach.big.matrix function so that a newly created big.matrix instance can reference a previously allocated shared memory instance of type big.matrix.

Usage

describe(x)
attach.big.matrix(obj, backingpath='')

Arguments

x a shared big.matrix.
obj an object as returned by describe() or, optionally, the filename of the descriptor for a filebacked matrix, assumed to be in the directory specified by the backingpath (if one is provided).
backingpath the path where the descriptor and/or filebacking can be found.

Details

After a shared (possible file-backed) big.matrix instance is created, the describe function can be called to retrieve the keys which refer to the shared memory locations which the instance manages. These keys are then used for a new shared big.matrix instance to refer to the same memory across R sessions.

A descriptor file is automatically created when a new filebacked big.matrix is created, so in this case, the describe() is unnecessary (but may still be helpful).

Value

describe returns a list of shared memory keys and other necessary information.
attach.big.matrix return a new instance of type big.matrix which refers to the shared memory described by the describe function.

Author(s)

John W. Emerson and Michael J. Kane

See Also

bigmemory, big.matrix, or the class documentation big.matrix.

Examples

# The example is quite silly, as you wouldn't likely do this in a
# single R session.  But if zdescription were passed to another R session
# via SNOW, NetWorkSpaces, or even by a simple file read/write,
# then the attach of the second R process would give access to the
# same object in memory.  Please see the package vignette for real examples.
z <- shared.big.matrix(3, 3, type='integer', init=3)
z[,]
dim(z)
z[1,1] <- 2
z[,]
zdescription <- describe(z)
zdescription
y <- attach.big.matrix(zdescription)
y[,]
y
z
y[1,1] <- -100
y[,]
z[,]

[Package bigmemory version 3.10 Index]