quantum.h   quantum.h 
/* quantum.h: Header file for libquantum /* quantum.h: Header file for libquantum
Copyright 2003-2008 Bjoern Butscher, Hendrik Weimer Copyright 2003-2013 Bjoern Butscher, Hendrik Weimer
This file is part of libquantum This file is part of libquantum
libquantum is free software; you can redistribute it and/or modify libquantum is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3 of the License, by the Free Software Foundation; either version 3 of the License,
or (at your option) any later version. or (at your option) any later version.
libquantum is distributed in the hope that it will be useful, but libquantum is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 48 skipping to change at line 48
/* A ROWS x COLS matrix with complex elements */ /* A ROWS x COLS matrix with complex elements */
struct quantum_matrix_struct { struct quantum_matrix_struct {
int rows; int rows;
int cols; int cols;
COMPLEX_FLOAT *t; COMPLEX_FLOAT *t;
}; };
typedef struct quantum_matrix_struct quantum_matrix; typedef struct quantum_matrix_struct quantum_matrix;
struct quantum_reg_node_struct
{
COMPLEX_FLOAT amplitude; /* alpha_j */
MAX_UNSIGNED state; /* j */
};
typedef struct quantum_reg_node_struct quantum_reg_node;
/* The quantum register */ /* The quantum register */
struct quantum_reg_struct struct quantum_reg_struct
{ {
int width; /* number of qubits in the qureg */ int width; /* number of qubits in the qureg */
int size; /* number of non-zero vectors */ int size; /* number of non-zero vectors */
int hashw; /* width of the hash array */ int hashw; /* width of the hash array */
quantum_reg_node *node; COMPLEX_FLOAT *amplitude;
MAX_UNSIGNED *state;
int *hash; int *hash;
}; };
typedef struct quantum_reg_struct quantum_reg; typedef struct quantum_reg_struct quantum_reg;
struct quantum_density_op_struct struct quantum_density_op_struct
{ {
int num; /* total number of state vectors */ int num; /* total number of state vectors */
float *prob; /* probabilities of the state vectors */ float *prob; /* probabilities of the state vectors */
quantum_reg *reg; /* state vectors */ quantum_reg *reg; /* state vectors */
}; };
typedef struct quantum_density_op_struct quantum_density_op; 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(MAX_UNSIGNED initval, int width);
extern quantum_reg quantum_new_qureg_size(int n, 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_delete_qureg(quantum_reg *reg);
extern void quantum_print_qureg(quantum_reg reg); extern void quantum_print_qureg(quantum_reg reg);
extern void quantum_addscratch(int bits, 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_print_timeop(int width, void f(quantum_reg *));
extern void quantum_cnot(int control, int target, quantum_reg *reg); extern void quantum_cnot(int control, int target, quantum_reg *reg);
extern void quantum_toffoli(int control1, int control2, int target, extern void quantum_toffoli(int control1, int control2, int target,
quantum_reg *reg); quantum_reg *reg);
extern void quantum_unbounded_toffoli(int controlling, 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_x(int target, quantum_reg *reg);
skipping to change at line 106 skipping to change at line 106
extern void quantum_r_y(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_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_scale(int target, float gamma, quantum_reg *reg);
extern void quantum_phase_kick(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_hadamard(int target, quantum_reg *reg);
extern void quantum_walsh(int width, 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(int control, int target, quantum_reg *reg);
extern void quantum_cond_phase_inv(int control, int target, quantum_reg *re g); extern void quantum_cond_phase_inv(int control, int target, quantum_reg *re g);
extern void quantum_cond_phase_kick(int control, int target, float gamma, extern void quantum_cond_phase_kick(int control, int target, float gamma,
quantum_reg *reg); 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 int quantum_gate_counter(int inc);
extern void quantum_qft(int width, quantum_reg *reg); extern void quantum_qft(int width, quantum_reg *reg);
extern void quantum_qft_inv(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, extern void quantum_exp_mod_n(int N, int x, int width_input, int width,
quantum_reg *reg); quantum_reg *reg);
extern MAX_UNSIGNED quantum_measure(quantum_reg reg); extern MAX_UNSIGNED quantum_measure(quantum_reg reg);
extern int quantum_bmeasure(int pos, quantum_reg *reg); extern int quantum_bmeasure(int pos, quantum_reg *reg);
skipping to change at line 128 skipping to change at line 130
extern quantum_matrix quantum_new_matrix(int cols, int rows); extern quantum_matrix quantum_new_matrix(int cols, int rows);
extern void quantum_delete_matrix(quantum_matrix *m); extern void quantum_delete_matrix(quantum_matrix *m);
extern quantum_matrix quantum_mmult(quantum_matrix A, quantum_matrix B); extern quantum_matrix quantum_mmult(quantum_matrix A, quantum_matrix B);
extern int quantum_ipow(int a, int b); extern int quantum_ipow(int a, int b);
extern int quantum_gcd(int u, int v); extern int quantum_gcd(int u, int v);
extern void quantum_cancel(int *a, int *b); extern void quantum_cancel(int *a, int *b);
extern void quantum_frac_approx(int *a, int *b, int width); extern void quantum_frac_approx(int *a, int *b, int width);
extern int quantum_getwidth(int n); extern int quantum_getwidth(int n);
extern float quantum_prob(COMPLEX_FLOAT a); extern double quantum_prob(COMPLEX_FLOAT a);
extern float quantum_get_decoherence(); extern float quantum_get_decoherence();
extern void quantum_set_decoherence(float lambda); extern void quantum_set_decoherence(float lambda);
extern void quantum_decohere(quantum_reg *reg); extern void quantum_decohere(quantum_reg *reg);
extern quantum_reg quantum_matrix2qureg(quantum_matrix *m, int width); extern quantum_reg quantum_matrix2qureg(quantum_matrix *m, int width);
extern quantum_matrix quantum_qureg2matrix(quantum_reg reg); extern quantum_matrix quantum_qureg2matrix(quantum_reg reg);
extern quantum_reg quantum_kronecker(quantum_reg *reg1, quantum_reg *reg2); extern quantum_reg quantum_kronecker(quantum_reg *reg1, quantum_reg *reg2);
extern COMPLEX_FLOAT quantum_dot_product(quantum_reg *reg1, quantum_reg *re g2); extern COMPLEX_FLOAT quantum_dot_product(quantum_reg *reg1, quantum_reg *re g2);
extern quantum_reg quantum_vectoradd(quantum_reg *reg1, quantum_reg *reg2); extern quantum_reg quantum_vectoradd(quantum_reg *reg1, quantum_reg *reg2);
skipping to change at line 174 skipping to change at line 176
extern void *quantum_error_handler(void *f(int)); extern void *quantum_error_handler(void *f(int));
extern const char *quantum_strerr(int errno); extern const char *quantum_strerr(int errno);
extern void quantum_error(int errno); extern void quantum_error(int errno);
extern void quantum_rk4(quantum_reg *reg, double t, double dt, extern void quantum_rk4(quantum_reg *reg, double t, double dt,
quantum_reg H(MAX_UNSIGNED, double), int flags); quantum_reg H(MAX_UNSIGNED, double), int flags);
extern double quantum_rk4a(quantum_reg *reg, double t, double *dt, extern double quantum_rk4a(quantum_reg *reg, double t, double *dt,
double epsilon, double epsilon,
quantum_reg H(MAX_UNSIGNED, double), int flags); quantum_reg H(MAX_UNSIGNED, double), int flags);
extern void quantum_diag_time(float t, quantum_reg *reg0, quantum_reg *regt , extern void quantum_diag_time(double t, quantum_reg *reg0, quantum_reg *reg t,
quantum_reg *tmp1, quantum_reg *tmp2, quantum_reg *tmp1, quantum_reg *tmp2,
quantum_matrix H, float **w); 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 #endif
 End of changes. 9 change blocks. 
12 lines changed or deleted 18 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/