DQCsim
cdqcsim
Go to the documentation of this file.
1 // <cdqcsim> -*- C++ -*-
2 
3 #ifndef _CDQCSIM_INCLUDED_
4 #define _CDQCSIM_INCLUDED_
6 
16 #include <cstdio>
17 #include <cstdarg>
18 #include <cstdint>
19 #include <cstdlib>
20 #include <cstring>
21 #include <new>
22 
24 #ifndef _DQCSIM_HDR_CPP_
25 #define _DQCSIM_HDR_CPP_
26 #endif
27 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 // For Doxygen:
34 namespace dqcsim {
49 namespace raw {
50 } // namespace raw
51 } // namespace dqcsim
52 
53 
54 namespace dqcsim {
55 namespace raw {
56 
58 enum class dqcs_basis_t {
69  DQCS_BASIS_X = 1,
78  DQCS_BASIS_Y = 2,
87  DQCS_BASIS_Z = 3,
88 };
89 
91 enum class dqcs_bool_return_t {
94  DQCS_BOOL_FAILURE = -1,
96  DQCS_FALSE = 0,
98  DQCS_TRUE = 1,
99 };
100 
102 enum class dqcs_gate_type_t {
162 };
163 
165 enum class dqcs_handle_type_t {
173  DQCS_HTYPE_INVALID = 0,
177  DQCS_HTYPE_ARB_DATA = 100,
182  DQCS_HTYPE_ARB_CMD = 101,
192  DQCS_HTYPE_QUBIT_SET = 103,
197  DQCS_HTYPE_GATE = 104,
203  DQCS_HTYPE_MEAS = 105,
208  DQCS_HTYPE_MEAS_SET = 106,
212  DQCS_HTYPE_MATRIX = 107,
216  DQCS_HTYPE_GATE_MAP = 108,
257  DQCS_HTYPE_SIM_CONFIG = 207,
261  DQCS_HTYPE_SIM = 208,
266  DQCS_HTYPE_FRONT_DEF = 300,
271  DQCS_HTYPE_OPER_DEF = 301,
276  DQCS_HTYPE_BACK_DEF = 302,
282 };
283 
285 enum class dqcs_loglevel_t {
288  DQCS_LOG_INVALID = -1,
290  DQCS_LOG_OFF = 0,
295  DQCS_LOG_FATAL = 1,
299  DQCS_LOG_ERROR = 2,
307  DQCS_LOG_WARN = 3,
312  DQCS_LOG_NOTE = 4,
316  DQCS_LOG_INFO = 5,
319  DQCS_LOG_DEBUG = 6,
324  DQCS_LOG_TRACE = 7,
331  DQCS_LOG_PASS = 8,
332 };
333 
335 enum class dqcs_measurement_t {
337  DQCS_MEAS_INVALID = -1,
339  DQCS_MEAS_ZERO = 0,
341  DQCS_MEAS_ONE = 1,
344 };
345 
347 enum class dqcs_path_style_t {
359 };
360 
362 enum class dqcs_plugin_type_t {
365  DQCS_PTYPE_INVALID = -1,
367  DQCS_PTYPE_FRONT = 0,
369  DQCS_PTYPE_OPER = 1,
371  DQCS_PTYPE_BACK = 2,
372 };
373 
377  DQCS_GATE_INVALID = 0,
386  DQCS_GATE_PAULI_I = 100,
395  DQCS_GATE_PAULI_X = 101,
404  DQCS_GATE_PAULI_Y = 102,
413  DQCS_GATE_PAULI_Z = 103,
423  DQCS_GATE_H = 104,
432  DQCS_GATE_S = 105,
441  DQCS_GATE_S_DAG = 106,
450  DQCS_GATE_T = 107,
459  DQCS_GATE_T_DAG = 108,
468  DQCS_GATE_RX_90 = 109,
477  DQCS_GATE_RX_M90 = 110,
490  DQCS_GATE_RX_180 = 111,
499  DQCS_GATE_RY_90 = 112,
508  DQCS_GATE_RY_M90 = 113,
521  DQCS_GATE_RY_180 = 114,
534  DQCS_GATE_RZ_90 = 115,
547  DQCS_GATE_RZ_M90 = 116,
560  DQCS_GATE_RZ_180 = 117,
573  DQCS_GATE_RX = 150,
586  DQCS_GATE_RY = 151,
599  DQCS_GATE_RZ = 152,
612  DQCS_GATE_PHASE_K = 153,
631  DQCS_GATE_PHASE = 154,
638  DQCS_GATE_U1 = 190,
662  DQCS_GATE_R = 191,
673  DQCS_GATE_SWAP = 200,
684  DQCS_GATE_SQRT_SWAP = 201,
691  DQCS_GATE_U2 = 290,
698  DQCS_GATE_U3 = 390,
699 };
700 
702 enum class dqcs_return_t {
705  DQCS_FAILURE = -1,
707  DQCS_SUCCESS = 0,
708 };
709 
728 using dqcs_handle_t = unsigned long long;
729 
742 using dqcs_qubit_t = unsigned long long;
743 
750 using dqcs_plugin_state_t = void*;
751 
756 using dqcs_cycle_t = long long;
757 
758 extern "C" {
759 
762 
774 ssize_t dqcs_arb_cbor_get(dqcs_handle_t arb, void *obj, size_t obj_size);
775 
777 dqcs_return_t dqcs_arb_cbor_set(dqcs_handle_t arb, const void *obj, size_t obj_size);
778 
781 
793 ssize_t dqcs_arb_get_raw(dqcs_handle_t arb, ssize_t index, void *obj, size_t obj_size);
794 
799 ssize_t dqcs_arb_get_size(dqcs_handle_t arb, ssize_t index);
800 
806 char *dqcs_arb_get_str(dqcs_handle_t arb, ssize_t index);
807 
811  ssize_t index,
812  const void *obj,
813  size_t obj_size);
814 
817 dqcs_return_t dqcs_arb_insert_str(dqcs_handle_t arb, ssize_t index, const char *s);
818 
826 
829 
832 
840 
844 
861 ssize_t dqcs_arb_pop_raw(dqcs_handle_t arb, void *obj, size_t obj_size);
862 
871 
873 dqcs_return_t dqcs_arb_push_raw(dqcs_handle_t arb, const void *obj, size_t obj_size);
874 
877 
880 
883 dqcs_return_t dqcs_arb_set_raw(dqcs_handle_t arb, ssize_t index, const void *obj, size_t obj_size);
884 
887 dqcs_return_t dqcs_arb_set_str(dqcs_handle_t arb, ssize_t index, const char *s);
888 
893 
900 
908 dqcs_handle_t dqcs_cmd_new(const char *iface, const char *oper);
909 
914 
921 
926 
938 
953 
960 
966 const char *dqcs_error_get();
967 
975 void dqcs_error_set(const char *msg);
976 
980 
995 
998 
1001 
1004 
1007 
1010 
1017 
1021 
1032 
1064  dqcs_handle_t targets,
1065  dqcs_handle_t controls,
1066  dqcs_handle_t measures,
1067  dqcs_handle_t matrix);
1068 
1084 
1104  dqcs_handle_t qubits,
1105  dqcs_handle_t param_data);
1106 
1113  dqcs_qubit_t qa,
1114  dqcs_handle_t param_data);
1115 
1122  dqcs_qubit_t qa,
1123  dqcs_qubit_t qb,
1124  dqcs_qubit_t qc,
1125  dqcs_handle_t param_data);
1126 
1133  dqcs_qubit_t qa,
1134  dqcs_qubit_t qb,
1135  dqcs_handle_t param_data);
1136 
1151 
1183  dqcs_handle_t controls,
1184  dqcs_handle_t matrix);
1185 
1206 dqcs_handle_t dqcs_gate_reduce_control(dqcs_handle_t gate, double epsilon, bool ignore_gphase);
1207 
1211 
1216 
1262  void (*key_free)(void *key_data),
1263  void *key_data,
1264  dqcs_bool_return_t (*detector)(const void *user_data, dqcs_handle_t gate, dqcs_handle_t *qubits, dqcs_handle_t *param_data),
1265  void (*detector_user_free)(void *user_data),
1266  void *detector_user_data,
1267  dqcs_handle_t (*constructor)(const void *user_data, dqcs_handle_t qubits, dqcs_handle_t param_data),
1268  void (*constructor_user_free)(void *user_data),
1269  void *constructor_user_data);
1270 
1324  void (*key_free)(void *key_data),
1325  void *key_data,
1326  dqcs_bool_return_t (*detector)(const void *user_data, dqcs_handle_t matrix, size_t num_controls, dqcs_handle_t *param_data),
1327  void (*detector_user_free)(void *user_data),
1328  void *detector_user_data,
1329  dqcs_handle_t (*constructor)(const void *user_data, dqcs_handle_t *param_data, intptr_t *num_controls),
1330  void (*constructor_user_free)(void *user_data),
1331  void *constructor_user_data);
1332 
1355  void (*key_free)(void *key_data),
1356  void *key_data,
1357  dqcs_handle_t matrix,
1358  intptr_t num_controls,
1359  double epsilon,
1360  bool ignore_gphase);
1361 
1381  void (*key_free)(void *user_data),
1382  void *key_data,
1383  intptr_t num_measures,
1384  dqcs_handle_t basis,
1385  double epsilon);
1386 
1413  void (*key_free)(void *user_data),
1414  void *key_data,
1416  intptr_t num_controls,
1417  double epsilon,
1418  bool ignore_gphase);
1419 
1439  void (*key_free)(void *user_data),
1440  void *key_data,
1441  intptr_t num_targets,
1442  dqcs_handle_t basis,
1443  double epsilon);
1444 
1466  const void *key_data,
1467  dqcs_handle_t qubits,
1468  dqcs_handle_t param_data);
1469 
1477  const void *key_data,
1478  dqcs_qubit_t qa,
1479  dqcs_handle_t param_data);
1480 
1488  const void *key_data,
1489  dqcs_qubit_t qa,
1490  dqcs_qubit_t qb,
1491  dqcs_qubit_t qc,
1492  dqcs_handle_t param_data);
1493 
1501  const void *key_data,
1502  dqcs_qubit_t qa,
1503  dqcs_qubit_t qb,
1504  dqcs_handle_t param_data);
1505 
1530  dqcs_handle_t gate,
1531  const void **key_data,
1532  dqcs_handle_t *qubits,
1533  dqcs_handle_t *param_data);
1534 
1596 dqcs_handle_t dqcs_gm_new(bool strip_qubit_refs,
1597  bool strip_data,
1598  bool (*key_cmp)(const void*, const void*),
1599  uint64_t (*key_hash)(const void*));
1600 
1605 
1612 
1619 
1626 
1629 
1671  const char *module,
1672  const char *file,
1673  uint32_t line_nr,
1674  const char *message);
1675 
1682 dqcs_handle_t dqcs_mat_add_controls(dqcs_handle_t mat, size_t number_of_controls);
1683 
1702  dqcs_handle_t b,
1703  double epsilon,
1704  bool ignore_gphase);
1705 
1717 
1725 
1746 
1752 
1762 
1784  dqcs_predefined_gate_t gate_type,
1785  dqcs_handle_t *param_data,
1786  double epsilon,
1787  bool ignore_gphase);
1788 
1793 
1810 dqcs_handle_t dqcs_mat_new(size_t num_qubits, const double *matrix);
1811 
1816 
1830 
1856  double epsilon,
1857  bool ignore_global_phase,
1858  ssize_t **control_indices);
1859 
1869 
1872 
1875 
1878 
1881 
1885 
1889 
1894 
1899 
1903 
1910 
1914 
1920 
1926 
1935 
1942 dqcs_return_t dqcs_pcfg_env_set(dqcs_handle_t pcfg, const char *key, const char *value);
1943 
1949 
1957 
1964 
1971 
1980 dqcs_handle_t dqcs_pcfg_new(dqcs_plugin_type_t typ, const char *name, const char *spec);
1981 
1993  const char *name,
1994  const char *executable,
1995  const char *script);
1996 
2005 
2012 
2021 
2025 
2029 
2033 
2037 
2041 dqcs_return_t dqcs_pcfg_tee(dqcs_handle_t pcfg, dqcs_loglevel_t verbosity, const char *filename);
2042 
2045 
2048 
2051 
2059 
2062 
2069 
2076 
2091  const char *name,
2092  const char *author,
2093  const char *version);
2094 
2108  dqcs_return_t (*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_cycle_t cycles),
2109  void (*user_free)(void *user_data),
2110  void *user_data);
2111 
2128  dqcs_return_t (*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t qubits, dqcs_handle_t alloc_cmds),
2129  void (*user_free)(void *user_data),
2130  void *user_data);
2131 
2144  dqcs_return_t (*callback)(void *user_data, dqcs_plugin_state_t state),
2145  void (*user_free)(void *user_data),
2146  void *user_data);
2147 
2162  dqcs_return_t (*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t qubits),
2163  void (*user_free)(void *user_data),
2164  void *user_data);
2165 
2210  dqcs_handle_t (*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t gate),
2211  void (*user_free)(void *user_data),
2212  void *user_data);
2213 
2227  dqcs_handle_t (*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t cmd),
2228  void (*user_free)(void *user_data),
2229  void *user_data);
2230 
2248  dqcs_return_t (*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t init_cmds),
2249  void (*user_free)(void *user_data),
2250  void *user_data);
2251 
2293  dqcs_handle_t (*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t meas),
2294  void (*user_free)(void *user_data),
2295  void *user_data);
2296 
2319  dqcs_handle_t (*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t args),
2320  void (*user_free)(void *user_data),
2321  void *user_data);
2322 
2340  dqcs_handle_t (*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t cmd),
2341  void (*user_free)(void *user_data),
2342  void *user_data);
2343 
2346 
2353 
2362 
2379  uintptr_t num_qubits,
2380  dqcs_handle_t cq);
2381 
2390 
2399 
2408 
2416 
2425  dqcs_qubit_t qubit);
2426 
2435 
2444 
2452 
2458 
2467 
2481 dqcs_return_t dqcs_plugin_run(dqcs_handle_t pdef, const char *simulator);
2482 
2490 
2506 dqcs_handle_t dqcs_plugin_start(dqcs_handle_t pdef, const char *simulator);
2507 
2514 
2517 
2521 
2526 
2534 
2540 
2545 
2548 
2551 
2596  dqcs_loglevel_t verbosity,
2597  void (*callback)(void *user_data, const char *message, const char *logger, dqcs_loglevel_t level, const char *module, const char *file, uint32_t line, uint64_t time_s, uint32_t time_ns, uint32_t pid, uint64_t tid),
2598  void (*user_free)(void *user_data),
2599  void *user_data);
2600 
2611 
2629 
2635 
2638 
2641 
2647 
2652 
2658 
2664 
2668 dqcs_return_t dqcs_scfg_tee(dqcs_handle_t scfg, dqcs_loglevel_t verbosity, const char *filename);
2669 
2681 
2700 
2706 char *dqcs_sim_get_author(dqcs_handle_t sim, const char *name);
2707 
2713 char *dqcs_sim_get_author_idx(dqcs_handle_t sim, ssize_t index);
2714 
2721 char *dqcs_sim_get_name(dqcs_handle_t sim, const char *name);
2722 
2728 char *dqcs_sim_get_name_idx(dqcs_handle_t sim, ssize_t index);
2729 
2735 char *dqcs_sim_get_version(dqcs_handle_t sim, const char *name);
2736 
2742 char *dqcs_sim_get_version_idx(dqcs_handle_t sim, ssize_t index);
2743 
2749 
2757 
2767 
2777 
2786 
2789 
2800 
2807 
2814 
2819 
2827  const char *name,
2828  void (*callback)(void *user_data, const char *simulator),
2829  void (*user_free)(void *user_data),
2830  void *user_data);
2831 
2835 dqcs_return_t dqcs_tcfg_tee(dqcs_handle_t tcfg, dqcs_loglevel_t verbosity, const char *filename);
2836 
2839 
2842 
2845 
2846 } // extern "C"
2847 
2848 } // namespace raw
2849 } // namespace dqcsim
2850 
2851 //*****************************************************************************
2852 // Functions that cannot be implemented in Rust
2853 //*****************************************************************************
2854 
2855 // Place log function in namespace if this is the C++ header.
2856 #ifdef _DQCSIM_HDR_CPP_
2857 namespace dqcsim {
2858 namespace raw {
2859 #endif
2860 
2861 // Use namespaced C stdlib functions if this is the C++ header.
2863 #ifdef _DQCSIM_HDR_CPP_
2864 #define _DQCSIM_STD_PREFIX_ ::std::
2865 #else
2866 #define _DQCSIM_STD_PREFIX_
2867 #endif
2868 
2877 static void dqcs_log_format(
2878  dqcs_loglevel_t level,
2879  const char *module,
2880  const char *file,
2881  uint32_t line,
2882  const char *fmt,
2883  ...
2884 )
2885 #if defined(__GNUC__)
2886 __attribute__((format(printf,5,6)))
2887 #endif
2888 ;
2889 static void dqcs_log_format(
2890  dqcs_loglevel_t level,
2891  const char *module,
2892  const char *file,
2893  uint32_t line,
2894  const char *fmt,
2895  ...
2896 )
2897 {
2898  // Figure out the buffer size we need.
2899  _DQCSIM_STD_PREFIX_ va_list ap;
2900  va_start(ap, fmt);
2901  int size = _DQCSIM_STD_PREFIX_ vsnprintf(NULL, 0, fmt, ap) + 1;
2902  va_end(ap);
2903 
2904  // Allocate the buffer.
2905  char *buffer = (char*)_DQCSIM_STD_PREFIX_ malloc(size);
2906  if (buffer == NULL) {
2907  _DQCSIM_STD_PREFIX_ fprintf(stderr, "Error: failed to allocate buffer for log message!\n");
2908  return;
2909  }
2910 
2911  // Perform the actual formatting operation.
2912  _DQCSIM_STD_PREFIX_ va_list ap2;
2913  va_start(ap2, fmt);
2914  _DQCSIM_STD_PREFIX_ vsnprintf(buffer, size, fmt, ap2);
2915  va_end(ap2);
2916 
2917  // Send to DQCsim.
2918  if (((int)dqcs_log_raw(level, module, file, line, buffer)) < 0) {
2919  _DQCSIM_STD_PREFIX_ fprintf(stderr, "Error while trying to log: %s\n", dqcs_error_get());
2920  _DQCSIM_STD_PREFIX_ fprintf(stderr, "The message was: %s\n", buffer);
2921  _DQCSIM_STD_PREFIX_ fprintf(stderr, "In %s, %s:%u\n", module, file, line);
2922  }
2923 
2924  // Don't leak!
2925  _DQCSIM_STD_PREFIX_ free(buffer);
2926 }
2927 
2928 #undef _DQCSIM_STD_PREFIX_
2929 
2930 #ifdef _DQCSIM_HDR_CPP_
2931 } // namespace raw
2932 } // namespace dqcsim
2933 #endif
2934 
2935 //*****************************************************************************
2936 // Macros
2937 //*****************************************************************************
2938 
2940 #ifndef _DQCSIM_LANGUAGE_
2941 #ifdef _DQCSIM_HDR_CPP_
2942 #define _DQCSIM_LANGUAGE_ "CPP"
2943 #else
2944 #define _DQCSIM_LANGUAGE_ "C"
2945 #endif
2946 #endif
2947 
2950 #ifndef _DQCSIM_LOGLEVEL_PREFIX_
2951 #ifdef _DQCSIM_HDR_CPP_
2952 #define _DQCSIM_LOGLEVEL_PREFIX_ ::dqcsim::raw::dqcs_loglevel_t::
2953 #else
2954 #define _DQCSIM_LOGLEVEL_PREFIX_
2955 #endif
2956 #endif
2957 
2959 #ifndef dqcs_log_trace
2960 
2964 #define dqcs_log_trace(fmt, ...) \
2965  dqcs_log_format( \
2966  _DQCSIM_LOGLEVEL_PREFIX_ DQCS_LOG_TRACE, \
2967  _DQCSIM_LANGUAGE_, \
2968  __FILE__, \
2969  __LINE__, \
2970  fmt, \
2971  ##__VA_ARGS__ \
2972  )
2973 #endif
2974 
2975 #ifndef dqcs_log_debug
2976 
2980 #define dqcs_log_debug(fmt, ...) \
2981  dqcs_log_format( \
2982  _DQCSIM_LOGLEVEL_PREFIX_ DQCS_LOG_DEBUG, \
2983  _DQCSIM_LANGUAGE_, \
2984  __FILE__, \
2985  __LINE__, \
2986  fmt, \
2987  ##__VA_ARGS__ \
2988  )
2989 #endif
2990 
2991 #ifndef dqcs_log_info
2992 
2996 #define dqcs_log_info(fmt, ...) \
2997  dqcs_log_format( \
2998  _DQCSIM_LOGLEVEL_PREFIX_ DQCS_LOG_INFO, \
2999  _DQCSIM_LANGUAGE_, \
3000  __FILE__, \
3001  __LINE__, \
3002  fmt, \
3003  ##__VA_ARGS__ \
3004  )
3005 #endif
3006 
3007 #ifndef dqcs_log_note
3008 
3012 #define dqcs_log_note(fmt, ...) \
3013  dqcs_log_format( \
3014  _DQCSIM_LOGLEVEL_PREFIX_ DQCS_LOG_NOTE, \
3015  _DQCSIM_LANGUAGE_, \
3016  __FILE__, \
3017  __LINE__, \
3018  fmt, \
3019  ##__VA_ARGS__ \
3020  )
3021 #endif
3022 
3023 #ifndef dqcs_log_warn
3024 
3028 #define dqcs_log_warn(fmt, ...) \
3029  dqcs_log_format( \
3030  _DQCSIM_LOGLEVEL_PREFIX_ DQCS_LOG_WARN, \
3031  _DQCSIM_LANGUAGE_, \
3032  __FILE__, \
3033  __LINE__, \
3034  fmt, \
3035  ##__VA_ARGS__ \
3036  )
3037 #endif
3038 
3039 #ifndef dqcs_log_error
3040 
3044 #define dqcs_log_error(fmt, ...) \
3045  dqcs_log_format( \
3046  _DQCSIM_LOGLEVEL_PREFIX_ DQCS_LOG_ERROR, \
3047  _DQCSIM_LANGUAGE_, \
3048  __FILE__, \
3049  __LINE__, \
3050  fmt, \
3051  ##__VA_ARGS__ \
3052  )
3053 #endif
3054 
3055 #ifndef dqcs_log_fatal
3056 
3060 #define dqcs_log_fatal(fmt, ...) \
3061  dqcs_log_format( \
3062  _DQCSIM_LOGLEVEL_PREFIX_ DQCS_LOG_FATAL, \
3063  _DQCSIM_LANGUAGE_, \
3064  __FILE__, \
3065  __LINE__, \
3066  fmt, \
3067  ##__VA_ARGS__ \
3068  )
3069 #endif
3070 
3071 #ifdef __cplusplus
3072 } // extern "C"
3073 #endif
3074 
3075 #ifdef _DQCSIM_HDR_CPP_
3076 #undef _DQCSIM_HDR_CPP_
3077 #endif
3078 
3079 #endif
dqcsim::raw::dqcs_mset_contains
dqcs_bool_return_t dqcs_mset_contains(dqcs_handle_t mset, dqcs_qubit_t qubit)
Returns whether the given qubit measurement set contains data for the given qubit.
dqcsim::raw::dqcs_cq_len
ssize_t dqcs_cq_len(dqcs_handle_t cq)
Returns the number of ArbCmd objects in the given ArbCmd queue.
dqcsim::raw::dqcs_meas_value_set
dqcs_return_t dqcs_meas_value_set(dqcs_handle_t meas, dqcs_measurement_t value)
Sets the measurement value associated with a measurement object.
dqcsim::raw::dqcs_sim_new
dqcs_handle_t dqcs_sim_new(dqcs_handle_t scfg)
Constructs a DQCsim simulation.
DQCS_GATE_TYPE_INVALID
@ DQCS_GATE_TYPE_INVALID
Invalid gate type.
Definition: dqcsim.h:100
DQCS_GATE_U2
@ DQCS_GATE_U2
Any two-qubit unitary gate, parameterized as a full unitary matrix.
Definition: dqcsim.h:853
dqcsim::raw::dqcs_sim_recv
dqcs_handle_t dqcs_sim_recv(dqcs_handle_t sim)
Waits for the simulated accelerator to send a message to us.
dqcsim::raw::dqcs_gate_new_custom
dqcs_handle_t dqcs_gate_new_custom(const char *name, dqcs_handle_t targets, dqcs_handle_t controls, dqcs_handle_t measures, dqcs_handle_t matrix)
Constructs a new custom gate.
dqcsim::raw::dqcs_handle_t
unsigned long long dqcs_handle_t
Type for a handle.
Definition: cdqcsim:728
dqcsim::raw::dqcs_tcfg_name
char * dqcs_tcfg_name(dqcs_handle_t tcfg)
Returns the configured name for the given plugin thread.
DQCS_HTYPE_MEAS_SET
@ DQCS_HTYPE_MEAS_SET
Indicates that the given handle belongs to a set of qubit measurement results.
Definition: dqcsim.h:230
dqcsim::raw::dqcs_pdef_set_upstream_arb_cb
dqcs_return_t dqcs_pdef_set_upstream_arb_cb(dqcs_handle_t pdef, dqcs_handle_t(*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t cmd), void(*user_free)(void *user_data), void *user_data)
Sets the callback function for handling an arb from upstream for operators and backends.
dqcsim::raw::dqcs_mat_predef
dqcs_handle_t dqcs_mat_predef(dqcs_predefined_gate_t gate_type, dqcs_handle_t param_data)
Constructs a new gate matrix for one of DQCsim's predefined gates.
dqcsim::raw::dqcs_arb_cbor_get
ssize_t dqcs_arb_cbor_get(dqcs_handle_t arb, void *obj, size_t obj_size)
Returns the JSON/CBOR object of an ArbData object in the form of a CBOR object.
DQCS_GATE_RY_180
@ DQCS_GATE_RY_180
Ry(180°) gate.
Definition: dqcsim.h:657
dqcsim::raw::dqcs_cmd_iface_cmp
dqcs_bool_return_t dqcs_cmd_iface_cmp(dqcs_handle_t cmd, const char *iface)
Compares the interface ID of an ArbCmd with the given string.
dqcsim::raw::dqcs_handle_leak_check
dqcs_return_t dqcs_handle_leak_check()
Succeeds only if there are no live handles in the current thread.
dqcsim::raw::dqcs_gate_targets
dqcs_handle_t dqcs_gate_targets(dqcs_handle_t gate)
Returns a handle to a new qubit reference set containing the qubits targeted by this gate.
dqcsim::raw::dqcs_mat_basis
dqcs_handle_t dqcs_mat_basis(dqcs_basis_t basis)
Constructs a matrix with the eigenvectors of one of the Pauli matrices as column vectors.
DQCS_HTYPE_GATE_MAP
@ DQCS_HTYPE_GATE_MAP
Indicates that the given handle belongs to a gate map.
Definition: dqcsim.h:242
DQCS_GATE_RX_M90
@ DQCS_GATE_RX_M90
Rx(-90°) gate.
Definition: dqcsim.h:605
dqcsim::raw::dqcs_arb_assign
dqcs_return_t dqcs_arb_assign(dqcs_handle_t dest, dqcs_handle_t src)
Copies the data from one object to another.
DQCS_HTYPE_INVALID
@ DQCS_HTYPE_INVALID
Indicates that the given handle is invalid.
Definition: dqcsim.h:181
DQCS_HTYPE_GATE
@ DQCS_HTYPE_GATE
Indicates that the given handle belongs to a quantum gate description.
Definition: dqcsim.h:215
dqcsim::raw::dqcs_mat_basis_approx_eq
dqcs_bool_return_t dqcs_mat_basis_approx_eq(dqcs_handle_t a, dqcs_handle_t b, double epsilon)
Approximately compares two basis matrices.
DQCS_GATE_RX_90
@ DQCS_GATE_RX_90
Rx(90°) gate.
Definition: dqcsim.h:594
dqcsim::raw::dqcs_pdef_set_drop_cb
dqcs_return_t dqcs_pdef_set_drop_cb(dqcs_handle_t pdef, dqcs_return_t(*callback)(void *user_data, dqcs_plugin_state_t state), void(*user_free)(void *user_data), void *user_data)
Sets the user logic drop/cleanup callback.
DQCS_GATE_S
@ DQCS_GATE_S
The S matrix, also known as a 90 degree Z rotation.
Definition: dqcsim.h:550
dqcsim::raw::dqcs_gate_new_prep
dqcs_handle_t dqcs_gate_new_prep(dqcs_handle_t targets, dqcs_handle_t matrix)
Constructs a new prep gate.
dqcsim::raw::dqcs_plugin_recv
dqcs_handle_t dqcs_plugin_recv(dqcs_plugin_state_t plugin)
Waits for a message from the host.
DQCS_GATE_RX_180
@ DQCS_GATE_RX_180
Rx(180°) gate.
Definition: dqcsim.h:620
DQCS_HTYPE_ARB_CMD_QUEUE
@ DQCS_HTYPE_ARB_CMD_QUEUE
Indicates that the given handle belongs to a queue of ArbCmd object.
Definition: dqcsim.h:201
dqcsim::raw::dqcs_pdef_name
char * dqcs_pdef_name(dqcs_handle_t pdef)
Returns the plugin name for the given plugin definition object.
dqcsim::raw::dqcs_sim_send
dqcs_return_t dqcs_sim_send(dqcs_handle_t sim, dqcs_handle_t data)
Sends a message to the simulated accelerator.
dqcsim::raw::dqcs_sim_start
dqcs_return_t dqcs_sim_start(dqcs_handle_t sim, dqcs_handle_t data)
Starts a program on the simulated accelerator.
DQCS_BOOL_FAILURE
@ DQCS_BOOL_FAILURE
The function has failed.
Definition: dqcsim.h:82
dqcsim::raw::dqcs_qbset_len
ssize_t dqcs_qbset_len(dqcs_handle_t qbset)
Returns the number of qubits in the given set.
dqcsim::raw::dqcs_pdef_set_host_arb_cb
dqcs_return_t dqcs_pdef_set_host_arb_cb(dqcs_handle_t pdef, dqcs_handle_t(*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t cmd), void(*user_free)(void *user_data), void *user_data)
Sets the callback function function for handling an arb from the host.
DQCS_GATE_S_DAG
@ DQCS_GATE_S_DAG
The S-dagger matrix, also known as a negative 90 degree Z rotation.
Definition: dqcsim.h:561
dqcsim::raw::dqcs_handle_type_t
dqcs_handle_type_t
Enumeration of types that can be associated with a handle.
Definition: cdqcsim:165
DQCS_BASIS_X
@ DQCS_BASIS_X
The X basis.
Definition: dqcsim.h:49
dqcsim::raw::dqcs_arb_remove
dqcs_return_t dqcs_arb_remove(dqcs_handle_t arb, ssize_t index)
Removes the specified unstructured string argument from the list.
DQCS_GATE_RX
@ DQCS_GATE_RX
The matrix for an arbitrary X rotation.
Definition: dqcsim.h:717
dqcsim::raw::dqcs_loglevel_t
dqcs_loglevel_t
Enumeration of loglevels and logging modes.
Definition: cdqcsim:285
dqcsim::raw::dqcs_predefined_gate_t::DQCS_GATE_INVALID
@ DQCS_GATE_INVALID
Invalid gate. Used as an error return value.
dqcsim::raw::dqcs_pcfg_new
dqcs_handle_t dqcs_pcfg_new(dqcs_plugin_type_t typ, const char *name, const char *spec)
Creates a new plugin process configuration object using sugared syntax.
dqcsim::raw::dqcs_sim_get_author_idx
char * dqcs_sim_get_author_idx(dqcs_handle_t sim, ssize_t index)
Queries the author of a plugin, referenced by index.
dqcsim::raw::dqcs_plugin_gate
dqcs_return_t dqcs_plugin_gate(dqcs_plugin_state_t plugin, dqcs_handle_t gate)
Tells the downstream plugin to execute a gate.
dqcsim::raw::dqcs_pcfg_stdout_mode_get
dqcs_loglevel_t dqcs_pcfg_stdout_mode_get(dqcs_handle_t pcfg)
Returns the configured stdout capture mode for the specified plugin process.
dqcsim::raw::dqcs_pcfg_work_set
dqcs_return_t dqcs_pcfg_work_set(dqcs_handle_t pcfg, const char *work)
Overrides the working directory for the plugin process.
dqcsim::raw::dqcs_pdef_set_free_cb
dqcs_return_t dqcs_pdef_set_free_cb(dqcs_handle_t pdef, dqcs_return_t(*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t qubits), void(*user_free)(void *user_data), void *user_data)
Sets the qubit deallocation callback for operators and backends.
dqcsim::raw::dqcs_cq_new
dqcs_handle_t dqcs_cq_new()
Creates a new ArbCmd queue object.
DQCS_LOG_ERROR
@ DQCS_LOG_ERROR
This loglevel is to be used for reporting or propagating a non-fatal error caused by the API caller d...
Definition: dqcsim.h:359
dqcsim::raw::dqcs_mat_strip_control
dqcs_handle_t dqcs_mat_strip_control(dqcs_handle_t mat, double epsilon, bool ignore_global_phase, ssize_t **control_indices)
Splits a controlled matrix into its non-controlled submatrix and the indices of the control qubits.
dqcsim::raw::dqcs_mat_len
ssize_t dqcs_mat_len(dqcs_handle_t mat)
Returns the number of complex entries in the given matrix.
dqcsim::raw::dqcs_pcfg_stderr_mode_get
dqcs_loglevel_t dqcs_pcfg_stderr_mode_get(dqcs_handle_t pcfg)
Returns the configured stderr capture mode for the specified plugin process.
dqcsim::raw::dqcs_mset_set
dqcs_return_t dqcs_mset_set(dqcs_handle_t mset, dqcs_handle_t meas)
Adds a measurement result to a measurement result set.
dqcsim::raw::dqcs_arb_len
ssize_t dqcs_arb_len(dqcs_handle_t arb)
Returns the number of unstructured arguments, or -1 to indicate failure.
dqcsim::raw::dqcs_sim_get_version
char * dqcs_sim_get_version(dqcs_handle_t sim, const char *name)
Queries the version of a plugin, referenced by instance name.
DQCS_HTYPE_FRONT_PROCESS_CONFIG
@ DQCS_HTYPE_FRONT_PROCESS_CONFIG
Indicates that the given handle belongs to a frontend plugin process configuration object.
Definition: dqcsim.h:250
dqcsim::raw::dqcs_plugin_run
dqcs_return_t dqcs_plugin_run(dqcs_handle_t pdef, const char *simulator)
Executes a plugin in the current thread.
dqcsim::raw::dqcs_gate_matrix
dqcs_handle_t dqcs_gate_matrix(dqcs_handle_t gate)
Returns a copy of the unitary matrix associated with this gate, if one exists.
dqcsim::raw::dqcs_tcfg_type
dqcs_plugin_type_t dqcs_tcfg_type(dqcs_handle_t tcfg)
Returns the type of the given plugin thread configuration.
dqcsim::raw::dqcs_mset_take_any
dqcs_handle_t dqcs_mset_take_any(dqcs_handle_t mset)
Returns the measurement result for any of the qubits contained in a measurement result set and remove...
dqcsim::raw::dqcs_gate_new_predef_two
dqcs_handle_t dqcs_gate_new_predef_two(dqcs_predefined_gate_t gate_type, dqcs_qubit_t qa, dqcs_qubit_t qb, dqcs_handle_t param_data)
Constructs a new predefined unitary two-qubit gate.
dqcsim::raw::dqcs_arb_get_raw
ssize_t dqcs_arb_get_raw(dqcs_handle_t arb, ssize_t index, void *obj, size_t obj_size)
Returns the unstructured string argument at the specified index.
dqcsim::raw::dqcs_cq_next
dqcs_return_t dqcs_cq_next(dqcs_handle_t cq)
Advances an ArbCmd queue to the next command.
dqcsim::raw::dqcs_return_t
dqcs_return_t
Default return type for functions that don't need to return anything.
Definition: cdqcsim:702
dqcsim::raw::dqcs_mat_approx_unitary
dqcs_bool_return_t dqcs_mat_approx_unitary(dqcs_handle_t matrix, double epsilon)
Returns whether the matrix is approximately unitary.
dqcsim::raw::dqcs_sim_get_author
char * dqcs_sim_get_author(dqcs_handle_t sim, const char *name)
Queries the author of a plugin, referenced by instance name.
dqcsim::raw::dqcs_meas_qubit_set
dqcs_return_t dqcs_meas_qubit_set(dqcs_handle_t meas, dqcs_qubit_t qubit)
Sets the qubit reference associated with a measurement object.
DQCS_LOG_OFF
@ DQCS_LOG_OFF
Turns logging off.
Definition: dqcsim.h:346
dqcsim::raw::dqcs_gate_type_t::DQCS_GATE_TYPE_INVALID
@ DQCS_GATE_TYPE_INVALID
Invalid gate type. Used as an error return value.
dqcsim::raw::dqcs_pdef_set_gate_cb
dqcs_return_t dqcs_pdef_set_gate_cb(dqcs_handle_t pdef, dqcs_handle_t(*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t gate), void(*user_free)(void *user_data), void *user_data)
Sets the gate execution callback for operators and backends.
dqcsim::raw::dqcs_arb_new
dqcs_handle_t dqcs_arb_new()
Creates a new ArbData object.
DQCS_HTYPE_OPER_PROCESS_CONFIG
@ DQCS_HTYPE_OPER_PROCESS_CONFIG
Indicates that the given handle belongs to an operator plugin process configuration object.
Definition: dqcsim.h:258
dqcsim::raw::dqcs_plugin_get_cycle
dqcs_cycle_t dqcs_plugin_get_cycle(dqcs_plugin_state_t plugin)
Returns the current value of the downstream cycle counter.
dqcsim::raw::dqcs_pcfg_accept_timeout_set
dqcs_return_t dqcs_pcfg_accept_timeout_set(dqcs_handle_t pcfg, double timeout)
Configures the timeout for the plugin process to connect to DQCsim.
dqcsim::raw::dqcs_mat_is_predef
dqcs_bool_return_t dqcs_mat_is_predef(dqcs_handle_t mat, dqcs_predefined_gate_t gate_type, dqcs_handle_t *param_data, double epsilon, bool ignore_gphase)
Returns whether this matrix is of the given predefined form and, if it is, any parameters needed to d...
dqcsim::raw::dqcs_handle_delete_all
dqcs_return_t dqcs_handle_delete_all()
Deletes all handles for the current thread.
dqcsim::raw::dqcs_scfg_stderr_verbosity_set
dqcs_return_t dqcs_scfg_stderr_verbosity_set(dqcs_handle_t scfg, dqcs_loglevel_t level)
Configures the stderr sink verbosity for a simulation.
DQCS_GATE_TYPE_PREP
@ DQCS_GATE_TYPE_PREP
Prep gates have one or more target qubits and a 2x2 unitary matrix representing the basis.
Definition: dqcsim.h:149
dqcsim::raw::dqcs_plugin_send
dqcs_return_t dqcs_plugin_send(dqcs_plugin_state_t plugin, dqcs_handle_t arb)
Sends a message to the host.
dqcsim::raw::dqcs_return_t::DQCS_FAILURE
@ DQCS_FAILURE
The function has failed.
dqcsim::raw::dqcs_gate_type_t
dqcs_gate_type_t
Types of DQCsim gates.
Definition: cdqcsim:102
DQCS_PTYPE_FRONT
@ DQCS_PTYPE_FRONT
Frontend plugin.
Definition: dqcsim.h:465
dqcsim::raw::dqcs_mset_new
dqcs_handle_t dqcs_mset_new()
Creates a new set of qubit measurement results.
dqcsim::raw::dqcs_arb_push_raw
dqcs_return_t dqcs_arb_push_raw(dqcs_handle_t arb, const void *obj, size_t obj_size)
Pushes an unstructured raw argument to the back of the list.
DQCS_GATE_U1
@ DQCS_GATE_U1
Any single-qubit unitary gate, parameterized as a full unitary matrix.
Definition: dqcsim.h:792
dqcsim::raw::dqcs_pdef_set_initialize_cb
dqcs_return_t dqcs_pdef_set_initialize_cb(dqcs_handle_t pdef, dqcs_return_t(*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t init_cmds), void(*user_free)(void *user_data), void *user_data)
Sets the user logic initialization callback.
DQCS_PTYPE_INVALID
@ DQCS_PTYPE_INVALID
Invalid plugin type.
Definition: dqcsim.h:461
dqcsim::raw::dqcs_scfg_stderr_verbosity_get
dqcs_loglevel_t dqcs_scfg_stderr_verbosity_get(dqcs_handle_t scfg)
Returns the configured stderr sink verbosity for a simulation.
DQCS_GATE_TYPE_MEASUREMENT
@ DQCS_GATE_TYPE_MEASUREMENT
Measurement gates have one or more measured qubits and a 2x2 unitary matrix representing the basis.
Definition: dqcsim.h:132
dqcsim::raw::dqcs_tcfg_verbosity_set
dqcs_return_t dqcs_tcfg_verbosity_set(dqcs_handle_t tcfg, dqcs_loglevel_t level)
Configures the logging verbosity for the given plugin thread.
DQCS_MEAS_INVALID
@ DQCS_MEAS_INVALID
Error value used to indicate that something went wrong.
Definition: dqcsim.h:413
dqcsim::raw::dqcs_cmd_oper_cmp
dqcs_bool_return_t dqcs_cmd_oper_cmp(dqcs_handle_t cmd, const char *oper)
Compares the operation ID of an ArbCmd with the given string.
DQCS_HTYPE_FRONT_DEF
@ DQCS_HTYPE_FRONT_DEF
Indicates that the given handle belongs to a frontend plugin definition object.
Definition: dqcsim.h:310
dqcsim::raw::dqcs_path_style_t::DQCS_PATH_STYLE_INVALID
@ DQCS_PATH_STYLE_INVALID
Error value used to indicate that something went wrong.
dqcsim::raw::dqcs_meas_value_get
dqcs_measurement_t dqcs_meas_value_get(dqcs_handle_t meas)
Returns the measurement value associated with a measurement object.
DQCS_HTYPE_MEAS
@ DQCS_HTYPE_MEAS
Indicates that the given handle belongs to a qubit measurement result.
Definition: dqcsim.h:223
dqcsim::raw::dqcs_gate_new_predef_one
dqcs_handle_t dqcs_gate_new_predef_one(dqcs_predefined_gate_t gate_type, dqcs_qubit_t qa, dqcs_handle_t param_data)
Constructs a new predefined unitary one-qubit gate.
dqcsim::raw::dqcs_arb_cbor_set
dqcs_return_t dqcs_arb_cbor_set(dqcs_handle_t arb, const void *obj, size_t obj_size)
Sets the JSON/CBOR object of an ArbData object by means of a CBOR object.
dqcsim::raw::dqcs_scfg_repro_path_style_set
dqcs_return_t dqcs_scfg_repro_path_style_set(dqcs_handle_t scfg, dqcs_path_style_t path_style)
Sets the path style used when writing reproduction files.
dqcsim::raw::dqcs_arb_clear
dqcs_return_t dqcs_arb_clear(dqcs_handle_t arb)
Clears the unstructured argument list.
dqcsim::raw::dqcs_mat_add_controls
dqcs_handle_t dqcs_mat_add_controls(dqcs_handle_t mat, size_t number_of_controls)
Constructs a controlled matrix from the given matrix.
dqcsim::raw::dqcs_error_get
const char * dqcs_error_get()
Returns a pointer to the latest error message.
DQCS_HTYPE_MATRIX
@ DQCS_HTYPE_MATRIX
Indicates that the given handle belongs to a matrix.
Definition: dqcsim.h:236
dqcsim::raw::dqcs_scfg_dqcsim_verbosity_get
dqcs_loglevel_t dqcs_scfg_dqcsim_verbosity_get(dqcs_handle_t scfg)
Returns the configured verbosity for DQCsim's own messages.
dqcsim::raw::dqcs_gm_construct_three
dqcs_handle_t dqcs_gm_construct_three(dqcs_handle_t gm, const void *key_data, dqcs_qubit_t qa, dqcs_qubit_t qb, dqcs_qubit_t qc, dqcs_handle_t param_data)
Uses a gate map object to construct a three-qubit DQCsim gate from the plugin's representation.
DQCS_LOG_TRACE
@ DQCS_LOG_TRACE
This loglevel is to be used for reporting debugging information useful for debugging the internals of...
Definition: dqcsim.h:394
dqcsim::raw::dqcs_gate_new_predef
dqcs_handle_t dqcs_gate_new_predef(dqcs_predefined_gate_t gate_type, dqcs_handle_t qubits, dqcs_handle_t param_data)
Constructs a new predefined unitary gate.
dqcsim::raw::dqcs_gate_controls
dqcs_handle_t dqcs_gate_controls(dqcs_handle_t gate)
Returns a handle to a new qubit reference set containing the qubits that control this gate.
dqcsim::raw::dqcs_pcfg_stdout_mode_set
dqcs_return_t dqcs_pcfg_stdout_mode_set(dqcs_handle_t pcfg, dqcs_loglevel_t level)
Configures the capture mode for the stdout stream of the specified plugin process.
dqcsim::raw::dqcs_pcfg_stderr_mode_set
dqcs_return_t dqcs_pcfg_stderr_mode_set(dqcs_handle_t pcfg, dqcs_loglevel_t level)
Configures the capture mode for the stderr stream of the specified plugin process.
dqcsim::raw::dqcs_basis_t
dqcs_basis_t
Enumeration of Pauli bases.
Definition: cdqcsim:58
DQCS_PTYPE_OPER
@ DQCS_PTYPE_OPER
Operator plugin.
Definition: dqcsim.h:469
dqcsim::raw::dqcs_arb_set_raw
dqcs_return_t dqcs_arb_set_raw(dqcs_handle_t arb, ssize_t index, const void *obj, size_t obj_size)
Replaces the unstructured argument at the specified index with the specified raw object.
dqcsim::raw::dqcs_pdef_set_run_cb
dqcs_return_t dqcs_pdef_set_run_cb(dqcs_handle_t pdef, dqcs_handle_t(*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t args), void(*user_free)(void *user_data), void *user_data)
Sets the run callback for frontends.
dqcsim::raw::dqcs_pcfg_type
dqcs_plugin_type_t dqcs_pcfg_type(dqcs_handle_t pcfg)
Returns the type of the given plugin process configuration.
dqcsim::raw::dqcs_gate_has_controls
dqcs_bool_return_t dqcs_gate_has_controls(dqcs_handle_t gate)
Returns whether the specified gate has control qubits.
dqcsim::raw::dqcs_qbset_new
dqcs_handle_t dqcs_qbset_new()
Creates a new set of qubit references.
dqcsim::raw::dqcs_gm_new
dqcs_handle_t dqcs_gm_new(bool strip_qubit_refs, bool strip_data, bool(*key_cmp)(const void *, const void *), uint64_t(*key_hash)(const void *))
Constructs a new gate map.
dqcsim::raw::dqcs_gate_type
dqcs_gate_type_t dqcs_gate_type(dqcs_handle_t gate)
Returns the gate type of the given gate.
DQCS_PATH_STYLE_KEEP
@ DQCS_PATH_STYLE_KEEP
Specifies that paths should be saved the same way they were specified on the command line.
Definition: dqcsim.h:440
dqcsim::raw::dqcs_pdef_version
char * dqcs_pdef_version(dqcs_handle_t pdef)
Returns the plugin version for the given plugin definition object.
dqcsim::raw::dqcs_qubit_t
unsigned long long dqcs_qubit_t
Type for a qubit reference.
Definition: cdqcsim:742
dqcsim::raw::dqcs_gate_name
char * dqcs_gate_name(dqcs_handle_t gate)
Returns the name of a custom gate.
dqcsim::raw::dqcs_tcfg_init_cmd
dqcs_return_t dqcs_tcfg_init_cmd(dqcs_handle_t tcfg, dqcs_handle_t cmd)
Appends an ArbCmd to the list of initialization commands of a plugin thread.
dqcsim::raw::dqcs_pcfg_env_unset
dqcs_return_t dqcs_pcfg_env_unset(dqcs_handle_t pcfg, const char *key)
Removes/unsets an environment variable for the plugin process.
dqcsim::raw::dqcs_arb_pop
dqcs_return_t dqcs_arb_pop(dqcs_handle_t arb)
Pops an unstructured argument from the back of the list without returning it.
dqcsim::raw::dqcs_qbset_pop
dqcs_qubit_t dqcs_qbset_pop(dqcs_handle_t qbset)
Pops a qubit reference off of a qubit reference set.
dqcsim::raw::dqcs_pdef_set_modify_measurement_cb
dqcs_return_t dqcs_pdef_set_modify_measurement_cb(dqcs_handle_t pdef, dqcs_handle_t(*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t meas), void(*user_free)(void *user_data), void *user_data)
Sets the measurement modification callback for operators.
dqcsim::raw::dqcs_pcfg_accept_timeout_get
double dqcs_pcfg_accept_timeout_get(dqcs_handle_t pcfg)
Returns the configured timeout for the plugin process to connect to DQCsim.
dqcsim::raw::dqcs_pdef_set_advance_cb
dqcs_return_t dqcs_pdef_set_advance_cb(dqcs_handle_t pdef, dqcs_return_t(*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_cycle_t cycles), void(*user_free)(void *user_data), void *user_data)
Sets the callback for advancing time for operators and backends.
dqcsim::raw::dqcs_arb_push_str
dqcs_return_t dqcs_arb_push_str(dqcs_handle_t arb, const char *s)
Pushes an unstructured string argument to the back of the list.
dqcsim::raw::dqcs_pcfg_shutdown_timeout_set
dqcs_return_t dqcs_pcfg_shutdown_timeout_set(dqcs_handle_t pcfg, double timeout)
Configures the timeout for the plugin process to shut down gracefully.
dqcsim::raw::dqcs_gate_measures
dqcs_handle_t dqcs_gate_measures(dqcs_handle_t gate)
Returns a handle to a new qubit reference set containing the qubits measured by this gate.
dqcsim::raw::dqcs_gm_add_custom
dqcs_return_t dqcs_gm_add_custom(dqcs_handle_t gm, void(*key_free)(void *key_data), void *key_data, dqcs_bool_return_t(*detector)(const void *user_data, dqcs_handle_t gate, dqcs_handle_t *qubits, dqcs_handle_t *param_data), void(*detector_user_free)(void *user_data), void *detector_user_data, dqcs_handle_t(*constructor)(const void *user_data, dqcs_handle_t qubits, dqcs_handle_t param_data), void(*constructor_user_free)(void *user_data), void *constructor_user_data)
Adds a fully customizable gate mapping to the given gate map.
dqcsim::raw::dqcs_cycle_t
long long dqcs_cycle_t
Type for a simulation cycle timestamp.
Definition: cdqcsim:756
dqcsim::raw::dqcs_sim_yield
dqcs_return_t dqcs_sim_yield(dqcs_handle_t sim)
Yields to the simulator.
dqcsim::raw::dqcs_sim_arb
dqcs_handle_t dqcs_sim_arb(dqcs_handle_t sim, const char *name, dqcs_handle_t cmd)
Sends an ArbCmd message to one of the plugins, referenced by name.
DQCS_LOG_DEBUG
@ DQCS_LOG_DEBUG
This loglevel is to be used for reporting debugging information useful for debugging the user of the ...
Definition: dqcsim.h:387
dqcsim::raw::dqcs_arb_insert_str
dqcs_return_t dqcs_arb_insert_str(dqcs_handle_t arb, ssize_t index, const char *s)
Inserts an unstructured string argument into the list at the specified index.
DQCS_GATE_RZ_M90
@ DQCS_GATE_RZ_M90
Rz(-90°) gate.
Definition: dqcsim.h:687
dqcsim::raw::dqcs_gm_detect
dqcs_bool_return_t dqcs_gm_detect(dqcs_handle_t gm, dqcs_handle_t gate, const void **key_data, dqcs_handle_t *qubits, dqcs_handle_t *param_data)
Uses a gate map object to convert an incoming DQCsim gate to the plugin's representation.
dqcsim::raw::dqcs_arb_pop_str
char * dqcs_arb_pop_str(dqcs_handle_t arb)
Pops an unstructured string argument from the back of the list.
dqcsim::raw::dqcs_pcfg_env_set
dqcs_return_t dqcs_pcfg_env_set(dqcs_handle_t pcfg, const char *key, const char *value)
Overrides an environment variable for the plugin process.
dqcsim::raw::dqcs_tcfg_new
dqcs_handle_t dqcs_tcfg_new(dqcs_handle_t pdef, const char *name)
Creates a new plugin thread configuration object from a plugin definition.
dqcsim::raw::dqcs_gate_has_measures
dqcs_bool_return_t dqcs_gate_has_measures(dqcs_handle_t gate)
Returns whether the specified gate measures any qubits.
dqcsim::raw::dqcs_plugin_advance
dqcs_cycle_t dqcs_plugin_advance(dqcs_plugin_state_t plugin, dqcs_cycle_t cycles)
Tells the downstream plugin to run for the specified number of cycles.
dqcsim::raw::dqcs_arb_insert_raw
dqcs_return_t dqcs_arb_insert_raw(dqcs_handle_t arb, ssize_t index, const void *obj, size_t obj_size)
Inserts an unstructured raw argument into the list at the specified index.
DQCS_GATE_PAULI_I
@ DQCS_GATE_PAULI_I
The identity gate for a single qubit.
Definition: dqcsim.h:494
dqcsim::raw::dqcs_cmd_iface_get
char * dqcs_cmd_iface_get(dqcs_handle_t cmd)
Returns the interface ID of an ArbCmd.
dqcsim::raw::dqcs_sim_write_reproduction_file
dqcs_return_t dqcs_sim_write_reproduction_file(dqcs_handle_t sim, const char *filename)
Writes a reproduction file for the simulation so far.
dqcsim::raw::dqcs_mat_new
dqcs_handle_t dqcs_mat_new(size_t num_qubits, const double *matrix)
Constructs a new gate matrix.
DQCS_GATE_RY
@ DQCS_GATE_RY
The matrix for an arbitrary Y rotation.
Definition: dqcsim.h:732
dqcsim::raw::dqcs_pcfg_executable
char * dqcs_pcfg_executable(dqcs_handle_t pcfg)
Returns the configured executable path for the given plugin process.
dqcsim::raw::dqcs_gm_add_custom_unitary
dqcs_return_t dqcs_gm_add_custom_unitary(dqcs_handle_t gm, void(*key_free)(void *key_data), void *key_data, dqcs_bool_return_t(*detector)(const void *user_data, dqcs_handle_t matrix, size_t num_controls, dqcs_handle_t *param_data), void(*detector_user_free)(void *user_data), void *detector_user_data, dqcs_handle_t(*constructor)(const void *user_data, dqcs_handle_t *param_data, intptr_t *num_controls), void(*constructor_user_free)(void *user_data), void *constructor_user_data)
Adds a custom unitary gate mapping to the given gate map.
dqcsim::raw::dqcs_pdef_new
dqcs_handle_t dqcs_pdef_new(dqcs_plugin_type_t typ, const char *name, const char *author, const char *version)
Creates a new PluginDefinition object.
dqcsim::raw::dqcs_qbset_push
dqcs_return_t dqcs_qbset_push(dqcs_handle_t qbset, dqcs_qubit_t qubit)
Pushes a qubit reference into a qubit reference set.
dqcsim::raw::dqcs_qbset_copy
dqcs_handle_t dqcs_qbset_copy(dqcs_handle_t qbset)
Returns a copy of the given qubit set, intended for non-destructive iteration.
dqcsim::raw::dqcs_handle_type_t::DQCS_HTYPE_INVALID
@ DQCS_HTYPE_INVALID
Indicates that the given handle is invalid.
dqcsim::raw::dqcs_gate_has_matrix
dqcs_bool_return_t dqcs_gate_has_matrix(dqcs_handle_t gate)
Returns whether a unitary matrix is associated with this gate.
DQCS_HTYPE_FRONT_THREAD_CONFIG
@ DQCS_HTYPE_FRONT_THREAD_CONFIG
Indicates that the given handle belongs to a frontend plugin thread configuration object.
Definition: dqcsim.h:274
dqcsim::raw::dqcs_plugin_arb
dqcs_handle_t dqcs_plugin_arb(dqcs_plugin_state_t plugin, dqcs_handle_t cmd)
Sends an arbitrary command downstream.
DQCS_HTYPE_OPER_THREAD_CONFIG
@ DQCS_HTYPE_OPER_THREAD_CONFIG
Indicates that the given handle belongs to an operator plugin thread configuration object.
Definition: dqcsim.h:282
DQCS_HTYPE_ARB_CMD
@ DQCS_HTYPE_ARB_CMD
Indicates that the given handle belongs to an ArbCmd object.
Definition: dqcsim.h:194
dqcsim::raw::dqcs_gate_expand_control
dqcs_handle_t dqcs_gate_expand_control(dqcs_handle_t gate)
Utility function that expands a gate matrix to account for all control qubits.
DQCS_HTYPE_QUBIT_SET
@ DQCS_HTYPE_QUBIT_SET
Indicates that the given handle belongs to a set of qubit references.
Definition: dqcsim.h:208
DQCS_LOG_FATAL
@ DQCS_LOG_FATAL
This loglevel is to be used for reporting a fatal error, resulting from the owner of the logger getti...
Definition: dqcsim.h:353
dqcsim::raw::dqcs_sim_wait
dqcs_handle_t dqcs_sim_wait(dqcs_handle_t sim)
Waits for the simulated accelerator to finish its current program.
dqcsim::raw::dqcs_mat_dimension
ssize_t dqcs_mat_dimension(dqcs_handle_t mat)
Returns the dimension (number of rows == number of columns) of the given matrix.
dqcsim::raw::dqcs_plugin_get_cycles_between_measures
dqcs_cycle_t dqcs_plugin_get_cycles_between_measures(dqcs_plugin_state_t plugin, dqcs_qubit_t qubit)
Returns the number of downstream cycles between the last two measurements of the given downstream qub...
dqcsim::raw::dqcs_gm_construct_two
dqcs_handle_t dqcs_gm_construct_two(dqcs_handle_t gm, const void *key_data, dqcs_qubit_t qa, dqcs_qubit_t qb, dqcs_handle_t param_data)
Uses a gate map object to construct a two-qubit DQCsim gate from the plugin's representation.
dqcsim::raw::dqcs_scfg_log_callback
dqcs_return_t dqcs_scfg_log_callback(dqcs_handle_t scfg, dqcs_loglevel_t verbosity, void(*callback)(void *user_data, const char *message, const char *logger, dqcs_loglevel_t level, const char *module, const char *file, uint32_t line, uint64_t time_s, uint32_t time_ns, uint32_t pid, uint64_t tid), void(*user_free)(void *user_data), void *user_data)
Configures DQCsim to also output its log messages to callback function.
dqcsim::raw::dqcs_bool_return_t
dqcs_bool_return_t
Return type for functions that normally return a boolean but can also fail.
Definition: cdqcsim:91
dqcsim::raw::dqcs_predefined_gate_t
dqcs_predefined_gate_t
Enumeration of gates defined by DQCsim.
Definition: cdqcsim:375
DQCS_GATE_PAULI_Z
@ DQCS_GATE_PAULI_Z
The Pauli Z matrix.
Definition: dqcsim.h:527
dqcsim::raw::dqcs_meas_qubit_get
dqcs_qubit_t dqcs_meas_qubit_get(dqcs_handle_t meas)
Returns the qubit reference associated with a measurement object.
DQCS_HTYPE_OPER_DEF
@ DQCS_HTYPE_OPER_DEF
Indicates that the given handle belongs to an operator plugin definition object.
Definition: dqcsim.h:317
dqcsim::raw::dqcs_measurement_t
dqcs_measurement_t
Qubit measurement value.
Definition: cdqcsim:335
DQCS_FALSE
@ DQCS_FALSE
The function did what it was supposed to and returned false.
Definition: dqcsim.h:86
dqcsim::raw::dqcs_loglevel_t::DQCS_LOG_INVALID
@ DQCS_LOG_INVALID
Invalid loglevel.
dqcsim::raw::dqcs_log_raw
dqcs_return_t dqcs_log_raw(dqcs_loglevel_t level, const char *module, const char *file, uint32_t line_nr, const char *message)
Primitive API for sending a log message using the current logger.
DQCS_GATE_T
@ DQCS_GATE_T
The T matrix, also known as a 45 degree Z rotation.
Definition: dqcsim.h:572
DQCS_LOG_NOTE
@ DQCS_LOG_NOTE
This loglevel is to be used for reporting information specifically requested by the user/API caller,...
Definition: dqcsim.h:376
dqcsim::raw::dqcs_plugin_allocate
dqcs_handle_t dqcs_plugin_allocate(dqcs_plugin_state_t plugin, uintptr_t num_qubits, dqcs_handle_t cq)
Allocate the given number of downstream qubits.
dqcsim::raw::dqcs_arb_set_str
dqcs_return_t dqcs_arb_set_str(dqcs_handle_t arb, ssize_t index, const char *s)
Replaces the unstructured argument at the specified index with the specified string.
dqcsim::raw::dqcs_pcfg_script
char * dqcs_pcfg_script(dqcs_handle_t pcfg)
Returns the configured script path for the given plugin process.
dqcsim::raw::dqcs_plugin_free
dqcs_return_t dqcs_plugin_free(dqcs_plugin_state_t plugin, dqcs_handle_t qbset)
Free the given downstream qubits.
DQCS_PATH_STYLE_RELATIVE
@ DQCS_PATH_STYLE_RELATIVE
Specifies that all paths should be saved relative to DQCsim's working directory.
Definition: dqcsim.h:445
dqcsim::raw::dqcs_scfg_seed_get
uint64_t dqcs_scfg_seed_get(dqcs_handle_t scfg)
Returns the configured random seed.
dqcsim::raw::dqcs_handle_type
dqcs_handle_type_t dqcs_handle_type(dqcs_handle_t handle)
Returns the type of object associated with the given handle.
dqcsim::raw::dqcs_pdef_author
char * dqcs_pdef_author(dqcs_handle_t pdef)
Returns the plugin author for the given plugin definition object.
dqcsim::raw::dqcs_plugin_get_cycles_since_measure
dqcs_cycle_t dqcs_plugin_get_cycles_since_measure(dqcs_plugin_state_t plugin, dqcs_qubit_t qubit)
Returns the number of downstream cycles since the latest measurement of the given downstream qubit.
dqcsim::raw::dqcs_gm_construct_one
dqcs_handle_t dqcs_gm_construct_one(dqcs_handle_t gm, const void *key_data, dqcs_qubit_t qa, dqcs_handle_t param_data)
Uses a gate map object to construct a one-qubit DQCsim gate from the plugin's representation.
dqcsim::raw::dqcs_mat_num_qubits
ssize_t dqcs_mat_num_qubits(dqcs_handle_t mat)
Returns the number of qubits targeted by the given matrix.
DQCS_GATE_T_DAG
@ DQCS_GATE_T_DAG
The T-dagger matrix, also known as a negative 45 degree Z rotation.
Definition: dqcsim.h:583
dqcsim::raw::dqcs_mset_take
dqcs_handle_t dqcs_mset_take(dqcs_handle_t mset, dqcs_qubit_t qubit)
Returns the measurement result for the given qubit from a measurement result set and removes it from ...
dqcsim::raw::dqcs_basis_t::DQCS_BASIS_INVALID
@ DQCS_BASIS_INVALID
Invalid basis. Used as an error return value.
dqcsim::raw::dqcs_arb_get_size
ssize_t dqcs_arb_get_size(dqcs_handle_t arb, ssize_t index)
Returns the size in bytes of the unstructured string argument at the specified index.
dqcsim::raw::dqcs_path_style_t
dqcs_path_style_t
Reproduction file path style.
Definition: cdqcsim:347
DQCS_GATE_RZ_90
@ DQCS_GATE_RZ_90
Rz(90°) gate.
Definition: dqcsim.h:672
dqcs_loglevel_t
dqcs_loglevel_t
Enumeration of loglevels and logging modes.
Definition: dqcsim.h:337
dqcsim::raw::dqcs_cmd_new
dqcs_handle_t dqcs_cmd_new(const char *iface, const char *oper)
Creates a new ArbCmd object.
DQCS_GATE_RY_M90
@ DQCS_GATE_RY_M90
Ry(-90°) gate.
Definition: dqcsim.h:642
DQCS_GATE_PHASE_K
@ DQCS_GATE_PHASE_K
The matrix for a Z rotation with angle π/2^k.
Definition: dqcsim.h:762
dqcsim::raw::dqcs_gm_add_measure
dqcs_return_t dqcs_gm_add_measure(dqcs_handle_t gm, void(*key_free)(void *user_data), void *key_data, intptr_t num_measures, dqcs_handle_t basis, double epsilon)
Adds a measurement gate mapping to the given gate map.
dqcsim::raw::dqcs_plugin_type_t
dqcs_plugin_type_t
Enumeration of the three types of plugins.
Definition: cdqcsim:362
dqcsim::raw::dqcs_arb_pop_raw
ssize_t dqcs_arb_pop_raw(dqcs_handle_t arb, void *obj, size_t obj_size)
Pops an unstructured raw argument from the back of the list.
dqcsim::raw::dqcs_pcfg_new_raw
dqcs_handle_t dqcs_pcfg_new_raw(dqcs_plugin_type_t typ, const char *name, const char *executable, const char *script)
Creates a new plugin process configuration object using raw paths.
dqcsim::raw::dqcs_plugin_get_measurement
dqcs_handle_t dqcs_plugin_get_measurement(dqcs_plugin_state_t plugin, dqcs_qubit_t qubit)
Returns the latest measurement of the given downstream qubit.
dqcsim::raw::dqcs_mset_get
dqcs_handle_t dqcs_mset_get(dqcs_handle_t mset, dqcs_qubit_t qubit)
Returns a copy of the measurement result for the given qubit from a measurement result set.
dqcsim::raw::dqcs_sim_get_name_idx
char * dqcs_sim_get_name_idx(dqcs_handle_t sim, ssize_t index)
Queries the implementation name of a plugin, referenced by index.
DQCS_BASIS_INVALID
@ DQCS_BASIS_INVALID
Invalid basis.
Definition: dqcsim.h:38
dqcsim::raw::dqcs_error_set
void dqcs_error_set(const char *msg)
Sets the latest error message string.
dqcsim::raw::dqcs_pcfg_work_get
char * dqcs_pcfg_work_get(dqcs_handle_t pcfg)
Returns the configured working directory for the given plugin process.
DQCS_GATE_PAULI_Y
@ DQCS_GATE_PAULI_Y
The Pauli Y matrix.
Definition: dqcsim.h:516
dqcsim::raw::dqcs_plugin_random_u64
dqcs_handle_t dqcs_plugin_random_u64(dqcs_plugin_state_t plugin)
Generates a random unsigned 64-bit number using the simulator random seed.
dqcsim::raw::dqcs_sim_arb_idx
dqcs_handle_t dqcs_sim_arb_idx(dqcs_handle_t sim, ssize_t index, dqcs_handle_t cmd)
Sends an ArbCmd message to one of the plugins, referenced by index.
dqcsim::raw::dqcs_sim_get_name
char * dqcs_sim_get_name(dqcs_handle_t sim, const char *name)
Queries the implementation name of a plugin, referenced by instance name.
dqcsim::raw::dqcs_plugin_random_f64
double dqcs_plugin_random_f64(dqcs_plugin_state_t plugin)
Generates a random floating point number using the simulator random seed.
DQCS_GATE_SWAP
@ DQCS_GATE_SWAP
The swap gate matrix.
Definition: dqcsim.h:831
DQCS_HTYPE_SIM_CONFIG
@ DQCS_HTYPE_SIM_CONFIG
Indicates that the given handle belongs to a simulator configuration object.
Definition: dqcsim.h:297
dqcsim::raw::dqcs_tcfg_new_raw
dqcs_handle_t dqcs_tcfg_new_raw(dqcs_plugin_type_t plugin_type, const char *name, void(*callback)(void *user_data, const char *simulator), void(*user_free)(void *user_data), void *user_data)
Creates a new plugin thread configuration object from a callback.
dqcsim::raw::dqcs_gm_add_predef_unitary
dqcs_return_t dqcs_gm_add_predef_unitary(dqcs_handle_t gm, void(*key_free)(void *user_data), void *key_data, dqcs_predefined_gate_t gate, intptr_t num_controls, double epsilon, bool ignore_gphase)
Adds a unitary gate mapping for the given DQCsim-defined gate to the given gate map.
dqcsim::raw::dqcs_scfg_repro_disable
dqcs_return_t dqcs_scfg_repro_disable(dqcs_handle_t scfg)
Disables the reproduction logging system.
dqcsim::raw::dqcs_plugin_start
dqcs_handle_t dqcs_plugin_start(dqcs_handle_t pdef, const char *simulator)
Executes a plugin in a worker thread.
dqcsim::raw::dqcs_measurement_t::DQCS_MEAS_INVALID
@ DQCS_MEAS_INVALID
Error value used to indicate that something went wrong.
DQCS_LOG_WARN
@ DQCS_LOG_WARN
This loglevel is to be used for reporting that a called API/function is telling us we did something w...
Definition: dqcsim.h:369
dqcsim::raw::dqcs_cq_push
dqcs_return_t dqcs_cq_push(dqcs_handle_t cq, dqcs_handle_t cmd)
Pushes an ArbCmd object into the given ArbCmd queue.
dqcsim::raw::dqcs_scfg_dqcsim_verbosity_set
dqcs_return_t dqcs_scfg_dqcsim_verbosity_set(dqcs_handle_t scfg, dqcs_loglevel_t level)
Configures the logging verbosity for DQCsim's own messages.
dqcsim::raw::dqcs_plugin_type_t::DQCS_PTYPE_INVALID
@ DQCS_PTYPE_INVALID
Invalid plugin type.
dqcsim::raw::dqcs_tcfg_tee
dqcs_return_t dqcs_tcfg_tee(dqcs_handle_t tcfg, dqcs_loglevel_t verbosity, const char *filename)
Configures a plugin thread to also output its log messages to a file.
dqcsim::raw::dqcs_pcfg_name
char * dqcs_pcfg_name(dqcs_handle_t pcfg)
Returns the configured name for the given plugin process.
dqcsim::raw::dqcs_scfg_new
dqcs_handle_t dqcs_scfg_new()
Constructs an empty simulation configuration.
DQCS_GATE_INVALID
@ DQCS_GATE_INVALID
Invalid gate.
Definition: dqcsim.h:483
dqcsim::raw::dqcs_gm_add_prep
dqcs_return_t dqcs_gm_add_prep(dqcs_handle_t gm, void(*key_free)(void *user_data), void *key_data, intptr_t num_targets, dqcs_handle_t basis, double epsilon)
Adds a prep gate mapping to the given gate map.
dqcsim::raw::dqcs_arb_json_get
char * dqcs_arb_json_get(dqcs_handle_t arb)
Returns the JSON/CBOR object of an ArbData object in the form of a JSON string.
DQCS_LOG_INVALID
@ DQCS_LOG_INVALID
Invalid loglevel.
Definition: dqcsim.h:342
DQCS_GATE_H
@ DQCS_GATE_H
The hadamard gate matrix.
Definition: dqcsim.h:539
DQCS_GATE_RY_90
@ DQCS_GATE_RY_90
Ry(90°) gate.
Definition: dqcsim.h:631
DQCS_BASIS_Y
@ DQCS_BASIS_Y
The Y basis.
Definition: dqcsim.h:60
DQCS_GATE_RZ_180
@ DQCS_GATE_RZ_180
Rz(180°) gate.
Definition: dqcsim.h:702
dqcsim::raw::dqcs_gm_construct
dqcs_handle_t dqcs_gm_construct(dqcs_handle_t gm, const void *key_data, dqcs_handle_t qubits, dqcs_handle_t param_data)
Uses a gate map object to construct a multi-qubit DQCsim gate from the plugin's representation.
dqcsim::raw::dqcs_qbset_contains
dqcs_bool_return_t dqcs_qbset_contains(dqcs_handle_t qbset, dqcs_qubit_t qubit)
Returns whether the given qubit set contains the given qubit.
dqcsim::raw::dqcs_scfg_repro_path_style_get
dqcs_path_style_t dqcs_scfg_repro_path_style_get(dqcs_handle_t scfg)
Returns the path style used when writing reproduction files.
dqcsim::raw::dqcs_gm_add_fixed_unitary
dqcs_return_t dqcs_gm_add_fixed_unitary(dqcs_handle_t gm, void(*key_free)(void *key_data), void *key_data, dqcs_handle_t matrix, intptr_t num_controls, double epsilon, bool ignore_gphase)
Adds a unitary gate mapping for the given gate matrix to the given gate map.
dqcsim::raw::dqcs_sim_get_version_idx
char * dqcs_sim_get_version_idx(dqcs_handle_t sim, ssize_t index)
Queries the version of a plugin, referenced by index.
dqcsim::raw::dqcs_mat_get
double * dqcs_mat_get(dqcs_handle_t mat)
Returns a copy of the contained matrix as a C array.
dqcsim::raw::dqcs_gate_new_predef_three
dqcs_handle_t dqcs_gate_new_predef_three(dqcs_predefined_gate_t gate_type, dqcs_qubit_t qa, dqcs_qubit_t qb, dqcs_qubit_t qc, dqcs_handle_t param_data)
Constructs a new predefined unitary three-qubit gate.
dqcsim::raw::dqcs_plugin_wait
dqcs_return_t dqcs_plugin_wait(dqcs_handle_t pjoin)
Waits for a plugin worker thread to finish executing.
dqcsim::raw::dqcs_handle_delete
dqcs_return_t dqcs_handle_delete(dqcs_handle_t handle)
Destroys the object associated with a handle.
dqcsim::raw::dqcs_gate_new_measurement
dqcs_handle_t dqcs_gate_new_measurement(dqcs_handle_t measures, dqcs_handle_t matrix)
Constructs a new measurement gate.
dqcsim::raw::dqcs_pcfg_verbosity_set
dqcs_return_t dqcs_pcfg_verbosity_set(dqcs_handle_t pcfg, dqcs_loglevel_t level)
Configures the logging verbosity for the given plugin process.
DQCS_MEAS_ZERO
@ DQCS_MEAS_ZERO
Indicates that the qubit was measured to be zero.
Definition: dqcsim.h:417
DQCS_GATE_R
@ DQCS_GATE_R
Arbitrary rotation matrix.
Definition: dqcsim.h:818
DQCS_GATE_PAULI_X
@ DQCS_GATE_PAULI_X
The Pauli X matrix.
Definition: dqcsim.h:505
dqcsim::raw::dqcs_gate_has_targets
dqcs_bool_return_t dqcs_gate_has_targets(dqcs_handle_t gate)
Returns whether the specified gate has target qubits.
DQCS_GATE_TYPE_UNITARY
@ DQCS_GATE_TYPE_UNITARY
Unitary gates have one or more target qubits, zero or more control qubits, and a unitary matrix,...
Definition: dqcsim.h:113
DQCS_HTYPE_BACK_PROCESS_CONFIG
@ DQCS_HTYPE_BACK_PROCESS_CONFIG
Indicates that the given handle belongs to a backend plugin process configuration object.
Definition: dqcsim.h:266
DQCS_GATE_PHASE
@ DQCS_GATE_PHASE
The matrix for an arbitrary Z rotation.
Definition: dqcsim.h:783
dqcsim::raw::dqcs_handle_dump
char * dqcs_handle_dump(dqcs_handle_t handle)
Returns a debug dump of the object associated with the given handle.
dqcsim::raw::dqcs_pdef_set_allocate_cb
dqcs_return_t dqcs_pdef_set_allocate_cb(dqcs_handle_t pdef, dqcs_return_t(*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t qubits, dqcs_handle_t alloc_cmds), void(*user_free)(void *user_data), void *user_data)
Sets the qubit allocation callback for operators and backends.
DQCS_MEAS_ONE
@ DQCS_MEAS_ONE
Indicates that the qubit was measured to be one.
Definition: dqcsim.h:421
DQCS_PATH_STYLE_INVALID
@ DQCS_PATH_STYLE_INVALID
Error value used to indicate that something went wrong.
Definition: dqcsim.h:435
DQCS_HTYPE_ARB_DATA
@ DQCS_HTYPE_ARB_DATA
Indicates that the given handle belongs to an ArbData object.
Definition: dqcsim.h:187
dqcsim::raw::dqcs_plugin_state_t
void * dqcs_plugin_state_t
Type for a plugin state.
Definition: cdqcsim:750
dqcsim::raw::dqcs_pcfg_verbosity_get
dqcs_loglevel_t dqcs_pcfg_verbosity_get(dqcs_handle_t pcfg)
Returns the configured verbosity for the given plugin process.
dqcsim::raw::dqcs_arb_get_str
char * dqcs_arb_get_str(dqcs_handle_t arb, ssize_t index)
Returns the unstructured string argument at the specified index.
dqcsim::raw::dqcs_scfg_tee
dqcs_return_t dqcs_scfg_tee(dqcs_handle_t scfg, dqcs_loglevel_t verbosity, const char *filename)
Configures DQCsim to also output its log messages to a file.
dqcsim::raw::dqcs_scfg_seed_set
dqcs_return_t dqcs_scfg_seed_set(dqcs_handle_t scfg, uint64_t seed)
Configures the random seed that the simulation should use.
dqcsim::raw::dqcs_tcfg_verbosity_get
dqcs_loglevel_t dqcs_tcfg_verbosity_get(dqcs_handle_t tcfg)
Returns the configured verbosity for the given plugin thread.
dqcsim::raw::dqcs_mset_len
ssize_t dqcs_mset_len(dqcs_handle_t mset)
Returns the number of qubits measurements in the given measurement set.
dqcsim::raw::dqcs_mset_remove
dqcs_return_t dqcs_mset_remove(dqcs_handle_t mset, dqcs_qubit_t qubit)
Removes the measurement result for the given qubit from a measurement result set.
dqcsim::raw::dqcs_gate_new_unitary
dqcs_handle_t dqcs_gate_new_unitary(dqcs_handle_t targets, dqcs_handle_t controls, dqcs_handle_t matrix)
Constructs a new unitary gate.
dqcsim::raw::dqcs_pcfg_tee
dqcs_return_t dqcs_pcfg_tee(dqcs_handle_t pcfg, dqcs_loglevel_t verbosity, const char *filename)
Configures a plugin process to also output its log messages to a file.
dqcsim::raw::dqcs_meas_new
dqcs_handle_t dqcs_meas_new(dqcs_qubit_t qubit, dqcs_measurement_t value)
Constructs a new measurement object.
DQCS_GATE_SQRT_SWAP
@ DQCS_GATE_SQRT_SWAP
The square-root of a swap gate matrix.
Definition: dqcsim.h:844
dqcsim::raw::dqcs_pdef_type
dqcs_plugin_type_t dqcs_pdef_type(dqcs_handle_t pdef)
Returns the plugin type for the given plugin definition object.
dqcsim::raw::dqcs_mat_approx_eq
dqcs_bool_return_t dqcs_mat_approx_eq(dqcs_handle_t a, dqcs_handle_t b, double epsilon, bool ignore_gphase)
Approximately compares two matrices.
DQCS_HTYPE_BACK_THREAD_CONFIG
@ DQCS_HTYPE_BACK_THREAD_CONFIG
Indicates that the given handle belongs to a backend plugin thread configuration object.
Definition: dqcsim.h:290
DQCS_GATE_RZ
@ DQCS_GATE_RZ
The matrix for an arbitrary Z rotation.
Definition: dqcsim.h:747
dqcsim::raw::dqcs_gate_has_name
dqcs_bool_return_t dqcs_gate_has_name(dqcs_handle_t gate)
Returns whether the specified gate has a name.
dqcsim::raw::dqcs_cmd_oper_get
char * dqcs_cmd_oper_get(dqcs_handle_t cmd)
Returns the operation ID of an ArbCmd.
dqcsim::raw::dqcs_pcfg_shutdown_timeout_get
double dqcs_pcfg_shutdown_timeout_get(dqcs_handle_t pcfg)
Returns the configured timeout for the plugin process to shut down gracefully.
dqcsim
Main DQCsim namespace.
Definition: cdqcsim:34
dqcsim::raw::dqcs_pcfg_init_cmd
dqcs_return_t dqcs_pcfg_init_cmd(dqcs_handle_t pcfg, dqcs_handle_t cmd)
Appends an ArbCmd to the list of initialization commands of a plugin process.
dqcsim::raw::dqcs_scfg_push_plugin
dqcs_return_t dqcs_scfg_push_plugin(dqcs_handle_t scfg, dqcs_handle_t xcfg)
Appends a plugin to a simulation configuration.
DQCS_LOG_INFO
@ DQCS_LOG_INFO
This loglevel is to be used for reporting information NOT specifically requested by the user/API call...
Definition: dqcsim.h:382
dqcsim::raw::dqcs_gate_reduce_control
dqcs_handle_t dqcs_gate_reduce_control(dqcs_handle_t gate, double epsilon, bool ignore_gphase)
Utility function that detects control qubits in the targets list of the gate by means of the gate mat...
dqcsim::raw::dqcs_bool_return_t::DQCS_BOOL_FAILURE
@ DQCS_BOOL_FAILURE
The function has failed.
DQCS_FAILURE
@ DQCS_FAILURE
The function has failed.
Definition: dqcsim.h:873
DQCS_HTYPE_BACK_DEF
@ DQCS_HTYPE_BACK_DEF
Indicates that the given handle belongs to a backend plugin definition object.
Definition: dqcsim.h:324
dqcsim::raw::dqcs_arb_json_set
dqcs_return_t dqcs_arb_json_set(dqcs_handle_t arb, const char *json)
Sets the JSON/CBOR object of an ArbData object by means of a JSON string.
DQCS_HTYPE_SIM
@ DQCS_HTYPE_SIM
Indicates that the given handle belongs to a simulator instance.
Definition: dqcsim.h:303