<
typenameVT>
27 VTv_tmp {0, 10, 31, 32, 62, 63,
30bm::id_max48/2 + 10, bm::id_max48/2 + 16,
40 template<
typenameVT,
typenameDISTR,
typenameMT_RAND>
42DISTR& dist, MT_RAND& mt_rand)
44 for(
unsigned i= 0;
i< 256; ++
i)
49 for(
unsignedj = 0; j < 65536/3; ++j)
52vect.push_back(sub_base + idx);
57 for(
unsignedj = 0; j < 65536;)
59 unsignedto = j + ((unsigned)rand() % 256);
60 for(
unsignedk = j; k < to && k < 65536; ++k, ++j)
61vect.push_back(sub_base + k);
69 template<
typenameVT>
72std::random_device rd;
73std::mt19937_64 mt_rand(rd());
74std::uniform_int_distribution<int> dist(0, 65535);
87range_base = bm::id_max48 / 2;
91 #if defined(BMAVX2OPT) 93range_base = bm::id_max48 - (65536 * 257);
98vect.erase(std::unique(vect.begin(), vect.end() ), vect.end());
105 template<
typenameBV>
108 typenameBV::size_type
i, j;
109 for(
i= 0;
i< vector_max;)
112 for(j = 0; j < 65535*8;
i+= 10, j++)
119 for(j = 0; j < 65535;
i+= 120, j++)
121 unsigned len= (unsigned)rand() % 64;
122bv.set_range(
i,
i+
len);
123 boolall_one_range = bv.is_all_one_range(
i,
i+
len);
134 template<
typenameVT,
typenameSIZE_TYPE>
142 for(j = from; j < to; j += 2)
144 for(j = from; j < to; j += 5)
146 for(j = from; j < to; j += 120)
151 template<
typenameBV>
154 typenameBV::size_type
min,
155 typenameBV::size_type
max,
156 unsignedfill_factor)
158 typenameBV::bulk_insert_iterator bii1(bv1);
159 for(
typenameBV::size_type
i=
min;
i<
max;
i+= fill_factor)
171 template<
typenameBVMINI,
typenameBV,
typenameSZT>
177 boolset_flag =
true)
179std::random_device rd;
180std::mt19937_64 mt_rand(rd());
182 while(fill_factor == 0)
184fill_factor = (unsigned)rand() % 10;
188cout <<
"Intervals filling. Factor=" 189<< fill_factor << endl << endl;
192SZT factor = 70 * fill_factor;
193std::uniform_int_distribution<unsigned> dist_f(1,
unsigned(factor));
194std::uniform_int_distribution<unsigned> dist_f10(1,
unsigned(factor) * 10);
195std::uniform_int_distribution<unsigned> dist_f10_max(1,
unsigned(factor) * 10 *
bm::gap_max_bits);
204 len= dist_f(mt_rand);
207}
while(end >=
max);
210bvect_full.set_range(
i, end - 1, set_flag);
211 boolall_one_range = bvect_full.is_all_one_range(
i, end - 1);
212 assert(all_one_range == set_flag);
215 for(j =
i; j < end; ++j)
220bvect_min->set_bit(j);
225bvect_min->clear_bit(j);
229 len= dist_f10_max(mt_rand);
232 len*= dist_f10(mt_rand);
238 for(
unsignedk = 0; k < 1000 &&
i<
max; k += 3,
i+= 3)
243bvect_min->set_bit(
i);
244bvect_full.set_bit_no_check(
i);
249bvect_min->clear_bit(j);
250bvect_full.clear_bit(j);
257 template<
typenameBV,
typenameSZT>
263 boolset_flag =
true)
265std::random_device rd;
266std::mt19937_64 mt_rand(rd());
268std::uniform_int_distribution<unsigned> dist10(1, 10);
270 while(fill_factor == 0)
272fill_factor = dist10(mt_rand);
276cout <<
"Intervals filling. Factor=" 277<< fill_factor << endl << endl;
280SZT factor = 70 * fill_factor;
282std::uniform_int_distribution<unsigned> dist_f(1,
unsigned(factor));
283std::uniform_int_distribution<unsigned> dist_f10(1,
unsigned(factor) * 10);
284std::uniform_int_distribution<unsigned> dist_f10_max(1,
unsigned(factor) * 10 *
bm::gap_max_bits);
293 len= dist_f(mt_rand);
296}
while(end >=
max);
299bvect_full.set_range(
i, end - 1, set_flag);
300 boolall_one_range = bvect_full.is_all_one_range(
i, end - 1);
301 assert(all_one_range == set_flag);
306 len= dist_f10_max(mt_rand);
309 len*= dist_f10(mt_rand);
316 for(
unsignedk = 0; k < 1000 &&
i<
max; k += 3,
i+= 3)
320bvect_full.set_bit_no_check(
i);
324bvect_full.clear_bit(
i);
332 template<
typenameSZT>
335SZT
r= (unsigned(rand()) << 16u) |
unsigned(rand());
338SZT
r2= (unsigned(rand()) << 16u) |
unsigned(rand());
344 template<
typenameBVMINI,
typenameBV,
typenameSZT>
355 if(fill_factor == 0)
357SZT n_id = (
max-
min) / 1000;
358cout <<
"random filling : "<< n_id << endl;
359 for(
i= 0;
i< n_id;
i++)
362bvect_min->set_bit(
id);
363bvect_full->set_bit(
id);
369cout <<
"fill_factor random filling : factor = " 370<< fill_factor << std::endl;
372 for(
i= 0;
i< fill_factor;
i++)
374 unsignedk = unsigned(rand()) % 10;
379SZT start =
min+ (
max-
min) / (fill_factor * k);
390SZT end = start + (
max- start) / (fill_factor * 2);
400 typenameBV::bulk_insert_iterator iit = bvect_full->inserter();
405 unsigned r= unsigned(rand()) % 8;
409 unsignedinc = unsigned(rand()) % 3;
411SZT end2 = start + (unsigned)rand() % 1000;
416bvect_min->set_bit(start);
425bvect_min->set_bit(start);
432bvect_min->set_bit(start);
439 unsignedc = unsigned(rand()) % 15;
442 for(; start < end; ++start)
444bvect_min->set_bit(start);
457 template<
typenameBVMINI,
typenameBV,
typenameSZT>
468 template<
typenameBVMINI,
typenameBV,
typenameSZT>
475SZT bit_idx = SZT(rand()) % range;
476bvect_min->set_bit(bit_idx);
477bvect_full->set_bit(bit_idx);
478cout <<
"Bit_idx="<< bit_idx << endl;
481 template<
typenameBVMINI,
typenameBV,
typenameSZT>
506 for(
unsigned i= 0;
i<
count; ++
i)
508SZT bn = SZT(rand()) %
count;
514bvect_min->set_bit(bn);
515bvect_full->set_bit_no_check(bn);
517cout <<
"Ok"<< endl;
521 template<
typenameBVMINI,
typenameBV,
typenameSZT>
528 typenameBV::bulk_insert_iterator iit = bvect_full->inserter();
529SZT step = (unsigned)rand() % 4;
530 if(step < 2) ++step;
531 for(SZT
i= 0;
i<
max;
i+=step)
533bvect_min->set_bit(
i);
536cout <<
"Ok"<< endl;
553 template<
typenameBVMINI,
typenameBV,
typenameSZT>
571cout <<
"Random filling: method - FillSets - factor(0)"<< endl;
576cout <<
"Random filling: method - FillSets - factor(random)"<< endl;
577factor = (unsigned)rand()%3;
582cout <<
"Random filling: method - Set-Clear Intervals - factor(random)"<< endl;
583factor = (unsigned)rand()%10;
587cout <<
"Random filling: method - FillRandom - factor(random)"<< endl;
588factor = (unsigned)rand()%3;
592cout <<
"Random set one bit"<< endl;
596cout <<
"Regular pattern filling"<< endl;
618cout <<
"Random filling: method - Set Intervals - factor(random)"<< endl;
619factor = (unsigned)rand()%10;
627cout <<
"Vector optimization..."<< flush;
629bvect_full->optimize(tb);
630cout <<
"OK"<< endl;
637 template<
typenameBV>
639 typenameBV::size_type
min,
640 typenameBV::size_type
max= 40000000,
641 unsignedfill_factor = 65536)
643 typenameBV::bulk_insert_iterator iit(bv);
644 unsignedff = fill_factor / 10;
645 for(
typenameBV::size_type
i=
min;
i<
max;
i+= ff)
649 if(ff > fill_factor)
650ff = fill_factor / 10;
656 template<
typenameVECT>
659 unsigned long longvector_max,
666 unsignedcnt1 = (
count/ 2);
669 for(
i= 0;
i< cnt1; ++
i)
671std::unique_ptr<typename VECT::value_type> bv (
new typename VECT::value_type);
676target->push_back(std::move(*bv));
679 unsigned long longfill_factor = 10;
682std::unique_ptr<typename VECT::value_type> bv (
new typename VECT::value_type);
686target->push_back(std::move(*bv));
691 template<
typenameSV>
696 unsignedmax_idx_value = 1000000;
701cout <<
"SV Ultra sparse generation"<< endl;
702 for(
unsigned i= 0;
i< max_idx_value;)
704 value_typev = (unsigned)(rand() * rand()) % 650000;
716 i+= 10000 + (unsigned)rand() % 65535;
722cout <<
"SV Dense intervals generation 1"<< endl;
723 for(
unsigned i= 0;
i< max_idx_value;)
725 value_typev = (unsigned)(rand() * rand()) % 650000;
726 for(
unsignedj = 0;
i< max_idx_value; ++
i, ++j)
739 i+= 20000 + (unsigned)rand() % 65535;
745cout <<
"SV Dense intervals generation 2"<< endl;
746 value_typev = (unsigned)(rand() * rand()) % 650000;
747 for(
unsigned i= 0;
i< max_idx_value/4; ++
i)
752 for(
unsigned i= 0;
i< max_idx_value;)
754v = unsigned(rand() * rand()) % 650000;
755 for(
unsignedj = 0;
i< max_idx_value; ++
i, ++j)
760sv[
i] = -
int(
unsigned(v) +
i);
764 i+= 30000 + unsigned(rand()) % 65535;
770cout <<
"SV random generation"<< endl;
771 unsignedrand_max = (unsigned)rand() % 300000;
772 for(
unsigned i= 0;
i< rand_max; ++
i)
775 unsignedidx = unsigned(rand()) % max_idx_value;
783sv.clear(idx,
true);
790cout <<
"SV empty generation"<< endl;
791 unsignedidx = unsigned(rand()) % max_idx_value;
793sv.clear(idx,
true);
798cout <<
"SV uniform power 2 value generation"<< endl;
800 for(
unsigned i= 0;
i< max_idx_value; ++
i)
808cout <<
"SV uniform power 2+1 value generation"<< endl;
810 for(
unsigned i= 0;
i< max_idx_value; ++
i)
822cout <<
"SV linear growth/decline value generation"<< endl;
823 for(
unsigned i= 0;
i< max_idx_value; ++
i)
828sv[
i] = -
int(
i);
844 typenameSV::size_type
min,
845 typenameSV::size_type
max,
846 unsignedfill_factor)
848 typenameSV::size_type diap =
max-
min;
849 typenameSV::size_type
count;
865 if(vect.size() <
max)
866vect.resize(
max+ 1);
867 if(svect.size() <
max)
868svect.resize(
max+ 1);
874 val= (unsigned)rand() % (65535 * 2);
886 unsignedinc = (unsigned)rand() % 2048;
892 val= (unsigned)rand() % 8;
905 template<
typenameSSV>
908 stringprefix =
"az";
910 for(
unsigned i= 0;
i< max_coll; ++
i)
913 str.append(to_string(
i));
914str_coll.emplace_back(
str);
918 unsignedprefix_len = (unsigned)rand() % 5;
919 for(
unsignedj = 0; j < prefix_len; ++j)
921 charcch = char(
'a'+ (
unsigned)rand() % 26);
922prefix.push_back(cch);
930 template<
typenameCBCBuf>
933 unsignedsz_factor = (unsigned)rand() % 10;
936 unsigned size= 65000 + (128000 / sz_factor);
938 unsigned char*
data=
buf.data();
939 for(
unsigned i= 0;
i<
size; ++
i)
941 data[
i] = (
unsignedchar)
i;
945 template<
typenameCBC>
948 unsignedsz = (unsigned)rand() % 10000;
950 unsignedkey_factor = (unsigned)rand() % 128;
953 for(
unsigned i= 0;
i< sz; ++
i)
956 typenameCBC::buffer_type
buf;
958cbc.move_buffer(
key,
buf);
966 template<
typenameSV>
968 typenameSV::size_type vector_max)
970 typenameSV::back_insert_iterator bi(sv.get_back_inserter());
973 for(
typenameSV::size_type
i= 0;
i< vector_max; ++
i)
975 unsignedplato = (unsigned)rand() % 16;
976 for(
unsignedj = 0;
i< vector_max && j < plato; ++
i, ++j)
982 unsignednulls = (unsigned)rand() % 16;
#define BM_DECLARE_TEMP_BLOCK(x)
#define test(a, b, c, d, e)
static const char * str(char *buf, int n)
void FillTestBuffer(CBCBuf &buf)
void FillSetsIntervals(BVMINI *bvect_min, BV &bvect_full, SZT min, SZT max, SZT fill_factor, bool set_flag=true)
void FillSetsRegular(BVMINI *bvect_min, BV *bvect_full, SZT, SZT max, SZT)
void generate_vect48_range(VT &vect, unsigned long long range_base, DISTR &dist, MT_RAND &mt_rand)
sub-range vector generator
int FillSetsRandomMethod(BVMINI *bvect_min, BV *bvect_full, SZT min, SZT max, int optimize=0, int method=-1)
void GenerateShiftTestCollection(VECT *target, unsigned count, unsigned long long vector_max, bool optimize)
void generate_bvector(BV &bv, typename BV::size_type vector_max, bool optimize)
void generate_sparse_bvector(BV &bv, typename BV::size_type min, typename BV::size_type max=40000000, unsigned fill_factor=65536)
void FillSetClearIntervals(BVMINI *bvect_min, BV *bvect_full, SZT min, SZT max, SZT fill_factor)
void GenerateCompressedBufferCollection(CBC &cbc)
void GenerateTestStrCollection(SSV &str_coll, typename SSV::size_type max_coll)
void SimpleGapFillSets(BV &bv0, BV &bv1, typename BV::size_type min, typename BV::size_type max, unsigned fill_factor)
void FillSetsRandom(BVMINI *bvect_min, BV *bvect_full, SZT min, SZT max, SZT fill_factor)
void generate_vect_simpl0(VT &vect)
generate certain simple benchmark values
void FillSparseIntervals(std::vector< unsigned > &vect, SV &svect, typename SV::size_type min, typename SV::size_type max, unsigned fill_factor)
void FillSets(BVMINI *bvect_min, BV *bvect_full, SZT min, SZT max, SZT fill_factor)
void generate_serialization_test_set(SV &sv, typename SV::size_type vector_max)
void FillSetsRandomOne(BVMINI *bvect_min, BV *bvect_full, SZT min, SZT max)
void generate_test_vectors(VT &v1, VT &v2, VT &v3, SIZE_TYPE from, SIZE_TYPE to)
void GenerateSV(SV &sv, unsigned strategy=0)
SZT random_minmax(SZT min, SZT max)
void generate_vect48(VT &vect)
generate test random vector in 48-bit range
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
NCBI_NS_STD::string::size_type SIZE_TYPE
strategy
Block allocation strategies.
unsigned int
A callback function used to compare two keys in a database.
const unsigned bits_in_array
unsigned long long int id64_t
const unsigned gap_max_bits
constexpr auto sort(_Init &&init)
double value_type
The numeric datatype used by the parser.
const struct ncbi::grid::netcache::search::fields::SIZE size
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static const sljit_gpr r2
ad-hoc conditional expressions
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4