Learn R Programming

pbdDMAT (version 0.2-3)

MiscMath: Miscellaneous Mathematical Functions

Description

Binary operations for distributed matrix/distributed matrix and distributed matrix/vector operations.

Usage

## S3 method for class 'ddmatrix':
abs(x)
## S3 method for class 'ddmatrix':
sqrt(x)
## S3 method for class 'ddmatrix':
exp(x)
## S3 method for class 'ddmatrix':
log(x, base = exp(1))
## S3 method for class 'ddmatrix':
log2(x)
## S3 method for class 'ddmatrix':
log10(x)
## S3 method for class 'ddmatrix':
log1p(x)
## S3 method for class 'ddmatrix':
sin(x)
## S3 method for class 'ddmatrix':
cos(x)
## S3 method for class 'ddmatrix':
tan(x)
## S3 method for class 'ddmatrix':
asin(x)
## S3 method for class 'ddmatrix':
acos(x)
## S3 method for class 'ddmatrix':
atan(x)
## S3 method for class 'ddmatrix':
sinh(x)
## S3 method for class 'ddmatrix':
cosh(x)
## S3 method for class 'ddmatrix':
tanh(x)

Arguments

x
numeric distributed matrix
base
a positive number: the base with respect to which logarithms are computed. Defaults to e='exp(1)'.

Value

  • Returns a distributed matrix.

Details

Performs the miscellaneous mathematical calculation on a distributed matrix.

See Also

Arithmetic, Reductions

Examples

Run this code
# 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()

# don't do this in production code
x <- matrix(1:9, 3)
x <- as.ddmatrix(x)

y <- sqrt(abs(log(x/10)))
comm.print(y)

finalize()

Run the code above in your browser using DataLab