as.vector {pbdDMAT}R Documentation

Distributed object to Vector Converters

Description

Converts a distributed matrix into a non-distributed vector.

Usage

as.vector(x, ...)

## S4 method for signature 'ddmatrix'
as.vector(x, mode = "any", proc.dest = "all")

Arguments

x

numeric distributed matrix

...

Additional arguments.

mode

A character string giving an atomic mode or "list", or (except for 'vector') "any".

proc.dest

destination process for storing the matrix

Details

The proc.dest= argument accepts either the BLACS grid position or the MPI rank if the user desires a single process to own the matrix. Alternatively, passing the default value of 'all' will result in all processes owning the matrix. If only a single process owns the undistributed matrix, then all other processes store NULL for that object.

Value

Returns an ordinary R vector.

Examples


## Not run: 
# Save code in a file "demo.r" and run with 2 processors by
# > mpiexec -np 2 Rscript demo.r

library(pbdDMAT, quiet = TRUE)
init.grid()

dx <- ddmatrix(1:16, ncol=4, bldim=2)
y <- as.vector(dx, proc.dest=0)

comm.print(y)

finalize()

## End(Not run)


[Package pbdDMAT version 0.4-0 Index]