1#ifndef TATAMI_TEST_SIMULATE_COMPRESSED_SPARSE_HPP
2#define TATAMI_TEST_SIMULATE_COMPRESSED_SPARSE_HPP
37 uint64_t
seed = 1234567890;
46template<
typename Value_,
typename Index_>
81template<
typename Value_,
typename Index_>
83 std::mt19937_64 rng(options.
seed);
84 std::uniform_real_distribution<> nonzero(0.0, 1.0);
85 std::uniform_real_distribution<> unif(options.
lower, options.
upper);
88 output.
indptr.resize(primary + 1);
89 for (
size_t p = 0; p < primary; ++p) {
90 size_t idx = output.
indptr[p];
91 for (
size_t s = 0; s < secondary; ++s) {
92 if (nonzero(rng) < options.
density) {
93 output.
data.push_back(unif(rng));
94 output.
index.push_back(s);
98 output.
indptr[p + 1] = idx;
Utilities for testing tatami libraries.
Definition create_indexed_subset.hpp:15
SimulateCompressedSparseResult< Value_, Index_ > simulate_compressed_sparse(size_t primary, size_t secondary, const SimulateCompressedSparseOptions &options)
Definition simulate_compressed_sparse.hpp:82
Options for simulate_compressed_sparse().
Definition simulate_compressed_sparse.hpp:18
double lower
Definition simulate_compressed_sparse.hpp:22
double upper
Definition simulate_compressed_sparse.hpp:27
uint64_t seed
Definition simulate_compressed_sparse.hpp:37
double density
Definition simulate_compressed_sparse.hpp:32
Result of simulate_compressed_sparse().
Definition simulate_compressed_sparse.hpp:47
std::vector< size_t > indptr
Definition simulate_compressed_sparse.hpp:66
std::vector< Value_ > data
Definition simulate_compressed_sparse.hpp:52
std::vector< Index_ > index
Definition simulate_compressed_sparse.hpp:59