DQCsim
Public Member Functions | List of all members
dqcsim::wrap::GateMap< Unbound, Bound > Class Template Reference

Gate map wrapper class. More...

Inheritance diagram for dqcsim::wrap::GateMap< Unbound, Bound >:
dqcsim::wrap::Handle

Public Member Functions

 GateMap (HandleIndex handle) noexcept
 Wraps the given gate map handle. More...
 
 GateMap (bool strip_qubit_refs=false, bool strip_data=false)
 Constructs a new gate map. More...
 
 GateMap (const GateMap &)=delete
 
void operator= (const GateMap &)=delete
 
 GateMap (GateMap &&)=default
 Default move constructor.
 
GateMapoperator= (GateMap &&)=default
 Default move assignment.
 
GateMap && with_unitary (Unbound &&key, PredefinedGate gate, int num_controls=-1, double epsilon=0.000001, bool ignore_global_phase=true)
 Adds a unitary gate mapping for the given DQCsim-defined gate. More...
 
GateMap && with_unitary (const Unbound &key, PredefinedGate gate, int num_controls=-1, double epsilon=0.000001, bool ignore_global_phase=true)
 Adds a unitary gate mapping for the given DQCsim-defined gate. More...
 
GateMap && with_unitary (Unbound &&key, Matrix &&matrix, int num_controls=-1, double epsilon=0.000001, bool ignore_global_phase=true)
 Adds a unitary gate mapping for the given unitary matrix. More...
 
GateMap && with_unitary (const Unbound &key, const Matrix &matrix, int num_controls=-1, double epsilon=0.000001, bool ignore_global_phase=true)
 Adds a unitary gate mapping for the given unitary matrix. More...
 
GateMap && with_unitary (Unbound &&key, const std::shared_ptr< CustomUnitaryGateConverter > &converter)
 Adds a custom unitary gate mapping. More...
 
GateMap && with_unitary (const Unbound &key, const std::shared_ptr< CustomUnitaryGateConverter > &converter)
 Adds a custom unitary gate mapping. More...
 
GateMap && with_measure (Unbound &&key, PauliBasis basis=PauliBasis::Z, double epsilon=0.000001, int num_measures=-1)
 Adds a measurement gate mapping. More...
 
GateMap && with_measure (const Unbound &key, PauliBasis basis=PauliBasis::Z, double epsilon=0.000001, int num_measures=-1)
 Adds a measurement gate mapping. More...
 
GateMap && with_measure (Unbound &&key, Matrix &&basis, double epsilon=0.000001, int num_measures=-1)
 Adds a measurement gate mapping. More...
 
GateMap && with_measure (const Unbound &key, const Matrix &basis, double epsilon=0.000001, int num_measures=-1)
 Adds a measurement gate mapping. More...
 
GateMap && with_prep (Unbound &&key, PauliBasis basis=PauliBasis::Z, double epsilon=0.000001, int num_targets=-1)
 Adds a prep gate mapping. More...
 
GateMap && with_prep (const Unbound &key, PauliBasis basis=PauliBasis::Z, double epsilon=0.000001, int num_targets=-1)
 Adds a prep gate mapping. More...
 
GateMap && with_prep (Unbound &&key, Matrix &&basis, double epsilon=0.000001, int num_targets=-1)
 Adds a prep gate mapping. More...
 
GateMap && with_prep (const Unbound &key, const Matrix &basis, double epsilon=0.000001, int num_targets=-1)
 Adds a prep gate mapping. More...
 
GateMap && with_custom (Unbound &&key, const std::shared_ptr< CustomGateConverter > &converter)
 Adds a custom gate mapping. More...
 
GateMap && with_custom (const Unbound &key, const std::shared_ptr< CustomGateConverter > &converter)
 Adds a custom gate mapping. More...
 
bool detect (const Gate &gate, const Unbound **unbound, QubitSet *qubits, ArbData *params)
 Uses the gate map to convert an incoming DQCsim gate to the plugin's Unbound representation. More...
 
Gate construct (const Unbound &unbound, QubitSet &&qubits, ArbData &&params)
 Uses a gate map object to construct a DQCsim gate from the plugin's representation. More...
 
