MCPcopy Create free account
hub / github.com/Niko1221/Strata / random_rows

Function random_rows

engine/src/kernels/tq_pascal_bench.cpp:61–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61std::vector<uint8_t> random_rows(int t, int64_t rows, int64_t n, std::mt19937& rng) {
62 const int bv = t == 42 ? 64 : 128;
63 const size_t rb = k::iq_row_bytes(t, n), bs = k::iq_row_bytes(t, bv);
64 std::vector<uint8_t> w((size_t) rows * rb);
65 std::uniform_int_distribution<int> byte(0, 255), ex(2, 8), man(0, 1023), sgn(0, 3);
66 for (auto& b : w) b = (uint8_t) byte(rng);
67 for (size_t o = 0; o < w.size(); o += bs) {
68 const uint16_t h = (uint16_t) ((sgn(rng) == 0 ? 0x8000 : 0) | (ex(rng) << 10) | man(rng)); // 2^-13 .. 2^-6
69 std::memcpy(&w[o], &h, 2);
70 }
71 return w;
72}
73
74std::vector<float> random_x(size_t n, std::mt19937& rng) {
75 std::normal_distribution<float> nd(0.f, 1.f);

Callers 4

check_mmvqFunction · 0.70
GroupedMethod · 0.70
check_tqp_referenceFunction · 0.70
benchFunction · 0.70

Calls 3

memcpyFunction · 0.85
iq_row_bytesFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected