# accessors: Accessor Functions for Distributed Matrix Slots In pbdDMAT: 'pbdR' Distributed Matrix Methods

## Description

Functions to get dimension information, local storage, or current BLACS context from a distributed matrix.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48``` ```nrow(x) ## S4 method for signature 'ddmatrix' nrow(x) NROW(x) ## S4 method for signature 'ddmatrix' NROW(x) ncol(x) ## S4 method for signature 'ddmatrix' ncol(x) NCOL(x) ## S4 method for signature 'ddmatrix' NCOL(x) submatrix(x, ...) ## S4 method for signature 'ddmatrix' submatrix(x) ## S4 method for signature 'Linalg' submatrix(x) ldim(x, ...) ## S4 method for signature 'ddmatrix' ldim(x) bldim(x, ...) ## S4 method for signature 'ddmatrix' bldim(x) ICTXT(x, ...) ## S4 method for signature 'ddmatrix' ICTXT(x) ## S4 method for signature 'ddmatrix' dim(x) ## S4 method for signature 'ddmatrix' length(x) ```

## Arguments

 `x` numeric distributed matrix `...` Extra arguments. `dim` global dimension. `bldim` blocking dimension. `ICTXT` BLACS context.

## Details

The functions `nrow()`, `ncol()`, `length()` and `dim()` are the natural extensions of their ordinary matrix counterparts.

`ldim()` will give the dimension of the matrix stored locally on the process which runs the function. This is a local value, so its return is process-dependent. For example, if the 3x3 global matrix `x` is distributed as the `ddmatrix` `dx` across two processors with process 0 owning the first two rows and process 1 owning the third, then `ldim(dx)` will return `2 3` on process 0 and `1 3` on process 1.

`bldim()` will give the blocking dimension that was used to block-cyclically distribute the distributed matrix.

`submatrix()` will give the local storage for the requested object.

`ICTXT()` will give the current BLACS context (slot ICTXT) for the requested object.

`ownany()` is intended mostly for developers. It answers the question "do I own any of the data?". The user can either pass a distributed matrix object or the dim, bldim, and ICTXT of one.

## Value

Each of `dim()`, `ldim()`, `bldim()` return a length 2 vector.

Each of `nrow()`, `ncol()`, and `length()` return a length 1 vector. Likewise, so does `ICTXT()`.

`submatrix()` returns a matrix; namely, `submatrix(x)` returns a matrix of dimensions `ldim(x)`.

## Methods

list("signature(x = \"ddmatrix\")")

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15``` ```## 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() x <- ddmatrix(1:9, 3, bldim=2) y <- list(dim=dim(x), ldim=ldim(x), bldim=bldim(x)) comm.print(y) finalize() ## End(Not run) ```

pbdDMAT documentation built on May 29, 2017, 1:23 p.m.