Gate construct (const Unbound &unbound, const QubitSet &qubits, const ArbData &params)
 Uses a gate map object to construct a DQCsim gate from the plugin's representation. More...
 
Gate construct (const Unbound &unbound, QubitSet &&qubits)
 Uses a gate map object to construct a DQCsim gate from the plugin's representation. More...
 
Gate construct (const Unbound &unbound, const QubitSet &qubits)
 Uses a gate map object to construct a DQCsim gate from the plugin's representation. More...
 
Bound convert (const Gate &gate)
 Wrapper function for detect(), converting from DQCsim's gate representation directly to the plugin's Bound gate type. More...
 
Gate convert (const Bound &bound)
 Wrapper function for construct(), converting directly from the plugin's Bound gate type to DQCsim's gate representation. More...
 
- Public Member Functions inherited from dqcsim::wrap::Handle
 Handle () noexcept
 Constructs an empty wrapper. More...
 
 Handle (HandleIndex handle) noexcept
 Wraps the given raw handle. More...
 
virtual ~Handle () noexcept
 Delete the handle and its wrapper.
 
void free ()
 Explicitly delete the handle, allowing errors to be caught. More...
 
bool is_valid () const noexcept
 Returns whether this wrapper (still) contains a valid handle. More...
 
HandleIndex get_handle () const noexcept
 Returns the raw handle without relinquishing ownership. More...
 
HandleIndex take_handle () noexcept
 Returns the raw handle and relinquishes ownership. More...
 
 Handle (const Handle &)=delete
 
void operator= (const Handle &)=delete
 
 Handle (Handle &&src)
 Move constructor; simply moves ownership of the handle from the source object to the constructed object. More...
 
Handleoperator= (Handle &&src)
 Move constructor; simply moves ownership of the handle from the source object to the assignment target. More...
 
std::string dump () const
 Returns a string containing a debug dump of the handle. More...
 
HandleType type () const
 Returns the type of this handle. More...
 

Additional Inherited Members

- Protected Attributes inherited from dqcsim::wrap::Handle
HandleIndex handle
 The wrapped handle.
 

Detailed Description

template<class Unbound, class Bound = Unbound>
class dqcsim::wrap::GateMap< Unbound, Bound >

Gate map wrapper class.

Gate maps are used to convert between DQCsim's gate representation and your own, given that your representation consists of the following:

The template expects that the Unbound and Bound types define the following methods:

Note that the Unbound and Bound types can be one and the same, and by default are.

DQCsim provides a number of predefined converters to detect and construct commonly used gates, but for more complex gates you'll of course have to define your own conversion functions.

For more information, refer to the C API documentation.

Definition at line 4750 of file dqcsim.

Constructor & Destructor Documentation

◆ GateMap() [1/2]

template<class Unbound , class Bound = Unbound>
dqcsim::wrap::GateMap< Unbound, Bound >::GateMap ( HandleIndex  handle)
inlinenoexcept

Wraps the given gate map handle.

Note
This constructor does not verify that the handle is actually valid.
Parameters
handleThe raw handle to wrap.

Definition at line 4785 of file dqcsim.

◆ GateMap() [2/2]

template<class Unbound , class Bound = Unbound>
dqcsim::wrap::GateMap< Unbound, Bound >::GateMap ( bool  strip_qubit_refs = false,
bool  strip_data = false 
)
inline

Constructs a new gate map.

Gate maps objects retain a cache to speed up detection of similar DQCsim gates: if a gate is received for the second time, the cache will hit, avoiding recomputation of the detector functions. What constitutes "similar gates" is defined by the two booleans passed to this function.

Parameters
strip_qubit_refsIf set, all qubit references associated with the gate will be invalidated (i.e., set to 0), such that for instance an X gate applied to qubit 1 will be considered equal to an X gate applied to qubit 2.
strip_dataIf set, the ArbData associated with the incoming gate is removed.
Returns
The constructed gate map.
Exceptions
std::runtime_errorWhen construction of the gate map fails.
Note
If you get template errors, ensure that your Unbound type is hashable with std::hash and has a defined equality operator.

