24#define _maybe_unused __attribute__((unused))
85static inline int minint(
const int a,
const int b) {
return (a < b) ? a : b; }
166 "%s: distance of a classical or quantum CSS code\n" \
167 "\tusage: %s parameter=value [...]\n\n" \
168 " Required parameter:\n" \
169 "\tmethod=[int]: bitmap for method used (no default): \n" \
171 "\t\t1: random window (RW) algorithm. Options:\n" \
172 "\t\t steps=[int]: how many information sets to use (1000)\n" \
173 "\t\t wmin=[int]: minimum distance of interest (1)\n" \
174 "\t\t\t immediately stop and return '-w' on a cw of weight w<=wmin\n" \
175 "\t\t\t use this option to quickly scan over a large number of codes\n" \
177 "\t\t2: connected cluster (CC) algorithm. Options:\n" \
178 "\t\t wmax=[int]: maximum cluster weight to construct, inclusive (0)\n" \
179 "\t\t\t optional if timeout>0 or dmax>0 is set; otherwise required for CC only\n" \
180 "\t\t smax=[int]: maximum syndrome weight of interest, inclusive (5)\n" \
181 "\t\t\t must be non-zero to calculate confinement profile\n" \
182 "\t\t start=[int]: use only this position to start (equiv. to cbeg=cend=start) (-1)\n" \
183 "\t\t cbeg=[int]: start column to begin CC search (-1)\n" \
184 "\t\t cend=[int]: end column to limit CC search (-1)\n" \
185 "\t\t noscan=[int]: start CC directly with wmax (0)\n" \
186 "\t\t3: bracketing mode (balanced concurrent RW and CC)\n" \
188 " Execution and multithreading parameters:\n" \
189 "\tthreads=[int]: number of threads to use (0 for auto CPU count) (0)\n" \
190 "\ttimeout=[sec]: timeout in seconds (60.0)\n" \
191 "\tdexp=[int]: expected distance value for method=3 (alias: dest) (0)\n" \
193 " Distance bounds parameters:\n" \
194 "\tdmin=[int]: known lower bound on distance, inclusive (w starts from dmin in CC) (1)\n" \
195 "\tdmax=[int]: known upper bound on distance, inclusive (RW ignores codewords of weight >= dmax) (0)\n" \
197 " General parameters:\n" \
198 "\tfdem=[str]: detector error model (DEM) file from stim (NULL)\n" \
199 "\tpmin=[float]: minimum error probability to keep for DEM (0.0)\n" \
200 "\tfinH=[str]: parity check matrix Hx (NULL)\n" \
201 "\tfinG=[str]: matrix Hz (quantum CSS code only) (NULL)\n" \
202 "\tfinL=[str]: matrix Lx (quantum CSS code only) (NULL)\n" \
203 "\t\t Either L=Lx or G=Hz matrix is required for a quantum CSS code\n" \
204 "\tfin=[str]: base name for input files (\"try\")\n" \
205 "\t\t set finH->\"${fin}X.mtx\" finG->\"${fin}Z.mtx\"\n" \
206 "\tcss=[int]: reserved for future use (1)\n" \
207 "\tseed=[int]: rng seed [use 0 for time(NULL)] (0)\n" \
208 "\tdebug=[int]:\t bitmap for aux information to output (3)\n" \
209 "\t\t0: clear the entire debug bitmap to 0.\n" \
210 "\t\t1: output misc general info (on by default)\n" \
211 "\t\t2: output more general info (on by default)\n" \
212 "\t\t4: debug command line arguments parsing\n" \
213 "\t\t8: output progress reports every 1000 steps\n" \
214 "\t\t16: output new min-weight codewords found (cut large vectors)\n" \
215 "\t\t32: output matrices (unless n is large)\n" \
216 "\t\t64: debug confinement hash updates (swei changes)\n" \
217 "\t\t128: debug duplicate syndromes in confinement hash (debug build only)\n" \
218 "\t\t256: reserved\n" \
219 "\t\t512: reserved\n" \
220 "\t\t1024: reserved\n" \
221 "\t\t2048: allow big matrix / large vector output\n" \
222 "\t\t see the source code for more options\n" \
223 "\t Multiple 'debug' parameters are XOR combined except for 0.\n" \
224 "\t Use debug=0 as the 1st argument to suppress all debug messages.\n"\
225 " -h gives this help (also '--help')\n"
228 "try \"%s -h\" for help"
Utility functions for use with uthash.h
void read_dem_file(char *fnam, csr_t **p_spaH, csr_t **p_spaL, double pmin, int debug)
Read a Detector Error Model (DEM) file and construct H and L matrices.
void var_kill(params_t *const p)
Clean up and free memory allocated in the params_t structure.
long long int nzlist_read(const char fnam[], params_t *p)
Read codewords from a .nz list file and add them to the codeword hash.
cw_vec_t * codeword_add_maybe(params_t *const p, const int arr[], int weight)
Add a candidate codeword to the hash table if it meets weight limits.
long long int nzlist_write(const char fnam[], const char comment[], params_t *p)
Write the found codewords from the hash table to a .nz file.
void var_init(int argc, char **argv, params_t *const p)
Initialize parameters and load matrices from command line arguments.