39 template<
class T>
inline 46 if(((p = P[0]) & s) != 0)
break;
51 if(((q = Q[-1]) & s) == 0)
break;
58 while(((p = P[0]) & s) == 0) P++;
59 while(((q = Q[-1]) & s) != 0) Q--;
72 template<
class T,
class S>
inline 80 if(((p = P[0]) & s) != 0)
break;
86 if(((q = Q[-1]) & s) == 0)
break;
99 while(((p = P[0]) & s) == 0) P++, U++;
100 while(((q = Q[-1]) & s) != 0) Q--, V--;
113 template<
class T,
class S,
class R>
inline 122 if(((p = P[0]) & s) != 0)
break;
129 if(((q = Q[-1]) & s) == 0)
break;
148 while(((p = P[0]) & s) == 0) P++, A++, U++;
149 while(((q = Q[-1]) & s) != 0) Q--, B--, V--;
162 template<
class T>
inline 165 T *P = _P, *Q = _Q, *A = _A, *B = _B;
169 if(((p = P[0]) & s) != 0)
break;
175 if(((q = Q[-1]) & s) == 0)
break;
188 while(((p = P[0]) & s) == 0) P++, A++;
189 while(((q = Q[-1]) & s) != 0) Q--, B--;
207 template<
class T,
class S>
inline 210 T *P = _P, *Q = _Q, *A = _A, *B = _B;
215 if(((p = P[0]) & s) != 0)
break;
222 if(((q = Q[-1]) & s) == 0)
break;
241 while(((p = P[0]) & s) == 0) P++, A++, U++;
242 while(((q = Q[-1]) & s) != 0) Q--, B--, V--;
261 template<
class T>
inline 283 template<
class T>
inline 286 if(_V.
size() < 2)
return;
295 template<
class T,
class S>
inline 298 if(_V.
size() < 2)
return;
308 template<
class T,
class S,
class R>
inline 311 if(_V.
size() < 2)
return;
320 template<
class T>
inline 323 if(_V.
size() < 2)
return;
334 template<
class T,
class S>
inline 337 if(_V.
size() < 2)
return;
347 template<
class T>
inline 350 if(_P.
size() < 2)
return;
351 T *P = &_P[0], *Q = &_P[0] + _P.
size();
366 _P.
resize(
int(R - &_P[0]));
375 template<
class T>
inline 378 if(_P.
size() < 2)
return;
379 T *P = &_P[0], *Q = &_P[0] + _P.
size();
389 if ((*R != *P) || (*W != *U))
398 _P.
resize(
int(R - &_P[0]));
399 _U.
resize(
int(W - &_U[0]));
408 template<
class T,
class S>
inline 411 if(_P.
size() < 2)
return;
412 T *P = &_P[0], *Q = &_P[0] + _P.
size();
435 _P.
resize(
int(R - &_P[0]));
436 _A.
resize(
int(C - &_A[0]));
446 template<
class T,
class S>
inline 449 if(_P.
size() < 2)
return;
450 T *P = &_P[0], *Q = &_P[0] + _P.
size();
462 if ((*R == *P) && (*W == *U))
477 _P.
resize(
int(R - &_P[0]));
478 _U.
resize(
int(W - &_U[0]));
479 _A.
resize(
int(C - &_A[0]));
493 template<
class T>
inline 496 size_t dsize = data.
size(), gsize = glob.
size();
506 size_t cidx, ridx, widx=0;
507 for (ridx=0, cidx=0; ridx<dsize; ridx++)
509 while (glob[cidx] < data[ridx] && cidx < (gsize-1)) cidx++;
510 if(data[ridx] == glob[cidx]) {
520 fprintf(stderr,
"global_to_local warning: Not all indices could be mapped!\n");
539 template<
class T>
inline 542 size_t dsize = data.
size(), gsize = glob.
size();
550 perm_data.resize(dsize);
555 size_t cidx, ridx, widx=0;
556 for (ridx=0, cidx=0; ridx<dsize; ridx++)
558 while (_glob[cidx] < data[ridx] && cidx < (gsize-1)) cidx++;
559 if(data[ridx] == _glob[cidx]) {
560 data[widx] = perm_glob[cidx];
569 fprintf(stderr,
"global_to_local warning: Not all indices could be mapped!\n");
586 template<
class T>
inline 590 for(
size_t i=0; i<data.
size(); i++) {
591 auto it = g2l.
find(data[i]);
592 if(it != g2l.
end()) {
593 data[widx++] = it->second;
598 if(widx < data.
size()) {
601 fprintf(stderr,
"%s warning: Not all indices could be mapped!\n", __func__);
The vector class and related algorithms.
void _binary_sort_copy_copy(T *_P, T *_Q, S *_A, S *_B, R *_U, R *_V, T s)
void interval(vector< T > &vec, size_t start, size_t end)
Create an integer interval between start and end.
void global_to_local_sorted(const vector< T > &glob, vector< T > &data, bool sortedData, bool doWarn)
void unique_resize(vector< T > &_P)
void binary_sort_sort_copy(vector< T > &_V, vector< T > &_W, vector< S > &_A)
void _binary_sort(T *_P, T *_Q, T s)
void _binary_sort_sort_copy(T *_P, T *_Q, T *_A, T *_B, S *_U, S *_V, T s, T t)
void _binary_sort_copy(T *_P, T *_Q, S *_U, S *_V, T s)
void binary_sort_copy_copy(vector< T > &_V, vector< S > &_W, vector< R > &_A)
void binary_sort_copy(vector< T > &_V, vector< S > &_W)
void _binary_sort_sort(T *_P, T *_Q, T *_A, T *_B, T s, T t)
void global_to_local(const vector< T > &glob, vector< T > &data, bool sortedData, bool doWarn)
T _binary_log(const T *P, const T *Q)
size_t size() const
The current size of the vector.
void unique_accumulate(vector< T > &_P, vector< S > &_A)
A vector storing arbitrary data.
iterator find(const K &key)
Search for key. Return iterator.
void binary_sort(vector< T > &_V)
void resize(size_t n)
Resize a vector.
void binary_sort_sort(vector< T > &_V, vector< T > &_W)
Classes similar to unordered_set and unordered_map, but with better performance.