Definition at line 4807 of file dqcsim.

Member Function Documentation

◆ with_unitary() [1/6]

template<class Unbound , class Bound = Unbound>
GateMap&& dqcsim::wrap::GateMap< Unbound, Bound >::with_unitary ( Unbound &&  key,
PredefinedGate  gate,
int  num_controls = -1,
double  epsilon = 0.000001,
bool  ignore_global_phase = true 
)
inline

Adds a unitary gate mapping for the given DQCsim-defined gate.

Parameters
keyThe Unbound object that refers to this type of gate in your representation.
gateThe predefined DQCsim gate to detect.
num_controlsThe number of control qubits for this type of gate. If negative, the gate can be controlled with any number of qubits or not controlled; disambiguation is done based on the number of qubit arguments. If zero, the gate is always non-controlled. If positive, the gate always has the specified number of control qubits.
epsilonThe maximum RMS error used when detecting incoming gate matrices. Defaults to 1 ppm.
ignore_global_phaseWhether global phase should be ignored when detecting incoming gate matrices.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the gate map handle is invalid.
Warning
If the key is equal to a the key for a previously added converter, the previous converter is silently overwritten.
Note
If you get template errors, ensure that your Unbound type has a move constructor.

Definition at line 4847 of file dqcsim.

◆ with_unitary() [2/6]

template<class Unbound , class Bound = Unbound>
GateMap&& dqcsim::wrap::GateMap< Unbound, Bound >::with_unitary ( const Unbound &  key,
PredefinedGate  gate,
int  num_controls = -1,
double  epsilon = 0.000001,
bool  ignore_global_phase = true 
)
inline

Adds a unitary gate mapping for the given DQCsim-defined gate.

Parameters
keyThe Unbound object that refers to this type of gate in your representation.
gateThe predefined DQCsim gate to detect.
num_controlsThe number of control qubits for this type of gate. If negative, the gate can be controlled with any number of qubits or not controlled; disambiguation is done based on the number of qubit arguments. If zero, the gate is always non-controlled. If positive, the gate always has the specified number of control qubits.
epsilonThe maximum RMS error used when detecting incoming gate matrices. Defaults to 1 ppm.
ignore_global_phaseWhether global phase should be ignored when detecting incoming gate matrices.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the gate map handle is invalid.
Warning
If the key is equal to a the key for a previously added converter, the previous converter is silently overwritten.
Note
If you get template errors, ensure that your Unbound type has a copy constructor.

Definition at line 4888 of file dqcsim.

◆ with_unitary() [3/6]

template<class Unbound , class Bound = Unbound>
GateMap&& dqcsim::wrap::GateMap< Unbound, Bound >::with_unitary ( Unbound &&  key,
Matrix &&  matrix,
int  num_controls = -1,
double  epsilon = 0.000001,
bool  ignore_global_phase = true 
)
inline

Adds a unitary gate mapping for the given unitary matrix.

Parameters
keyThe Unbound object that refers to this type of gate in your representation.
matrixThe matrix to detect.
num_controlsThe number of control qubits for this type of gate. If negative, the gate can be controlled with any number of qubits or not controlled; disambiguation is done based on the number of qubit arguments. If zero, the gate is always non-controlled. If positive, the gate always has the specified number of control qubits.
epsilonThe maximum RMS error used when detecting incoming gate matrices. Defaults to 1 ppm.
ignore_global_phaseWhether global phase should be ignored when detecting incoming gate matrices.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the gate map handle is invalid.
Warning
If the key is equal to a the key for a previously added converter, the previous converter is silently overwritten.
Note
If you get template errors, ensure that your Unbound type has a move constructor.

Definition at line 4929 of file dqcsim.

◆ with_unitary() [4/6]

template<class Unbound , class Bound = Unbound>
GateMap&& dqcsim::wrap::GateMap< Unbound, Bound >::with_unitary ( const Unbound &  key,
const Matrix matrix,
int  num_controls = -1,
double  epsilon = 0.000001,
bool  ignore_global_phase = true 
)
inline

