/usr/include/quantum.h is in libquantum-dev 1.1.1-3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | /* quantum.h: Header file for libquantum
Copyright 2003-2013 Bjoern Butscher, Hendrik Weimer
This file is part of libquantum
libquantum is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3 of the License,
or (at your option) any later version.
libquantum is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with libquantum; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA
*/
#ifndef __QUANTUM_H
#define __QUANTUM_H
#define COMPLEX_FLOAT float _Complex
#define MAX_UNSIGNED unsigned long long
#define quantum_density_operation(function, rho, ...) \
do{ \
int quantum_int; \
for(quantum_int=0; quantum_int < rho.num; quantum_int++) \
function(__VA_ARGS__, &rho.reg[quantum_int]); \
} while(0)
/* A ROWS x COLS matrix with complex elements */
struct quantum_matrix_struct {
int rows;
int cols;
COMPLEX_FLOAT *t;
};
typedef struct quantum_matrix_struct quantum_matrix;
/* The quantum register */
struct quantum_reg_struct
{
int width; /* number of qubits in the qureg */
int size; /* number of non-zero vectors */
int hashw; /* width of the hash array */
COMPLEX_FLOAT *amplitude;
MAX_UNSIGNED *state;
int *hash;
};
typedef struct quantum_reg_struct quantum_reg;
struct quantum_density_op_struct
{
int num; /* total number of state vectors */
float *prob; /* probabilities of the state vectors */
quantum_reg *reg; /* state vectors */
};
typedef struct quantum_density_op_struct quantum_density_op;
enum {
QUANTUM_SOLVER_LANCZOS,
QUANTUM_SOLVER_LANCZOS_MODIFIED,
QUANTUM_SOLVER_IMAGINARY_TIME
};
extern quantum_reg quantum_new_qureg(MAX_UNSIGNED initval, int width);
extern quantum_reg quantum_new_qureg_size(int n, int width);
extern quantum_reg quantum_new_qureg_sparse(int n, int width);
extern void quantum_delete_qureg(quantum_reg *reg);
extern void quantum_print_qureg(quantum_reg reg);
extern void quantum_addscratch(int bits, quantum_reg *reg);
extern void quantum_print_timeop(int width, void f(quantum_reg *));
extern void quantum_cnot(int control, int target, quantum_reg *reg);
extern void quantum_toffoli(int control1, int control2, int target,
quantum_reg *reg);
extern void quantum_unbounded_toffoli(int controlling, quantum_reg *reg, ...);
extern void quantum_sigma_x(int target, quantum_reg *reg);
extern void quantum_sigma_y(int target, quantum_reg *reg);
extern void quantum_sigma_z(int target, quantum_reg *reg);
extern void quantum_gate1(int target, quantum_matrix m, quantum_reg *reg);
extern void quantum_gate2(int target1, int target2, quantum_matrix m,
quantum_reg *reg);
extern void quantum_r_x(int target, float gamma, quantum_reg *reg);
extern void quantum_r_y(int target, float gamma, quantum_reg *reg);
extern void quantum_r_z(int target, float gamma, quantum_reg *reg);
extern void quantum_phase_scale(int target, float gamma, quantum_reg *reg);
extern void quantum_phase_kick(int target, float gamma, quantum_reg *reg);
extern void quantum_hadamard(int target, quantum_reg *reg);
extern void quantum_walsh(int width, quantum_reg *reg);
extern void quantum_cond_phase(int control, int target, quantum_reg *reg);
extern void quantum_cond_phase_inv(int control, int target, quantum_reg *reg);
extern void quantum_cond_phase_kick(int control, int target, float gamma,
quantum_reg *reg);
extern void quantum_cond_phase_shift(int control, int target, float gamma,
quantum_reg *reg);
extern int quantum_gate_counter(int inc);
extern void quantum_qft(int width, quantum_reg *reg);
extern void quantum_qft_inv(int width, quantum_reg *reg);
extern void quantum_exp_mod_n(int N, int x, int width_input, int width,
quantum_reg *reg);
extern MAX_UNSIGNED quantum_measure(quantum_reg reg);
extern int quantum_bmeasure(int pos, quantum_reg *reg);
extern int quantum_bmeasure_bitpreserve(int pos, quantum_reg *reg);
extern quantum_matrix quantum_new_matrix(int cols, int rows);
extern void quantum_delete_matrix(quantum_matrix *m);
extern quantum_matrix quantum_mmult(quantum_matrix A, quantum_matrix B);
extern int quantum_ipow(int a, int b);
extern int quantum_gcd(int u, int v);
extern void quantum_cancel(int *a, int *b);
extern void quantum_frac_approx(int *a, int *b, int width);
extern int quantum_getwidth(int n);
extern double quantum_prob(COMPLEX_FLOAT a);
extern float quantum_get_decoherence();
extern void quantum_set_decoherence(float lambda);
extern void quantum_decohere(quantum_reg *reg);
extern quantum_reg quantum_matrix2qureg(quantum_matrix *m, int width);
extern quantum_matrix quantum_qureg2matrix(quantum_reg reg);
extern quantum_reg quantum_kronecker(quantum_reg *reg1, quantum_reg *reg2);
extern COMPLEX_FLOAT quantum_dot_product(quantum_reg *reg1, quantum_reg *reg2);
extern quantum_reg quantum_vectoradd(quantum_reg *reg1, quantum_reg *reg2);
extern void quantum_vectoradd_inplace(quantum_reg *reg1, quantum_reg *reg2);
extern quantum_reg quantum_matrix_qureg(quantum_reg A(MAX_UNSIGNED, double),
double t, quantum_reg *reg, int flags);
extern void quantum_scalar_qureg(COMPLEX_FLOAT r, quantum_reg *reg);
extern void quantum_print_timeop(int width, void f(quantum_reg *));
extern void quantum_qec_encode(int type, int width, quantum_reg *reg);
extern void quantum_qec_decode(int type, int width, quantum_reg *reg);
extern const char * quantum_get_version();
extern void quantum_objcode_start();
extern void quantum_objcode_stop();
extern int quantum_objcode_write(char *file);
extern void quantum_objcode_run(char *file, quantum_reg *reg);
extern quantum_density_op quantum_new_density_op(int num, float *prob,
quantum_reg *reg);
extern quantum_density_op quantum_qureg2density_op(quantum_reg *reg);
extern void quantum_reduced_density_op(int pos, quantum_density_op *rho);
extern quantum_matrix quantum_density_matrix(quantum_density_op *rho);
extern void quantum_print_density_matrix(quantum_density_op *rho);
extern void quantum_delete_density_op(quantum_density_op *rho);
extern float quantum_purity(quantum_density_op *rho);
extern void *quantum_error_handler(void *f(int));
extern const char *quantum_strerr(int errno);
extern void quantum_error(int errno);
extern void quantum_rk4(quantum_reg *reg, double t, double dt,
quantum_reg H(MAX_UNSIGNED, double), int flags);
extern double quantum_rk4a(quantum_reg *reg, double t, double *dt,
double epsilon,
quantum_reg H(MAX_UNSIGNED, double), int flags);
extern void quantum_diag_time(double t, quantum_reg *reg0, quantum_reg *regt,
quantum_reg *tmp1, quantum_reg *tmp2,
quantum_matrix H, float **w);
extern double quantum_groundstate(quantum_reg *reg, double epsilon,
quantum_reg H(MAX_UNSIGNED, double),
int solver, double stepsize);
#endif
|