Learn R Programming

nda (version 0.3.0)

data_gen: Generate Structured NDA Example Data

Description

Generates a noisy block matrix without constructing intermediate block-diagonal matrices.

Usage

data_gen(n, m, nfactors = 2, lambda = 1, sparse = FALSE,
         density = 1, seed = NULL)

Value

A data frame, or a sparse matrix when sparse = TRUE.

Arguments

n

Positive number of rows.

m

Positive number of columns.

nfactors

Positive number of blocks.

lambda

Finite exponential smoothing parameter.

sparse

Return a sparse Matrix object.

density

Proportion in (0, 1] of block entries retained as nonzero.

seed

Optional random seed.

Examples

Run this code
dense <- data_gen(30, 10, nfactors = 2, seed = 1)
sparse <- data_gen(100, 40, nfactors = 4, sparse = TRUE, density = 0.5)

Run the code above in your browser using DataLab