Adds a unitary gate mapping for the given unitary matrix.

Parameters
keyThe Unbound object that refers to this type of gate in your representation.
matrixThe matrix to detect.
num_controlsThe number of control qubits for this type of gate. If negative, the gate can be controlled with any number of qubits or not controlled; disambiguation is done based on the number of qubit arguments. If zero, the gate is always non-controlled. If positive, the gate always has the specified number of control qubits.
epsilonThe maximum RMS error used when detecting incoming gate matrices. Defaults to 1 ppm.
ignore_global_phaseWhether global phase should be ignored when detecting incoming gate matrices.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the gate map handle is invalid.
Warning
If the key is equal to a the key for a previously added converter, the previous converter is silently overwritten.
Note
If you get template errors, ensure that your Unbound type has a copy constructor.

Definition at line 4970 of file dqcsim.

◆ with_unitary() [5/6]

template<class Unbound , class Bound = Unbound>
GateMap&& dqcsim::wrap::GateMap< Unbound, Bound >::with_unitary ( Unbound &&  key,
const std::shared_ptr< CustomUnitaryGateConverter > &  converter 
)
inline

Adds a custom unitary gate mapping.

Parameters
keyThe Unbound object that refers to this type of gate in your representation.
converterAn object deriving from CustomUnitaryGateConverter, implemented by you to handle the conversion, wrapped in a std::shared_ptr.
Exceptions
std::runtime_errorWhen the gate map handle is invalid.
Warning
If the key is equal to a the key for a previously added converter, the previous converter is silently overwritten.
Note
If you get template errors, ensure that your Unbound type has a move constructor.

Definition at line 5003 of file dqcsim.

◆ with_unitary() [6/6]

template<class Unbound , class Bound = Unbound>
GateMap&& dqcsim::wrap::GateMap< Unbound, Bound >::with_unitary ( const Unbound &  key,
const std::shared_ptr< CustomUnitaryGateConverter > &  converter 
)
inline

Adds a custom unitary gate mapping.

Parameters
keyThe Unbound object that refers to this type of gate in your representation.
converterAn object deriving from CustomUnitaryGateConverter, implemented by you to handle the conversion.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the gate map handle is invalid.
Warning
If the key is equal to a the key for a previously added converter, the previous converter is silently overwritten.
Note
If you get template errors, ensure that your Unbound type has a copy constructor.

Definition at line 5035 of file dqcsim.

◆ with_measure() [1/4]

template<class Unbound , class Bound = Unbound>
GateMap&& dqcsim::wrap::GateMap< Unbound, Bound >::with_measure ( Unbound &&  key,
PauliBasis  basis = PauliBasis::Z,
double  epsilon = 0.000001,
int  num_measures = -1 
)
inline

Adds a measurement gate mapping.

Parameters
keyThe Unbound object that refers to this type of gate in your representation.
basisThe measurement basis.
epsilonMaximum RMS deviation when detecting the above basis.
num_measuresThe number of measurement qubits for this type of gate. If negative, the gate can measure any number of qubits at a time. If positive, the gate always has the specified number of measurement qubits.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the gate map handle is invalid.
Warning
If the key is equal to a the key for a previously added converter, the previous converter is silently overwritten.
Note
If you get template errors, ensure that your Unbound type has a move constructor.

Definition at line 5071 of file dqcsim.

◆ with_measure() [2/4]

template<class Unbound , class Bound = Unbound>
GateMap&& dqcsim::wrap::GateMap< Unbound, Bound >::with_measure ( const Unbound &  key,
PauliBasis  basis = PauliBasis::Z,
double  epsilon = 0.000001,
int  num_measures = -1 
)
inline

Adds a measurement gate mapping.

Parameters
keyThe Unbound object that refers to this type of gate in your representation.
basisThe measurement basis.
epsilonMaximum RMS deviation when detecting the above basis.
num_measuresThe number of measurement qubits for this type of gate. If negative, the gate can measure any number of qubits at a time. If positive, the gate always has the specified number of measurement qubits.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the gate map handle is invalid.
Warning
If the key is equal to a the key for a previously added converter, the previous converter is silently overwritten.
Note
If you get template errors, ensure that your Unbound type has a copy constructor.

