30 const csr_t *
const mat,
const int row){
32 if ((!v1) || (!v0) || (!mat))
33 ERROR(
"all arguments must be allocated: v1=%p v0=%p mat=%p\n",v1,v0,mat);
35 ERROR(
"the two vectors should not be the same !");
36 if((row<0) || (row >= mat->
rows))
37 ERROR(
"this should not happen\n");
40 for (iM = mat->
p[row]; iM < mat->
p[row+1]; iM++){
41 const int ic = mat->
i[iM];
42 while((i0 < v0->wei) && (v0->
vec[i0] < ic))
43 v1->
vec[i1++] = v0->
vec[i0++];
52 for ( ; iM < mat->
p[row+1]; iM++){
53 const int ic = mat->
i[iM];
58 v1->
vec[i1++] = v0->
vec[i0++];
69static inline int one_ordered_ins(
one_vec_t *
const err,
const int j){
71 while((pos >= 0) && (j < err->vec[pos])){
72 err->
vec[pos+1] = err->
vec[pos];
76 if ((pos >= 0) && (j == err->
vec[pos]))
77 ERROR(
"Unexpected! vec[%d]=%d is already present!",pos,j);
81 for(
int i=0; i < err->
wei; i++)
82 if(err->
vec[i] >= err->
vec[i+1]){
83 printf(
"check ordering at i=%d! ",i);
95static inline int one_ordered_search(
one_vec_t *
const err,
const int val){
97 int bot=0, top=err->
wei , mid=0;
102 while(top - bot > 1){
103 mid = (top+bot) >> 1;
106 ERROR(
"this should not happen");
108 if (err->
vec[mid] <= val)
113 if ( err->
vec[bot] == val)
120static inline void one_ordered_pos_del(
124 if ((pos < 0) || (pos >= err->
wei) || (err->
wei == 0)
125 || (err->
vec[pos] != val))
126 ERROR(
"this should not happen!");
129 for (
int i = pos; i < err->
wei; i++)
130 err->
vec[i] = err->
vec[i + 1];
136static inline int one_ordered_find_del(
one_vec_t *
const err,
const int val) {
137 int pos = one_ordered_search(err, val);
140 one_ordered_pos_del(err, val, pos);
145 const int w_limit,
const int max_col_wt,
146 const csr_t *
const mH,
const csr_t *
const mHT,
void one_vec_print(const one_vec_t *const pvec)
distance of a classical or quantum CSS code
int do_CC_dist(params_t *const p)
int start_CC_recurs(one_vec_t *err, one_vec_t *urr, one_vec_t *const syn[], const int w_limit, const int max_col_wt, const csr_t *const mH, const csr_t *const mHT, params_t *const p)
recursively construct codewords
Utility functions for use with uthash.h.
struct ONE_VEC_T one_vec_t