initF: Initialize threads and split data

Description Usage Arguments Details Value Examples

Description

This function initializes threads and splits data. Retures an S4 object of class "emcdf_obj" that is ready for parallel computation.

Usage

1
initF(data, num = 2)

Arguments

data

a numeric matrix stores data. Colunms as variables.

num

an integer specifies number of threads to initialize.

Details

The input data must be a numeric matrix with variables as columns. The choice of "num" is machine dependent. A reasonable number would be the total number of CPU cores - 1. Call coreNum() to get CPU core number.

Value

an S4 object of class "emcdf_obj", holding pointer to an C++ object. When passed to function emcdf(), it computes joint CDF with multi-threads.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
n = 10^5
set.seed(123)
x = rnorm(n)
y = rnorm(n)
z = rnorm(n)
data = cbind(x, y, z)

#decide thread number
num = coreNum() - 1

#initialize threads
obj = initF(data, num)

#compute empirical CDF
emcdf(obj, c(0.5, 0.5, 0.5))

Emcdf documentation built on May 2, 2019, 1:47 p.m.

Related to initF in Emcdf...