collectTriangularMatrix: Return a Distributed Symmetric or Triangular Matrix to the...

View source: R/collectDistribute.R

collectTriangularMatrixR Documentation

Return a Distributed Symmetric or Triangular Matrix to the Master Process

Description

collectTriangularMatrix retrieves a distributed symmetric or triangular matrix from the slave processes, reconstructing the blocks correctly on the master process. Objects can be copied from environments, lists, and ReferenceClass objects as well as the global environment on the slave processes.

Usage

collectTriangularMatrix(objName, objPos = '.GlobalEnv', n, h = 1)

Arguments

objName

an object name, given as a character string, giving the name of the object on the slave processes.

objPos

where to look for the object, given as a character string (unlike get). This can indicate an environment, a list, or a ReferenceClass object.

n

a positive integer, the number of rows (and columns) of the matrix.

h

a positive integer, the block replication factor, h, relevant for the matrix.

Value

collectTriangularMatrix returns a matrix of dimension, n \times n. Note that for lower triangular matrices, the upper triangle is non-zero and is filled with the transpose of the lower triangle, and vice versa for upper triangular matrices.

See Also

pull collectVector collectRectangularMatrix collectDiagonal distributeVector

Examples

## Not run: 
if(require(fields)) {
nProc <- 3
n <- nrow(SN2011fe_subset)
inputs <- c(as.list(SN2011fe_subset), as.list(SN2011fe_newdata_subset),
  nu =2)
# initialize the problem
prob <- krigeProblem$new("prob", h_n = 1, numProcesses = nProc, n = n,
  meanFunction = SN2011fe_meanfunc, covFunction = SN2011fe_covfunc, inputs = inputs,
  params = SN2011fe_mle$par, data = SN2011fe_subset$flux, packages =
  c("fields"))
# calculate log density, primarily so Cholesky gets calculated
prob$calcLogDens()
C <- collectTriangularMatrix('C', "prob", n = n, h = 1)
L <- collectTriangularMatrix('L', "prob", n = n, h = 1)
C[1:5, 1:5]
L[1:5, 1:5]
}

## End(Not run)

bigGP documentation built on April 26, 2023, 1:16 a.m.