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++];
65static inline int one_ordered_ins(
one_vec_t *
const err,
const int j){
67 while(j < err->vec[pos]){
68 err->
vec[pos+1] = err->
vec[pos];
72 if (j == err->
vec[pos])
73 ERROR(
"Unexpected! vec[%d]=%d is already present!",pos,j);
77 for(
int i=0; i < err->
wei; i++)
78 if(err->
vec[i] >= err->
vec[i+1]){
79 printf(
"check ordering at i=%d! ",i);
91static inline int one_ordered_search(
one_vec_t *
const err,
const int val){
93 int bot=0, top=err->
wei , mid=0;
102 ERROR(
"this should not happen");
104 if (err->
vec[mid] <= val)
109 if ( err->
vec[bot] == val)
116static inline void one_ordered_pos_del(
120 if ((pos < 0) || (pos >= err->
wei) || (err->
wei == 0)
121 || (err->
vec[pos] != val))
122 ERROR(
"this should not happen!");
125 for (
int i = pos; i < err->
wei; i++)
126 err->
vec[i] = err->
vec[i + 1];
132static inline int one_ordered_find_del(
one_vec_t *
const err,
const int val) {
133 int pos = one_ordered_search(err, val);
136 one_ordered_pos_del(err, val, pos);
141 const int w_limit,
const int max_col_wt,
142 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