Definition at line 5106 of file dqcsim.

◆ with_measure() [3/4]

template<class Unbound , class Bound = Unbound>
GateMap&& dqcsim::wrap::GateMap< Unbound, Bound >::with_measure ( Unbound &&  key,
Matrix &&  basis,
double  epsilon = 0.000001,
int  num_measures = -1 
)
inline

Adds a measurement gate mapping.

Parameters
keyThe Unbound object that refers to this type of gate in your representation.
basisThe measurement basis.
epsilonMaximum RMS deviation when detecting the above basis.
num_measuresThe number of measurement qubits for this type of gate. If negative, the gate can measure any number of qubits at a time. If positive, the gate always has the specified number of measurement qubits.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the gate map handle is invalid.
Warning
If the key is equal to a the key for a previously added converter, the previous converter is silently overwritten.
Note
If you get template errors, ensure that your Unbound type has a move constructor.

Definition at line 5141 of file dqcsim.

◆ with_measure() [4/4]

template<class Unbound , class Bound = Unbound>
GateMap&& dqcsim::wrap::GateMap< Unbound, Bound >::with_measure ( const Unbound &  key,
const Matrix basis,
double  epsilon = 0.000001,
int  num_measures = -1 
)
inline

Adds a measurement gate mapping.

Parameters
keyThe Unbound object that refers to this type of gate in your representation.
basisThe measurement basis.
epsilonMaximum RMS deviation when detecting the above basis.
num_measuresThe number of measurement qubits for this type of gate. If negative, the gate can measure any number of qubits at a time. If positive, the gate always has the specified number of measurement qubits.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the gate map handle is invalid.
Warning
If the key is equal to a the key for a previously added converter, the previous converter is silently overwritten.
Note
If you get template errors, ensure that your Unbound type has a copy constructor.

Definition at line 5176 of file dqcsim.

◆ with_prep() [1/4]

template<class Unbound , class Bound = Unbound>
GateMap&& dqcsim::wrap::GateMap< Unbound, Bound >::with_prep ( Unbound &&  key,
PauliBasis  basis = PauliBasis::Z,
double  epsilon = 0.000001,
int  num_targets = -1 
)
inline

Adds a prep gate mapping.

Parameters
keyThe Unbound object that refers to this type of gate in your representation.
basisThe basis.
epsilonMaximum RMS deviation when detecting the above basis.
num_targetsThe number of target qubits for this type of gate. If negative, the gate can prepare any number of qubits at a time. If positive, the gate always has the specified number of target qubits.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the gate map handle is invalid.
Warning
If the key is equal to a the key for a previously added converter, the previous converter is silently overwritten.
Note
If you get template errors, ensure that your Unbound type has a move constructor.

Definition at line 5211 of file dqcsim.

◆ with_prep() [2/4]

template<class Unbound , class Bound = Unbound>
GateMap&& dqcsim::wrap::GateMap< Unbound, Bound >::with_prep ( const Unbound &  key,
PauliBasis  basis = PauliBasis::Z,
double  epsilon = 0.000001,
int  num_targets = -1 
)
inline

Adds a prep gate mapping.

Parameters
keyThe Unbound object that refers to this type of gate in your representation.
basisThe basis.
epsilonMaximum RMS deviation when detecting the above basis.
num_targetsThe number of target qubits for this type of gate. If negative, the gate can prepare any number of qubits at a time. If positive, the gate always has the specified number of target qubits.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the gate map handle is invalid.
Warning
If the key is equal to a the key for a previously added converter, the previous converter is silently overwritten.
Note
If you get template errors, ensure that your Unbound type has a move constructor.

Definition at line 5246 of file dqcsim.

◆ with_prep() [3/4]

template<class Unbound , class Bound = Unbound>
GateMap&& dqcsim::wrap::GateMap< Unbound, Bound >::with_prep ( Unbound &&  key,
Matrix &&  basis,
double  epsilon = 0.000001,
int  num_targets = -1 
)
inline

Adds a prep gate mapping.

