DQCsim
dqcsim.h
Go to the documentation of this file.
1 #ifndef _DQCSIM_H_INCLUDED_
2 #define _DQCSIM_H_INCLUDED_
4 
15 #include <stdio.h>
16 #include <stdarg.h>
17 #include <stdbool.h>
18 #include <stdint.h>
19 #include <stdlib.h>
20 #include <string.h>
21 
22 #ifdef _DQCSIM_HDR_CPP_
23 #undef _DQCSIM_HDR_CPP_
24 #endif
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 
34 typedef enum {
72 } dqcs_basis_t;
73 
77 typedef enum {
90  DQCS_TRUE = 1,
92 
96 typedef enum {
167 
171 typedef enum {
333 
337 typedef enum {
405 
409 typedef enum {
427 
431 typedef enum {
452 
456 typedef enum {
475 
479 typedef enum {
539  DQCS_GATE_H = 104,
550  DQCS_GATE_S = 105,
572  DQCS_GATE_T = 107,
818  DQCS_GATE_R = 191,
864 
868 typedef enum {
878 } dqcs_return_t;
879 
900 typedef unsigned long long dqcs_handle_t;
901 
916 typedef unsigned long long dqcs_qubit_t;
917 
926 typedef void *dqcs_plugin_state_t;
927 
934 typedef long long dqcs_cycle_t;
935 
940 
954 ssize_t dqcs_arb_cbor_get(dqcs_handle_t arb, void *obj, size_t obj_size);
955 
959 dqcs_return_t dqcs_arb_cbor_set(dqcs_handle_t arb, const void *obj, size_t obj_size);
960 
965 
979 ssize_t dqcs_arb_get_raw(dqcs_handle_t arb, ssize_t index, void *obj, size_t obj_size);
980 
987 ssize_t dqcs_arb_get_size(dqcs_handle_t arb, ssize_t index);
988 
996 char *dqcs_arb_get_str(dqcs_handle_t arb, ssize_t index);
997 
1003  ssize_t index,
1004  const void *obj,
1005  size_t obj_size);
1006 
1011 dqcs_return_t dqcs_arb_insert_str(dqcs_handle_t arb, ssize_t index, const char *s);
1012 
1022 
1027 
1032 
1042 
1048 
1067 ssize_t dqcs_arb_pop_raw(dqcs_handle_t arb, void *obj, size_t obj_size);
1068 
1079 
1083 dqcs_return_t dqcs_arb_push_raw(dqcs_handle_t arb, const void *obj, size_t obj_size);
1084 
1089 
1094 
1099 dqcs_return_t dqcs_arb_set_raw(dqcs_handle_t arb, ssize_t index, const void *obj, size_t obj_size);
1100 
1105 dqcs_return_t dqcs_arb_set_str(dqcs_handle_t arb, ssize_t index, const char *s);
1106 
1113 
1122 
1132 dqcs_handle_t dqcs_cmd_new(const char *iface, const char *oper);
1133 
1140 
1149 
1156 
1170 
1187 
1196 
1204 const char *dqcs_error_get(void);
1205 
1215 void dqcs_error_set(const char *msg);
1216 
1222 
1239 
1244 
1249 
1254 
1259 
1264 
1273 
1279 
1292 
1326  dqcs_handle_t targets,
1327  dqcs_handle_t controls,
1328  dqcs_handle_t measures,
1329  dqcs_handle_t matrix);
1330 
1348 
1370  dqcs_handle_t qubits,
1371  dqcs_handle_t param_data);
1372 
1381  dqcs_qubit_t qa,
1382  dqcs_handle_t param_data);
1383 
1392  dqcs_qubit_t qa,
1393  dqcs_qubit_t qb,
1394  dqcs_qubit_t qc,
1395  dqcs_handle_t param_data);
1396 
1405  dqcs_qubit_t qa,
1406  dqcs_qubit_t qb,
1407  dqcs_handle_t param_data);
1408 
1425 
1459  dqcs_handle_t controls,
1460  dqcs_handle_t matrix);
1461 
1484 dqcs_handle_t dqcs_gate_reduce_control(dqcs_handle_t gate, double epsilon, bool ignore_gphase);
1485 
1491 
1498 
1546  void (*key_free)(void *key_data),
1547  void *key_data,
1548  dqcs_bool_return_t (*detector)(const void *user_data, dqcs_handle_t gate, dqcs_handle_t *qubits, dqcs_handle_t *param_data),
1549  void (*detector_user_free)(void *user_data),
1550  void *detector_user_data,
1551  dqcs_handle_t (*constructor)(const void *user_data, dqcs_handle_t qubits, dqcs_handle_t param_data),
1552  void (*constructor_user_free)(void *user_data),
1553  void *constructor_user_data);
1554 
1610  void (*key_free)(void *key_data),
1611  void *key_data,
1612  dqcs_bool_return_t (*detector)(const void *user_data, dqcs_handle_t matrix, size_t num_controls, dqcs_handle_t *param_data),
1613  void (*detector_user_free)(void *user_data),
1614  void *detector_user_data,
1615  dqcs_handle_t (*constructor)(const void *user_data, dqcs_handle_t *param_data, intptr_t *num_controls),
1616  void (*constructor_user_free)(void *user_data),
1617  void *constructor_user_data);
1618 
1643  void (*key_free)(void *key_data),
1644  void *key_data,
1645  dqcs_handle_t matrix,
1646  intptr_t num_controls,
1647  double epsilon,
1648  bool ignore_gphase);
1649 
1671  void (*key_free)(void *user_data),
1672  void *key_data,
1673  intptr_t num_measures,
1674  dqcs_handle_t basis,
1675  double epsilon);
1676 
1705  void (*key_free)(void *user_data),
1706  void *key_data,
1708  intptr_t num_controls,
1709  double epsilon,
1710  bool ignore_gphase);
1711 
1733  void (*key_free)(void *user_data),
1734  void *key_data,
1735  intptr_t num_targets,
1736  dqcs_handle_t basis,
1737  double epsilon);
1738 
1762  const void *key_data,
1763  dqcs_handle_t qubits,
1764  dqcs_handle_t param_data);
1765 
1775  const void *key_data,
1776  dqcs_qubit_t qa,
1777  dqcs_handle_t param_data);
1778 
1788  const void *key_data,
1789  dqcs_qubit_t qa,
1790  dqcs_qubit_t qb,
1791  dqcs_qubit_t qc,
1792  dqcs_handle_t param_data);
1793 
1803  const void *key_data,
1804  dqcs_qubit_t qa,
1805  dqcs_qubit_t qb,
1806  dqcs_handle_t param_data);
1807 
1834  dqcs_handle_t gate,
1835  const void **key_data,
1836  dqcs_handle_t *qubits,
1837  dqcs_handle_t *param_data);
1838 
1902 dqcs_handle_t dqcs_gm_new(bool strip_qubit_refs,
1903  bool strip_data,
1904  bool (*key_cmp)(const void*, const void*),
1905  uint64_t (*key_hash)(const void*));
1906 
1913 
1922 
1931 
1940 
1945 
1989  const char *module,
1990  const char *file,
1991  uint32_t line_nr,
1992  const char *message);
1993 
2002 dqcs_handle_t dqcs_mat_add_controls(dqcs_handle_t mat, size_t number_of_controls);
2003 
2024  dqcs_handle_t b,
2025  double epsilon,
2026  bool ignore_gphase);
2027 
2041 
2051 
2074 
2082 
2094 
2118  dqcs_predefined_gate_t gate_type,
2119  dqcs_handle_t *param_data,
2120  double epsilon,
2121  bool ignore_gphase);
2122 
2129 
2148 dqcs_handle_t dqcs_mat_new(size_t num_qubits, const double *matrix);
2149 
2156 
2172 
2200  double epsilon,
2201  bool ignore_global_phase,
2202  ssize_t **control_indices);
2203 
2215 
2220 
2225 
2230 
2235 
2241 
2247 
2254 
2261 
2267 
2276 
2282 
2290 
2298 
2309 
2318 dqcs_return_t dqcs_pcfg_env_set(dqcs_handle_t pcfg, const char *key, const char *value);
2319 
2327 
2337 
2346 
2355 
2366 dqcs_handle_t dqcs_pcfg_new(dqcs_plugin_type_t typ, const char *name, const char *spec);
2367 
2381  const char *name,
2382  const char *executable,
2383  const char *script);
2384 
2395 
2404 
2415 
2421 
2427 
2433 
2439 
2445 dqcs_return_t dqcs_pcfg_tee(dqcs_handle_t pcfg, dqcs_loglevel_t verbosity, const char *filename);
2446 
2451 
2456 
2461 
2471 
2476 
2485 
2494 
2511  const char *name,
2512  const char *author,
2513  const char *version);
2514 
2530  dqcs_return_t (*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_cycle_t cycles),
2531  void (*user_free)(void *user_data),
2532  void *user_data);
2533 
2552  dqcs_return_t (*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t qubits, dqcs_handle_t alloc_cmds),
2553  void (*user_free)(void *user_data),
2554  void *user_data);
2555 
2570  dqcs_return_t (*callback)(void *user_data, dqcs_plugin_state_t state),
2571  void (*user_free)(void *user_data),
2572  void *user_data);
2573 
2590  dqcs_return_t (*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t qubits),
2591  void (*user_free)(void *user_data),
2592  void *user_data);
2593 
2640  dqcs_handle_t (*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t gate),
2641  void (*user_free)(void *user_data),
2642  void *user_data);
2643 
2659  dqcs_handle_t (*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t cmd),
2660  void (*user_free)(void *user_data),
2661  void *user_data);
2662 
2682  dqcs_return_t (*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t init_cmds),
2683  void (*user_free)(void *user_data),
2684  void *user_data);
2685 
2729  dqcs_handle_t (*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t meas),
2730  void (*user_free)(void *user_data),
2731  void *user_data);
2732 
2757  dqcs_handle_t (*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t args),
2758  void (*user_free)(void *user_data),
2759  void *user_data);
2760 
2780  dqcs_handle_t (*callback)(void *user_data, dqcs_plugin_state_t state, dqcs_handle_t cmd),
2781  void (*user_free)(void *user_data),
2782  void *user_data);
2783 
2788 
2797 
2808 
2827  uintptr_t num_qubits,
2828  dqcs_handle_t cq);
2829 
2840 
2851 
2862 
2872 
2883  dqcs_qubit_t qubit);
2884 
2895 
2906 
2916 
2924 
2935 
2951 dqcs_return_t dqcs_plugin_run(dqcs_handle_t pdef, const char *simulator);
2952 
2962 
2980 dqcs_handle_t dqcs_plugin_start(dqcs_handle_t pdef, const char *simulator);
2981 
2990 
2995 
3001 
3008 
3018 
3026 
3033 
3038 
3043 
3090  dqcs_loglevel_t verbosity,
3091  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),
3092  void (*user_free)(void *user_data),
3093  void *user_data);
3094 
3107 
3127 
3135 
3140 
3145 
3153 
3160 
3168 
3176 
3182 dqcs_return_t dqcs_scfg_tee(dqcs_handle_t scfg, dqcs_loglevel_t verbosity, const char *filename);
3183 
3197 
3218 
3226 char *dqcs_sim_get_author(dqcs_handle_t sim, const char *name);
3227 
3235 char *dqcs_sim_get_author_idx(dqcs_handle_t sim, ssize_t index);
3236 
3245 char *dqcs_sim_get_name(dqcs_handle_t sim, const char *name);
3246 
3254 char *dqcs_sim_get_name_idx(dqcs_handle_t sim, ssize_t index);
3255 
3263 char *dqcs_sim_get_version(dqcs_handle_t sim, const char *name);
3264 
3272 char *dqcs_sim_get_version_idx(dqcs_handle_t sim, ssize_t index);
3273 
3281 
3291 
3303 
3315 
3326 
3331 
3344 
3353 
3362 
3369 
3379  const char *name,
3380  void (*callback)(void *user_data, const char *simulator),
3381  void (*user_free)(void *user_data),
3382  void *user_data);
3383 
3389 dqcs_return_t dqcs_tcfg_tee(dqcs_handle_t tcfg, dqcs_loglevel_t verbosity, const char *filename);
3390 
3395 
3400 
3405 
3406 //*****************************************************************************
3407 // Functions that cannot be implemented in Rust
3408 //*****************************************************************************
3409 
3410 // Place log function in namespace if this is the C++ header.
3411 #ifdef _DQCSIM_HDR_CPP_
3412 namespace dqcsim {
3413 namespace raw {
3414 #endif
3415 
3416 // Use namespaced C stdlib functions if this is the C++ header.
3418 #ifdef _DQCSIM_HDR_CPP_
3419 #define _DQCSIM_STD_PREFIX_ ::std::
3420 #else
3421 #define _DQCSIM_STD_PREFIX_
3422 #endif
3423 
3432 static void dqcs_log_format(
3433  dqcs_loglevel_t level,
3434  const char *module,
3435  const char *file,
3436  uint32_t line,
3437  const char *fmt,
3438  ...
3439 )
3440 #if defined(__GNUC__)
3441 __attribute__((format(printf,5,6)))
3442 #endif
3443 ;
3444 static void dqcs_log_format(
3445  dqcs_loglevel_t level,
3446  const char *module,
3447  const char *file,
3448  uint32_t line,
3449  const char *fmt,
3450  ...
3451 )
3452 {
3453  // Figure out the buffer size we need.
3454  _DQCSIM_STD_PREFIX_ va_list ap;
3455  va_start(ap, fmt);
3456  int size = _DQCSIM_STD_PREFIX_ vsnprintf(NULL, 0, fmt, ap) + 1;
3457  va_end(ap);
3458 
3459  // Allocate the buffer.
3460  char *buffer = (char*)_DQCSIM_STD_PREFIX_ malloc(size);
3461  if (buffer == NULL) {
3462  _DQCSIM_STD_PREFIX_ fprintf(stderr, "Error: failed to allocate buffer for log message!\n");
3463  return;
3464  }
3465 
3466  // Perform the actual formatting operation.
3467  _DQCSIM_STD_PREFIX_ va_list ap2;
3468  va_start(ap2, fmt);
3469  _DQCSIM_STD_PREFIX_ vsnprintf(buffer, size, fmt, ap2);
3470  va_end(ap2);
3471 
3472  // Send to DQCsim.
3473  if (((int)dqcs_log_raw(level, module, file, line, buffer)) < 0) {
3474  _DQCSIM_STD_PREFIX_ fprintf(stderr, "Error while trying to log: %s\n", dqcs_error_get());
3475  _DQCSIM_STD_PREFIX_ fprintf(stderr, "The message was: %s\n", buffer);
3476  _DQCSIM_STD_PREFIX_ fprintf(stderr, "In %s, %s:%u\n", module, file, line);
3477  }
3478 
3479  // Don't leak!
3480  _DQCSIM_STD_PREFIX_ free(buffer);
3481 }
3482 
3483 #undef _DQCSIM_STD_PREFIX_
3484 
3485 #ifdef _DQCSIM_HDR_CPP_
3486 } // namespace raw
3487 } // namespace dqcsim
3488 #endif
3489 
3490 //*****************************************************************************
3491 // Macros
3492 //*****************************************************************************
3493 
3495 #ifndef _DQCSIM_LANGUAGE_
3496 #ifdef _DQCSIM_HDR_CPP_
3497 #define _DQCSIM_LANGUAGE_ "CPP"
3498 #else
3499 #define _DQCSIM_LANGUAGE_ "C"
3500 #endif
3501 #endif
3502 
3505 #ifndef _DQCSIM_LOGLEVEL_PREFIX_
3506 #ifdef _DQCSIM_HDR_CPP_
3507 #define _DQCSIM_LOGLEVEL_PREFIX_ ::dqcsim::raw::dqcs_loglevel_t::
3508 #else
3509 #define _DQCSIM_LOGLEVEL_PREFIX_
3510 #endif
3511 #endif
3512 
3514 #ifndef dqcs_log_trace
3515 
3519 #define dqcs_log_trace(fmt, ...) \
3520  dqcs_log_format( \
3521  _DQCSIM_LOGLEVEL_PREFIX_ DQCS_LOG_TRACE, \
3522  _DQCSIM_LANGUAGE_, \
3523  __FILE__, \
3524  __LINE__, \
3525  fmt, \
3526  ##__VA_ARGS__ \
3527  )
3528 #endif
3529 
3530 #ifndef dqcs_log_debug
3531 
3535 #define dqcs_log_debug(fmt, ...) \
3536  dqcs_log_format( \
3537  _DQCSIM_LOGLEVEL_PREFIX_ DQCS_LOG_DEBUG, \
3538  _DQCSIM_LANGUAGE_, \
3539  __FILE__, \
3540  __LINE__, \
3541  fmt, \
3542  ##__VA_ARGS__ \
3543  )
3544 #endif
3545 
3546 #ifndef dqcs_log_info
3547 
3551 #define dqcs_log_info(fmt, ...) \
3552  dqcs_log_format( \
3553  _DQCSIM_LOGLEVEL_PREFIX_ DQCS_LOG_INFO, \
3554  _DQCSIM_LANGUAGE_, \
3555  __FILE__, \
3556  __LINE__, \
3557  fmt, \
3558  ##__VA_ARGS__ \
3559  )
3560 #endif
3561 
3562 #ifndef dqcs_log_note
3563 
3567 #define dqcs_log_note(fmt, ...) \
3568  dqcs_log_format( \
3569  _DQCSIM_LOGLEVEL_PREFIX_ DQCS_LOG_NOTE, \
3570  _DQCSIM_LANGUAGE_, \
3571  __FILE__, \
3572  __LINE__, \
3573  fmt, \
3574  ##__VA_ARGS__ \
3575  )
3576 #endif
3577 
3578 #ifndef dqcs_log_warn
3579 
3583 #define dqcs_log_warn(fmt, ...) \
3584  dqcs_log_format( \
3585  _DQCSIM_LOGLEVEL_PREFIX_ DQCS_LOG_WARN, \
3586  _DQCSIM_LANGUAGE_, \
3587  __FILE__, \
3588  __LINE__, \
3589  fmt, \
3590  ##__VA_ARGS__ \
3591  )
3592 #endif
3593 
3594 #ifndef dqcs_log_error
3595 
3599 #define dqcs_log_error(fmt, ...) \
3600  dqcs_log_format( \
3601  _DQCSIM_LOGLEVEL_PREFIX_ DQCS_LOG_ERROR, \
3602  _DQCSIM_LANGUAGE_, \
3603  __FILE__, \
3604  __LINE__, \
3605  fmt, \
3606  ##__VA_ARGS__ \
3607  )
3608 #endif
3609 
3610 #ifndef dqcs_log_fatal
3611 
3615 #define dqcs_log_fatal(fmt, ...) \
3616  dqcs_log_format( \
3617  _DQCSIM_LOGLEVEL_PREFIX_ DQCS_LOG_FATAL, \
3618  _DQCSIM_LANGUAGE_, \
3619  __FILE__, \
3620  __LINE__, \
3621  fmt, \
3622  ##__VA_ARGS__ \
3623  )
3624 #endif
3625 
3626 #ifdef __cplusplus
3627 } // extern "C"
3628 #endif
3629 
3630 #ifdef _DQCSIM_HDR_CPP_
3631 #undef _DQCSIM_HDR_CPP_
3632 #endif
3633 
3634 #endif
dqcs_path_style_t
dqcs_path_style_t
Reproduction file path style.
Definition: dqcsim.h:431
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.
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.
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.
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...
dqcs_plugin_run
dqcs_return_t dqcs_plugin_run(dqcs_handle_t pdef, const char *simulator)
Executes a plugin in the current thread.
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.
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.
dqcs_plugin_send
dqcs_return_t dqcs_plugin_send(dqcs_plugin_state_t plugin, dqcs_handle_t arb)
Sends a message to the host.
DQCS_GATE_TYPE_INVALID
@ DQCS_GATE_TYPE_INVALID
Invalid gate type.
Definition: dqcsim.h:100
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.
dqcs_error_set
void dqcs_error_set(const char *msg)
Sets the latest error message string.
DQCS_GATE_U2
@ DQCS_GATE_U2
Any two-qubit unitary gate, parameterized as a full unitary matrix.
Definition: dqcsim.h:853
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
DQCS_GATE_RY_180
@ DQCS_GATE_RY_180
Ry(180°) gate.
Definition: dqcsim.h:657
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.
dqcs_arb_clear
dqcs_return_t dqcs_arb_clear(dqcs_handle_t arb)
Clears the unstructured argument list.
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.
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.
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.
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_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.
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_arb_len
ssize_t dqcs_arb_len(dqcs_handle_t arb)
Returns the number of unstructured arguments, or -1 to indicate failure.
DQCS_HTYPE_GATE_MAP
@ DQCS_HTYPE_GATE_MAP
Indicates that the given handle belongs to a gate map.
Definition: dqcsim.h:242
dqcs_gate_new_prep
dqcs_handle_t dqcs_gate_new_prep(dqcs_handle_t targets, dqcs_handle_t matrix)
Constructs a new prep gate.
DQCS_GATE_RX_M90
@ DQCS_GATE_RX_M90
Rx(-90°) gate.
Definition: dqcsim.h:605
dqcs_cmd_oper_get
char * dqcs_cmd_oper_get(dqcs_handle_t cmd)
Returns the operation ID of an ArbCmd.
dqcs_gate_type
dqcs_gate_type_t dqcs_gate_type(dqcs_handle_t gate)
Returns the gate type of the given gate.
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.
dqcs_pcfg_executable
char * dqcs_pcfg_executable(dqcs_handle_t pcfg)
Returns the configured executable path for the given plugin process.
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.
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
DQCS_GATE_RX_90
@ DQCS_GATE_RX_90
Rx(90°) gate.
Definition: dqcsim.h:594
DQCS_GATE_S
@ DQCS_GATE_S
The S matrix, also known as a 90 degree Z rotation.
Definition: dqcsim.h:550
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.
DQCS_GATE_RX_180
@ DQCS_GATE_RX_180
Rx(180°) gate.
Definition: dqcsim.h:620
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.
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
dqcs_handle_leak_check
dqcs_return_t dqcs_handle_leak_check(void)
Succeeds only if there are no live handles in the current thread.
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.
dqcs_mset_len
ssize_t dqcs_mset_len(dqcs_handle_t mset)
Returns the number of qubits measurements in the given measurement set.
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_BOOL_FAILURE
@ DQCS_BOOL_FAILURE
The function has failed.
Definition: dqcsim.h:82
dqcs_cycle_t
long long dqcs_cycle_t
Type for a simulation cycle timestamp.
Definition: dqcsim.h:934
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
dqcs_gate_has_measures
dqcs_bool_return_t dqcs_gate_has_measures(dqcs_handle_t gate)
Returns whether the specified gate measures any qubits.
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_gate_name
char * dqcs_gate_name(dqcs_handle_t gate)
Returns the name of a custom gate.
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.
DQCS_BASIS_X
@ DQCS_BASIS_X
The X basis.
Definition: dqcsim.h:49
DQCS_GATE_RX
@ DQCS_GATE_RX
The matrix for an arbitrary X rotation.
Definition: dqcsim.h:717
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.
dqcs_return_t
dqcs_return_t
Default return type for functions that don't need to return anything.
Definition: dqcsim.h:868
dqcs_cq_len
ssize_t dqcs_cq_len(dqcs_handle_t cq)
Returns the number of ArbCmd objects in the given ArbCmd queue.
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.
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.
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.
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_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.
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.
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...
dqcs_mat_len
ssize_t dqcs_mat_len(dqcs_handle_t mat)
Returns the number of complex entries in the given matrix.
dqcs_handle_type_t
dqcs_handle_type_t
Enumeration of types that can be associated with a handle.
Definition: dqcsim.h:171
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
DQCS_SUCCESS
@ DQCS_SUCCESS
The function did what it was supposed to.
Definition: dqcsim.h:877
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.
dqcs_qubit_t
unsigned long long dqcs_qubit_t
Type for a qubit reference.
Definition: dqcsim.h:916
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
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.
DQCS_PTYPE_BACK
@ DQCS_PTYPE_BACK
Backend plugin.
Definition: dqcsim.h:473
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.
dqcs_qbset_new
dqcs_handle_t dqcs_qbset_new(void)
Creates a new set of qubit references.
dqcs_gate_has_name
dqcs_bool_return_t dqcs_gate_has_name(dqcs_handle_t gate)
Returns whether the specified gate has a name.
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_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_LOG_OFF
@ DQCS_LOG_OFF
Turns logging off.
Definition: dqcsim.h:346
dqcs_handle_delete_all
dqcs_return_t dqcs_handle_delete_all(void)
Deletes all handles for the current thread.
dqcs_arb_new
dqcs_handle_t dqcs_arb_new(void)
Creates a new ArbData object.
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.
dqcs_scfg_repro_disable
dqcs_return_t dqcs_scfg_repro_disable(dqcs_handle_t scfg)
Disables the reproduction logging system.
dqcs_measurement_t
dqcs_measurement_t
Qubit measurement value.
Definition: dqcsim.h:409
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
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_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.
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.
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.
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_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
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_gate_new_measurement
dqcs_handle_t dqcs_gate_new_measurement(dqcs_handle_t measures, dqcs_handle_t matrix)
Constructs a new measurement gate.
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.
DQCS_PTYPE_FRONT
@ DQCS_PTYPE_FRONT
Frontend plugin.
Definition: dqcsim.h:465
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_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.
dqcs_tcfg_name
char * dqcs_tcfg_name(dqcs_handle_t tcfg)
Returns the configured name for the given plugin thread.
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.
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.
DQCS_GATE_U1
@ DQCS_GATE_U1
Any single-qubit unitary gate, parameterized as a full unitary matrix.
Definition: dqcsim.h:792
dqcs_tcfg_type
dqcs_plugin_type_t dqcs_tcfg_type(dqcs_handle_t tcfg)
Returns the type of the given plugin thread configuration.
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_PTYPE_INVALID
@ DQCS_PTYPE_INVALID
Invalid plugin type.
Definition: dqcsim.h:461
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.
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.
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
dqcs_plugin_state_t
void * dqcs_plugin_state_t
Type for a plugin state.
Definition: dqcsim.h:926
DQCS_MEAS_INVALID
@ DQCS_MEAS_INVALID
Error value used to indicate that something went wrong.
Definition: dqcsim.h:413
DQCS_HTYPE_FRONT_DEF
@ DQCS_HTYPE_FRONT_DEF
Indicates that the given handle belongs to a frontend plugin definition object.
Definition: dqcsim.h:310
DQCS_HTYPE_PLUGIN_JOIN
@ DQCS_HTYPE_PLUGIN_JOIN
Indicates that the given handle belongs to a plugin thread join handle.
Definition: dqcsim.h:331
DQCS_HTYPE_MEAS
@ DQCS_HTYPE_MEAS
Indicates that the given handle belongs to a qubit measurement result.
Definition: dqcsim.h:223
dqcsim::raw::dqcs_error_get
const char * dqcs_error_get()
Returns a pointer to the latest error message.
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_HTYPE_MATRIX
@ DQCS_HTYPE_MATRIX
Indicates that the given handle belongs to a matrix.
Definition: dqcsim.h:236
dqcs_scfg_seed_get
uint64_t dqcs_scfg_seed_get(dqcs_handle_t scfg)
Returns the configured random seed.
DQCS_LOG_PASS
@ DQCS_LOG_PASS
This is intended to be used when configuring the stdout/stderr capture mode for a plugin process.
Definition: dqcsim.h:403
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.
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
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_pcfg_work_get
char * dqcs_pcfg_work_get(dqcs_handle_t pcfg)
Returns the configured working directory for the given plugin process.
dqcs_pdef_author
char * dqcs_pdef_author(dqcs_handle_t pdef)
Returns the plugin author for the given plugin definition object.
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.
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_gate_has_controls
dqcs_bool_return_t dqcs_gate_has_controls(dqcs_handle_t gate)
Returns whether the specified gate has control qubits.
DQCS_PTYPE_OPER
@ DQCS_PTYPE_OPER
Operator plugin.
Definition: dqcsim.h:469
dqcs_plugin_recv
dqcs_handle_t dqcs_plugin_recv(dqcs_plugin_state_t plugin)
Waits for a message from the host.
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.
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.
dqcs_tcfg_verbosity_get
dqcs_loglevel_t dqcs_tcfg_verbosity_get(dqcs_handle_t tcfg)
Returns the configured verbosity for the given plugin thread.
dqcs_plugin_free
dqcs_return_t dqcs_plugin_free(dqcs_plugin_state_t plugin, dqcs_handle_t qbset)
Free the given downstream qubits.
dqcs_meas_new
dqcs_handle_t dqcs_meas_new(dqcs_qubit_t qubit, dqcs_measurement_t value)
Constructs a new measurement object.
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_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.
DQCS_MEAS_UNDEFINED
@ DQCS_MEAS_UNDEFINED
Indicates that the measurement value is unknown for whatever reason.
Definition: dqcsim.h:425
DQCS_TRUE
@ DQCS_TRUE
The function did what it was supposed to and returned true.
Definition: dqcsim.h:90
dqcs_handle_t
unsigned long long dqcs_handle_t
Type for a handle.
Definition: dqcsim.h:900
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.
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.
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
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.
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_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.
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.
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_CUSTOM
@ DQCS_GATE_TYPE_CUSTOM
Custom gates perform a user-defined mixed quantum-classical operation, identified by a name.
Definition: dqcsim.h:165
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_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_cq_new
dqcs_handle_t dqcs_cq_new(void)
Creates a new ArbCmd queue object.
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
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.
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.
DQCS_GATE_RZ_M90
@ DQCS_GATE_RZ_M90
Rz(-90°) gate.
Definition: dqcsim.h:687
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.
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.
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.
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.
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_pcfg_name
char * dqcs_pcfg_name(dqcs_handle_t pcfg)
Returns the configured name for the given plugin process.
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.
dqcs_handle_dump
char * dqcs_handle_dump(dqcs_handle_t handle)
Returns a debug dump of the object associated with the given handle.
DQCS_BASIS_Z
@ DQCS_BASIS_Z
The Z basis.
Definition: dqcsim.h:71
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.
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.
DQCS_GATE_PAULI_I
@ DQCS_GATE_PAULI_I
The identity gate for a single qubit.
Definition: dqcsim.h:494
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.
DQCS_GATE_RY
@ DQCS_GATE_RY
The matrix for an arbitrary Y rotation.
Definition: dqcsim.h:732
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 ...
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
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.
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.
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
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
dqcs_predefined_gate_t
dqcs_predefined_gate_t
Enumeration of gates defined by DQCsim.
Definition: dqcsim.h:479
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.
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.
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.
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_sim_new
dqcs_handle_t dqcs_sim_new(dqcs_handle_t scfg)
Constructs a DQCsim simulation.
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.
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.
DQCS_GATE_PAULI_Z
@ DQCS_GATE_PAULI_Z
The Pauli Z matrix.
Definition: dqcsim.h:527
dqcs_qbset_len
ssize_t dqcs_qbset_len(dqcs_handle_t qbset)
Returns the number of qubits in the given set.
dqcs_pdef_type
dqcs_plugin_type_t dqcs_pdef_type(dqcs_handle_t pdef)
Returns the plugin type for the given plugin definition object.
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...
DQCS_HTYPE_OPER_DEF
@ DQCS_HTYPE_OPER_DEF
Indicates that the given handle belongs to an operator plugin definition object.
Definition: dqcsim.h:317
DQCS_FALSE
@ DQCS_FALSE
The function did what it was supposed to and returned false.
Definition: dqcsim.h:86
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.
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.
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_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.
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_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
dqcs_cmd_iface_get
char * dqcs_cmd_iface_get(dqcs_handle_t cmd)
Returns the interface ID of an ArbCmd.
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.
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
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.
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.
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
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.
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.
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.
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_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.
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
DQCS_PATH_STYLE_ABSOLUTE
@ DQCS_PATH_STYLE_ABSOLUTE
Specifies that all paths should be saved canonically, i.e.
Definition: dqcsim.h:450
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_RY_M90
@ DQCS_GATE_RY_M90
Ry(-90°) gate.
Definition: dqcsim.h:642
dqcs_scfg_new
dqcs_handle_t dqcs_scfg_new(void)
Constructs an empty simulation configuration.
DQCS_GATE_PHASE_K
@ DQCS_GATE_PHASE_K
The matrix for a Z rotation with angle π/2^k.
Definition: dqcsim.h:762
dqcs_bool_return_t
dqcs_bool_return_t
Return type for functions that normally return a boolean but can also fail.
Definition: dqcsim.h:77
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.
dqcs_plugin_start
dqcs_handle_t dqcs_plugin_start(dqcs_handle_t pdef, const char *simulator)
Executes a plugin in a worker thread.
DQCS_BASIS_INVALID
@ DQCS_BASIS_INVALID
Invalid basis.
Definition: dqcsim.h:38
DQCS_GATE_PAULI_Y
@ DQCS_GATE_PAULI_Y
The Pauli Y matrix.
Definition: dqcsim.h:516
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_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.
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.
DQCS_GATE_U3
@ DQCS_GATE_U3
Any three-qubit unitary gate, parameterized as a full unitary matrix.
Definition: dqcsim.h:862
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.
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.
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.
DQCS_GATE_SWAP
@ DQCS_GATE_SWAP
The swap gate matrix.
Definition: dqcsim.h:831
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_HTYPE_SIM_CONFIG
@ DQCS_HTYPE_SIM_CONFIG
Indicates that the given handle belongs to a simulator configuration object.
Definition: dqcsim.h:297
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.
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_mset_new
dqcs_handle_t dqcs_mset_new(void)
Creates a new set of qubit measurement results.
dqcs_plugin_type_t
dqcs_plugin_type_t
Enumeration of the three types of plugins.
Definition: dqcsim.h:456
dqcs_sim_wait
dqcs_handle_t dqcs_sim_wait(dqcs_handle_t sim)
Waits for the simulated accelerator to finish its current program.
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.
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_pcfg_verbosity_get
dqcs_loglevel_t dqcs_pcfg_verbosity_get(dqcs_handle_t pcfg)
Returns the configured verbosity for the given plugin process.
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.
dqcs_arb_pop_str
char * dqcs_arb_pop_str(dqcs_handle_t arb)
Pops an unstructured string argument from the back of the list.
dqcs_cq_next
dqcs_return_t dqcs_cq_next(dqcs_handle_t cq)
Advances an ArbCmd queue to the next command.
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
dqcs_sim_recv
dqcs_handle_t dqcs_sim_recv(dqcs_handle_t sim)
Waits for the simulated accelerator to send a message to us.
DQCS_GATE_INVALID
@ DQCS_GATE_INVALID
Invalid gate.
Definition: dqcsim.h:483
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.
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_type_t
dqcs_gate_type_t
Types of DQCsim gates.
Definition: dqcsim.h:96
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_pdef_name
char * dqcs_pdef_name(dqcs_handle_t pdef)
Returns the plugin name for the given plugin definition object.
DQCS_GATE_RZ_180
@ DQCS_GATE_RZ_180
Rz(180°) gate.
Definition: dqcsim.h:702
dqcs_pcfg_script
char * dqcs_pcfg_script(dqcs_handle_t pcfg)
Returns the configured script path for the given plugin process.
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...
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_cmd_new
dqcs_handle_t dqcs_cmd_new(const char *iface, const char *oper)
Creates a new ArbCmd object.
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
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_plugin_arb
dqcs_handle_t dqcs_plugin_arb(dqcs_plugin_state_t plugin, dqcs_handle_t cmd)
Sends an arbitrary command downstream.
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_pdef_version
char * dqcs_pdef_version(dqcs_handle_t pdef)
Returns the plugin version for the given plugin definition object.
DQCS_GATE_PHASE
@ DQCS_GATE_PHASE
The matrix for an arbitrary Z rotation.
Definition: dqcsim.h:783
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_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_sim_send
dqcs_return_t dqcs_sim_send(dqcs_handle_t sim, dqcs_handle_t data)
Sends a message to the simulated accelerator.
dqcs_mat_new
dqcs_handle_t dqcs_mat_new(size_t num_qubits, const double *matrix)
Constructs a new gate matrix.
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
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.
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.
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.
dqcs_pcfg_type
dqcs_plugin_type_t dqcs_pcfg_type(dqcs_handle_t pcfg)
Returns the type of the given plugin process configuration.
dqcs_sim_yield
dqcs_return_t dqcs_sim_yield(dqcs_handle_t sim)
Yields to the simulator.
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.
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_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.
dqcs_handle_delete
dqcs_return_t dqcs_handle_delete(dqcs_handle_t handle)
Destroys the object associated with a handle.
dqcs_plugin_wait
dqcs_return_t dqcs_plugin_wait(dqcs_handle_t pjoin)
Waits for a plugin worker thread to finish executing.
DQCS_GATE_SQRT_SWAP
@ DQCS_GATE_SQRT_SWAP
The square-root of a swap gate matrix.
Definition: dqcsim.h:844
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.
dqcs_qbset_pop
dqcs_qubit_t dqcs_qbset_pop(dqcs_handle_t qbset)
Pops a qubit reference off of a qubit reference set.
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
dqcs_mat_get
double * dqcs_mat_get(dqcs_handle_t mat)
Returns a copy of the contained matrix as a C array.
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.
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.
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_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.
dqcs_basis_t
dqcs_basis_t
Enumeration of Pauli bases.
Definition: dqcsim.h:34
dqcsim
Main DQCsim namespace.
Definition: cdqcsim:34
dqcs_handle_type
dqcs_handle_type_t dqcs_handle_type(dqcs_handle_t handle)
Returns the type of object associated with the given handle.
dqcs_error_get
const char * dqcs_error_get(void)
Returns a pointer to the latest error message.
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
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
DQCS_HTYPE_SIM
@ DQCS_HTYPE_SIM
Indicates that the given handle belongs to a simulator instance.
Definition: dqcsim.h:303