DQCsim
|
Wrapper for DQCsim's internal plugin state within the context of downstream-synchronous plugin callbacks. More...
Public Member Functions | |
PluginState (const PluginState &)=delete | |
void | operator= (const PluginState &)=delete |
PluginState (PluginState &&)=delete | |
PluginState & | operator= (PluginState &&)=delete |
QubitSet | allocate (size_t num_qubits, ArbCmdQueue &&cmds) |
Allocates a number of downstream qubits, copying in the given command queue as arbitrary additional data for the qubits. More... | |
QubitSet | allocate (size_t num_qubits, ArbCmdQueue &cmds) |
Allocates a number of downstream qubits, moving in the given command queue as arbitrary additional data for the qubits. More... | |
QubitSet | allocate (size_t num_qubits) |
Allocates a number of default downstream qubits. More... | |
QubitRef | allocate (ArbCmdQueue &&cmds) |
Allocates a single downstream qubit, copying in the given command queue as arbitrary additional data for the qubits. More... | |
QubitRef | allocate (ArbCmdQueue &cmds) |
Allocates a single downstream qubit, moving in the given command queue as arbitrary additional data for the qubits. More... | |
QubitRef | allocate () |
Allocates a single downstream qubit. More... | |
void | free (QubitSet &&qubits) |
Frees the given downstream qubits. More... | |
void | free (const QubitSet &qubits) |
Frees the given downstream qubits. More... | |
void | free (const QubitRef &qubit) |
Frees the given downstream qubit. More... | |
void | gate (Gate &&gate) |
Sends a gate to the downstream plugin. More... | |
void | gate (const Matrix &matrix, const QubitRef &q) |
Shorthand for sending a single-qubit gate to the downstream plugin. More... | |
void | gate (const Matrix &matrix, const QubitRef &qa, const QubitRef &qb) |
Shorthand for sending a two-qubit gate to the downstream plugin. More... | |
void | gate (const Matrix &matrix, const QubitRef &qa, const QubitRef &qb, const QubitRef &qc) |
Shorthand for sending a three-qubit gate to the downstream plugin. More... | |
void | measure_x (const QubitRef &q) |
Shorthand for sending a single-qubit X-axis measurement to the downstream plugin. More... | |
void | measure_x (const QubitSet &qs) |
Shorthand for sending a multi-qubit X-axis measurement to the downstream plugin. More... | |
void | measure_y (const QubitRef &q) |
Shorthand for sending a single-qubit Y-axis measurement to the downstream plugin. More... | |
void | measure_y (const QubitSet &qs) |
Shorthand for sending a multi-qubit Y-axis measurement to the downstream plugin. More... | |
void | measure_z (const QubitRef &q) |
Shorthand for sending a single-qubit Z-axis measurement to the downstream plugin. More... | |
void | measure_z (QubitSet &&qs) |
Shorthand for sending a multi-qubit Z-axis measurement to the downstream plugin. More... | |
void | measure_z (const QubitSet &qs) |
Shorthand for sending a multi-qubit Z-axis measurement to the downstream plugin. More... | |
Cycle | advance (Cycle cycles) |
Tells the downstream plugin to run for the specified number of cycles. More... | |
ArbData | arb (ArbCmd &&cmd) |
Sends an arbitrary command downstream. More... | |
ArbData | arb (const ArbCmd &cmd) |
Sends an arbitrary command downstream. More... | |
Measurement | get_measurement (const QubitRef &qubit) |
Returns the latest measurement of the given downstream qubit. More... | |
Cycle | get_cycles_since_measure (const QubitRef &qubit) |
Returns the number of downstream cycles since the latest measurement of the given downstream qubit. More... | |
Cycle | get_cycles_between_measures (const QubitRef &qubit) |
Returns the number of downstream cycles between the last two measurements of the given downstream qubit. More... | |
Cycle | get_cycle () |
Returns the current value of the downstream cycle counter. More... | |
Public Member Functions inherited from dqcsim::wrap::UpstreamPluginState | |
UpstreamPluginState (const UpstreamPluginState &)=delete | |
void | operator= (const UpstreamPluginState &)=delete |
UpstreamPluginState (UpstreamPluginState &&)=delete | |
UpstreamPluginState & | operator= (UpstreamPluginState &&)=delete |
double | random_f64 () noexcept |
Generates a random floating point number using the simulator random seed. More... | |
uint64_t | random_u64 () noexcept |
Generates a random integer using the simulator random seed. More... | |
template<typename T > | |
T | random () noexcept |
Generates a random value using the simulator random seed. More... | |
Protected Member Functions | |
PluginState (raw::dqcs_plugin_state_t state) | |
Hidden constructor, only to be used by the callback wrappers. | |
Protected Member Functions inherited from dqcsim::wrap::UpstreamPluginState | |
UpstreamPluginState (raw::dqcs_plugin_state_t state) | |
Hidden constructor, only to be used by the callback wrappers. | |
Friends | |
class | CallbackEntryPoints |
Additional Inherited Members | |
Protected Attributes inherited from dqcsim::wrap::UpstreamPluginState | |
const raw::dqcs_plugin_state_t | state |
The wrapped plugin state. More... | |
Wrapper for DQCsim's internal plugin state within the context of downstream-synchronous plugin callbacks.
Cannot be moved or copied, as it must stay in scope of the plugin callbacks. Can also not be constructed except for by the callback wrapper classes.
|
inline |
Allocates a number of downstream qubits, copying in the given command queue as arbitrary additional data for the qubits.
num_qubits | The number of qubits to allocate. |
cmds | A command queue with zero or more commands to apply to the qubits during their initialization. The significance of these commands is dependent on the downstream plugin. |
std::runtime_error | When the command queue is invalid, construction of the qubit set fails for some reason, an asynchronous exception is received, or this is called by a backend plugin. |
|
inline |
Allocates a number of downstream qubits, moving in the given command queue as arbitrary additional data for the qubits.
num_qubits | The number of qubits to allocate. |
cmds | A command queue with zero or more commands to apply to the qubits during their initialization. The significance of these commands is dependent on the downstream plugin. |
std::runtime_error | When the command queue is invalid, construction of the qubit set fails for some reason, an asynchronous exception is received, or this is called by a backend plugin. |
|
inline |
Allocates a number of default downstream qubits.
num_qubits | The number of qubits to allocate. |
std::runtime_error | When construction of the qubit set fails for some reason, an asynchronous exception is received, or this is called by a backend plugin. |
|
inline |
Allocates a single downstream qubit, copying in the given command queue as arbitrary additional data for the qubits.
cmds | A command queue with zero or more commands to apply to the qubit during its initialization. The significance of these commands is dependent on the downstream plugin. |
std::runtime_error | When the command queue is invalid, an asynchronous exception is received, or this is called by a backend plugin. |
|
inline |
Allocates a single downstream qubit, moving in the given command queue as arbitrary additional data for the qubits.
cmds | A command queue with zero or more commands to apply to the qubit during its initialization. The significance of these commands is dependent on the downstream plugin. |
std::runtime_error | When the command queue is invalid, an asynchronous exception is received, or this is called by a backend plugin. |
|
inline |
Allocates a single downstream qubit.
std::runtime_error | When an asynchronous exception is received or this is called by a backend plugin. |
|
inline |
Frees the given downstream qubits.
qubits | The list of qubits to free, passed by move. |
std::runtime_error | When the qubit set handle is invalid, an asynchronous exception is received, or this is called by a backend plugin. |
|
inline |
Frees the given downstream qubits.
qubits | The list of qubits to free, passed by copy. |
std::runtime_error | When the qubit set handle is invalid, an asynchronous exception is received, or this is called by a backend plugin. |
|
inline |
Frees the given downstream qubit.
qubit | The qubit to free. |
std::runtime_error | When an asynchronous exception is received or this is called by a backend plugin. |
|
inline |
Sends a gate to the downstream plugin.
gate | The gate to send. |
std::runtime_error | When the gate handle is invalid, an asynchronous exception is received, or this is called by a backend plugin. |
Shorthand for sending a single-qubit gate to the downstream plugin.
matrix | The gate matrix. Must be 2x2 in size. |
q | The qubit to operate on. |
std::runtime_error | When an asynchronous exception is received or this is called by a backend plugin. |
|
inline |
Shorthand for sending a two-qubit gate to the downstream plugin.
matrix | The gate matrix. It may be 2x2 (one-qubit gate) or 4x4 (two-qubit gate) in size. If it is 2x2, qa is used as an implicit control qubit while qb is the target; for instance, gate(X, a, b) represents a CNOT with a as control and b as target. |
qa | The first qubit argument. |
qb | The second qubit argument. |
std::runtime_error | When an asynchronous exception is received or this is called by a backend plugin. |
|
inline |
Shorthand for sending a three-qubit gate to the downstream plugin.
The matrix may be 2x2 (one-qubit gate), 4x4 (two-qubit gate), or 8x8 (three-qubit gate) in size. If it is 2x2, qa
and qb
are used as control qubits and qc
is the target. If it is 4x4, qa
is used as a control qubit and qb
and qc
are the targets.
matrix | The gate matrix. It may be 2x2 (one-qubit gate), 4x4 (two-qubit gate), or 8x8 (three-qubit gate) in size. If it is 2x2, qa and qb are used as control qubits and qc is the target. If it is 4x4, qa is used as a control qubit and qb and qc are the targets. For instance, gate(X, a, b, c) represents a Toffoli gate with a and b as controls and c as target, and gate(SWAP, a, b, c) represents a Fredkin gate with a as control and b and c as targets. |
qa | The first qubit argument. |
qb | The second qubit argument. |
qc | The third qubit argument. |
std::runtime_error | When an asynchronous exception is received or this is called by a backend plugin. |
|
inline |
Shorthand for sending a single-qubit X-axis measurement to the downstream plugin.
This actually sends the following gates to the downstream plugin for each qubit:
q | The qubit to measure. |
std::runtime_error | When an asynchronous exception is received or this is called by a backend plugin. |
|
inline |
Shorthand for sending a multi-qubit X-axis measurement to the downstream plugin.
This actually sends the following gates to the downstream plugin for each qubit:
qs | The qubits to measure. |
std::runtime_error | When the qubit set handle is invalid, an asynchronous exception is received, or this is called by a backend plugin. |
|
inline |
Shorthand for sending a single-qubit Y-axis measurement to the downstream plugin.
This actually sends the following gates to the downstream plugin for each qubit:
q | The qubit to measure. |
std::runtime_error | When an asynchronous exception is received or this is called by a backend plugin. |
|
inline |
Shorthand for sending a multi-qubit Y-axis measurement to the downstream plugin.
This actually sends the following gates to the downstream plugin for each qubit:
qs | The qubits to measure. |
std::runtime_error | When the qubit set handle is invalid, an asynchronous exception is received, or this is called by a backend plugin. |
|
inline |
Shorthand for sending a single-qubit Z-axis measurement to the downstream plugin.
q | The qubit to measure. |
std::runtime_error | When an asynchronous exception is received, or this is called by a backend plugin. |
|
inline |
Shorthand for sending a multi-qubit Z-axis measurement to the downstream plugin.
qs | The qubits to measure. |
std::runtime_error | When the qubit set handle is invalid, an asynchronous exception is received, or this is called by a backend plugin. |
|
inline |
Shorthand for sending a multi-qubit Z-axis measurement to the downstream plugin.
qs | The qubits to measure. |
std::runtime_error | When the qubit set handle is invalid, an asynchronous exception is received, or this is called by a backend plugin. |
Tells the downstream plugin to run for the specified number of cycles.
cycles | The number of cycles to advance by. Must be positive. |
std::runtime_error | When number of cycles is negative, an asynchronous exception is received, or this is called by a backend plugin. |
Sends an arbitrary command downstream.
cmd | The command to send to the downstream plugin. |
ArbData
object returned by the downstream plugin. std::runtime_error | When the command fails, an asynchronous exception is received, or this is called by a backend plugin. |
Sends an arbitrary command downstream.
cmd | The command to send to the downstream plugin. |
ArbData
object returned by the downstream plugin. std::runtime_error | When the command fails, an asynchronous exception is received, or this is called by a backend plugin. |
|
inline |
Returns the latest measurement of the given downstream qubit.
qubit | The qubit to return the latest measurement for. |
std::runtime_error | When no data is known for the given qubit, measurement object construction fails, or this is called by a backend plugin. |
Returns the number of downstream cycles since the latest measurement of the given downstream qubit.
qubit | The qubit to return the cycle count for. |
std::runtime_error | When no data is known for the given qubit or this is called by a backend plugin. |
Returns the number of downstream cycles between the last two measurements of the given downstream qubit.
qubit | The qubit to return the cycle count for. |
std::runtime_error | When no data is known for the given qubit or this is called by a backend plugin. |
|
inline |