Parameters
keyThe Unbound object that refers to this type of gate in your representation.
basisThe basis.
epsilonMaximum RMS deviation when detecting the above basis.
num_targetsThe number of target qubits for this type of gate. If negative, the gate can prepare any number of qubits at a time. If positive, the gate always has the specified number of target qubits.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the gate map handle is invalid.
Warning
If the key is equal to a the key for a previously added converter, the previous converter is silently overwritten.
Note
If you get template errors, ensure that your Unbound type has a move constructor.

Definition at line 5281 of file dqcsim.

◆ with_prep() [4/4]

template<class Unbound , class Bound = Unbound>
GateMap&& dqcsim::wrap::GateMap< Unbound, Bound >::with_prep ( const Unbound &  key,
const Matrix basis,
double  epsilon = 0.000001,
int  num_targets = -1 
)
inline

Adds a prep gate mapping.

Parameters
keyThe Unbound object that refers to this type of gate in your representation.
basisThe basis.
epsilonMaximum RMS deviation when detecting the above basis.
num_targetsThe number of target qubits for this type of gate. If negative, the gate can prepare any number of qubits at a time. If positive, the gate always has the specified number of target qubits.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the gate map handle is invalid.
Warning
If the key is equal to a the key for a previously added converter, the previous converter is silently overwritten.
Note
If you get template errors, ensure that your Unbound type has a move constructor.

Definition at line 5316 of file dqcsim.

◆ with_custom() [1/2]

template<class Unbound , class Bound = Unbound>
GateMap&& dqcsim::wrap::GateMap< Unbound, Bound >::with_custom ( Unbound &&  key,
const std::shared_ptr< CustomGateConverter > &  converter 
)
inline

Adds a custom gate mapping.

Parameters
keyThe Unbound object that refers to this type of gate in your representation.
converterAn object deriving from CustomGateConverter, implemented by you to handle the conversion, wrapped in a std::shared_ptr.
Exceptions
std::runtime_errorWhen the gate map handle is invalid.
Warning
If the key is equal to a the key for a previously added converter, the previous converter is silently overwritten.
Note
If you get template errors, ensure that your Unbound type has a move constructor.

Definition at line 5347 of file dqcsim.

◆ with_custom() [2/2]

template<class Unbound , class Bound = Unbound>
GateMap&& dqcsim::wrap::GateMap< Unbound, Bound >::with_custom ( const Unbound &  key,
const std::shared_ptr< CustomGateConverter > &  converter 
)
inline

Adds a custom gate mapping.

Parameters
keyThe Unbound object that refers to this type of gate in your representation.
converterAn object deriving from CustomGateConverter, implemented by you to handle the conversion.
Returns
&self, to continue building.
Exceptions
std::runtime_errorWhen the gate map handle is invalid.
Warning
If the key is equal to a the key for a previously added converter, the previous converter is silently overwritten.
Note
If you get template errors, ensure that your Unbound type has a copy constructor.

Definition at line 5379 of file dqcsim.

◆ detect()

template<class Unbound , class Bound = Unbound>
bool dqcsim::wrap::GateMap< Unbound, Bound >::detect ( const Gate gate,
const Unbound **  unbound,
QubitSet qubits,
ArbData params 
)
inline

Uses the gate map to convert an incoming DQCsim gate to the plugin's Unbound representation.

Parameters
gateThe gate to detect.
unboundIf non-null and the incoming gate matches one of the detectors, this receives a const pointer to the internal Unbound record corresponding with the first detector that matched. If there is no match, this is left unchanged, allowing a default value to be supplied.
qubitsIf non-null and the incoming gate matches one of the detectors, the given QubitSet is set to the qubit arguments for the matched gate.
paramsIf non-null and the incoming gate matches one of the detectors, the given ArbData is set to the parameterization data object returned by the detector function.
Returns
Whether a match occurred.
Exceptions
std::runtime_errorWhen one of the handles is invalid or one of the detector functions returned an error.

Definition at line 5417 of file dqcsim.

◆ construct() [1/4]

