19 #include "../_c_trace_estimator/c_orthogonalization.h"
20 #include "../_c_basic_algebra/c_vector_operations.h"
62 template <
typename DataType>
77 omp_set_num_threads(num_threads);
89 thread_id = omp_get_thread_num();
94 const int bits_per_byte = 8;
95 const int num_bits =
sizeof(uint64_t) * bits_per_byte;
99 static_cast<LongIndexType>(array_size/num_bits);
104 #pragma omp parallel if (num_threads > 0)
112 thread_id = omp_get_thread_num();
115 #pragma omp for schedule(static)
119 uint64_t bits = random_number_generator.
next(thread_id);
125 if (bits & ( uint64_t(1) << j))
128 array[i*num_bits + j] = 1.0;
133 array[i*num_bits + j] = -1.0;
144 uint64_t bits = random_number_generator.
next(thread_id);
148 for (
LongIndexType i = num_chunks * num_bits; i < array_size; ++i)
151 if (bits & ( uint64_t(1) << j))
A static class to generate random set of vectors. This class acts as a templated namespace,...
static void generate_random_array(RandomNumberGenerator &random_number_generator, DataType *array, const LongIndexType array_size, const IndexType num_threads)
Generates a pseudo-random array with Rademacher distribution where elements are either +1 or -1.
Generates 64-bit integers on multiple parallel threads.
uint64_t next(const int thread_id)
Generates the next random number in the sequence, depending on the thread id.