1#ifndef SCRAN_TESTS_SIMULATE_COMPRESSED_SPARSE_MATRIX_HPP
2#define SCRAN_TESTS_SIMULATE_COMPRESSED_SPARSE_MATRIX_HPP
23template<
typename Data_ =
double>
45 typename RngEngine::result_type
seed = 1234567890;
54template<
typename Data_,
typename Index_,
typename Po
inter_>
94template<
typename Data_ =
double,
typename Index_ =
int,
typename Po
inter_ = std::
size_t>
101 auto unif = create_simulating_distribution(params.
lower, params.
upper);
106 output.
pointers.reserve(
static_cast<typename std::vector<Pointer_>::size_type
>(primary) + 1);
109 std::uniform_real_distribution<double> nonzero(0.0, 1.0);
110 for (Index_ p = 0; p < primary; ++p) {
111 for (Index_ s = 0; s < secondary; ++s) {
112 if (nonzero(rng) <= params.
density) {
113 output.
index.push_back(s);
114 output.
data.push_back(unif(rng));
Test utilites for libscran.
Definition compare_almost_equal.hpp:12
SimulatedCompressedSparseMatrix< Data_, Index_, Pointer_ > simulate_compressed_sparse_matrix(Index_ primary, Index_ secondary, const SimulateCompressedSparseMatrixParameters< Data_ > ¶ms)
Definition simulate_compressed_sparse_matrix.hpp:95
constexpr Type_ default_simulation_min()
Definition simulate_vector.hpp:27
std::mt19937_64 RngEngine
Definition simulate_vector.hpp:20
Simulate a vector of random values.
Parameters for simulate_compressed_sparse_matrix().
Definition simulate_compressed_sparse_matrix.hpp:24
Data_ lower
Definition simulate_compressed_sparse_matrix.hpp:34
double density
Definition simulate_compressed_sparse_matrix.hpp:28
Data_ upper
Definition simulate_compressed_sparse_matrix.hpp:40
RngEngine::result_type seed
Definition simulate_compressed_sparse_matrix.hpp:45
Results of simulate_compressed_sparse_matrix().
Definition simulate_compressed_sparse_matrix.hpp:55
Index_ secondary
Definition simulate_compressed_sparse_matrix.hpp:64
std::vector< Index_ > index
Definition simulate_compressed_sparse_matrix.hpp:74
std::vector< Pointer_ > pointers
Definition simulate_compressed_sparse_matrix.hpp:79
Index_ primary
Definition simulate_compressed_sparse_matrix.hpp:59
std::vector< Data_ > data
Definition simulate_compressed_sparse_matrix.hpp:69