template<class Unbound , class Bound = Unbound>
Gate dqcsim::wrap::GateMap< Unbound, Bound >::construct ( const Unbound &  unbound,
QubitSet &&  qubits,
ArbData &&  params 
)
inline

Uses a gate map object to construct a DQCsim gate from the plugin's representation.

Parameters
unboundThe plugin's representation of the unbound gate.
qubitsThe qubit arguments for the gate.
paramsThe parameterization data for the gate.
Returns
The constructed DQCsim gate.
Exceptions
std::runtime_errorWhen unbound does not map to any converter function, the converter function returns an error, or one of the involved handles is invalid.

Definition at line 5451 of file dqcsim.

◆ construct() [2/4]

template<class Unbound , class Bound = Unbound>
Gate dqcsim::wrap::GateMap< Unbound, Bound >::construct ( const Unbound &  unbound,
const QubitSet qubits,
const ArbData params 
)
inline

Uses a gate map object to construct a DQCsim gate from the plugin's representation.

Parameters
unboundThe plugin's representation of the unbound gate.
qubitsThe qubit arguments for the gate.
paramsThe parameterization data for the gate.
Returns
The constructed DQCsim gate.
Exceptions
std::runtime_errorWhen unbound does not map to any converter function, the converter function returns an error, or one of the involved handles is invalid.

Definition at line 5476 of file dqcsim.

◆ construct() [3/4]

template<class Unbound , class Bound = Unbound>
Gate dqcsim::wrap::GateMap< Unbound, Bound >::construct ( const Unbound &  unbound,
QubitSet &&  qubits 
)
inline

Uses a gate map object to construct a DQCsim gate from the plugin's representation.

Parameters
unboundThe plugin's representation of the unbound gate.
qubitsThe qubit arguments for the gate.
Exceptions
std::runtime_errorWhen unbound does not map to any converter function, the converter function returns an error, or one of the involved handles is invalid.

Definition at line 5494 of file dqcsim.

◆ construct() [4/4]

template<class Unbound , class Bound = Unbound>
Gate dqcsim::wrap::GateMap< Unbound, Bound >::construct ( const Unbound &  unbound,
const QubitSet qubits 
)
inline

Uses a gate map object to construct a DQCsim gate from the plugin's representation.

Parameters
unboundThe plugin's representation of the unbound gate.
qubitsThe qubit arguments for the gate.
Returns
The constructed DQCsim gate.
Exceptions
std::runtime_errorWhen unbound does not map to any converter function, the converter function returns an error, or one of the involved handles is invalid.

Definition at line 5517 of file dqcsim.

◆ convert() [1/2]

template<class Unbound , class Bound = Unbound>
Bound dqcsim::wrap::GateMap< Unbound, Bound >::convert ( const Gate gate)
inline

Wrapper function for detect(), converting from DQCsim's gate representation directly to the plugin's Bound gate type.

Parameters
gateThe gate to convert.
Returns
The converted gate.
Exceptions
std::runtime_errorWhen the DQCsim gate cannot be represented in the plugin's representation, one of the handles is invalid, or one of the detector functions returned an error.
Note
If you get template errors, ensure that Bound Unbound::bind(QubitSet &&qubits, ArbData &&params) const exists. This method is used to convert from the return values of detect() to an instance of Bound.

Definition at line 5538 of file dqcsim.

◆ convert() [2/2]

template<class Unbound , class Bound = Unbound>
Gate dqcsim::wrap::GateMap< Unbound, Bound >::convert ( const Bound &  bound)
inline

Wrapper function for construct(), converting directly from the plugin's Bound gate type to DQCsim's gate representation.

Parameters
boundThe plugin's gate representation.
Returns
DQCsim's gate representation for the above.
Exceptions
std::runtime_errorWhen bound does not map to any converter function, the converter function returns an error, or one of the involved handles is invalid.
Note
If you get template errors, ensure that Unbound Bound::get_unbound() const, QubitSet Bound::get_qubits() const, and ArbData Bound::get_params() const are implemented. These methods are used to convert from the Bound gate to the inputs of construct().

Definition at line 5563 of file dqcsim.


The documentation for this class was generated from the following file: