Learn R Programming

chickn (version 1.2.3)

Sketch: Sketch

Description

The data sketch computation.

Usage

Sketch(Data, W, ind.col = 1:ncol(Data), ncores = 1, parallel = FALSE)

Arguments

Data

A Filebacked Big Matrix n x N. Data signals are stored in the matrix columns.

W

A frequency matrix m x n. The frequency vectors are stored in the matrix rows.

ind.col

Column indeces for which the data sketch is computed. By default all matrix columns.

ncores

Number of used cores. By default 1. If parallel = FALSE, ncores defines a number of data splits on which the sketch is computed separatelly.

parallel

logical parameter that indicates whether computations are performed on several cores in parallel or not.

Value

The data sketch vector.

Details

The sketch of the given data collection \(x_1, \dots, x_N\) is a vector of the length 2m. First m components of the data sketch vector correspond to its real part, i.e. \(\frac{1}{N} \sum_{i=1}^N \cos(W x_i)\). Last m components are its imaginary part, i.e. \(\frac{1}{N} \sum_{i=1}^N \sin(W x_i)\).

References

DBLP:journals/corr/KerivenBGP16chickn.

Examples

Run this code
# NOT RUN {
X = matrix(rnorm(1000), ncol=100, nrow = 10)
X_FBM = bigstatsr::FBM(init = X, ncol=100, nrow = 10)
W = GenerateFrequencies(Data = X_FBM, m = 20, N0 = 100, TypeDist = "AR")$W
SK1 = Sketch(X_FBM, W)
SK2 = Sketch(X_FBM, W, parallel = TRUE, ncores = 2)
all.equal(SK1, SK2)
# }

Run the code above in your browser using DataLab