DQCsim
Public Member Functions | Friends | List of all members
dqcsim::wrap::CustomUnitaryGateConverter Class Reference

Class that you can inherit from to make your own unitary gate converter for use within DQCsim. More...

Public Member Functions

virtual bool detect (Matrix &&matrix, ssize_t num_controls, ArbData &params) const
 The to-be-implemented detector function. More...
 
virtual Matrix construct (ArbData &params, ssize_t &num_controls) const
 The to-be-implemented constructor function. More...
 

Friends

template<class Unbound , class Bound >
class GateMap
 

Detailed Description

Class that you can inherit from to make your own unitary gate converter for use within DQCsim.

Definition at line 4606 of file dqcsim.

Member Function Documentation

◆ detect()

virtual bool dqcsim::wrap::CustomUnitaryGateConverter::detect ( Matrix &&  matrix,
ssize_t  num_controls,
ArbData params 
) const
inlinevirtual

The to-be-implemented detector function.

Parameters
matrixThe matrix to match.
num_controlsThe number of control qubits associated with the matrix; these qubits are implicit in the matrix. That is, to get the full matrix, you need to expand the given matrix with this many qubits.
paramsIf the gate matches, its parameters should be pushed into or assigned to this ArbData. This data object is initially a copy of the incoming gate's ArbData attachment.
Returns
Whether the incoming gate matches.
Exceptions
std::exceptionWhen an exception is thrown, its what() is returned to the user immediately. That is, any remaining detectors are not called.

The default implementation simply returns false, i.e. it never matches.

Definition at line 4688 of file dqcsim.

◆ construct()

virtual Matrix dqcsim::wrap::CustomUnitaryGateConverter::construct ( ArbData params,
ssize_t &  num_controls 
) const
inlinevirtual

The to-be-implemented constructor function.

Parameters
paramsThe parameters for the gate. Anything left in here is attached to the gate.
num_controlsIf this gate only accepts a specific number of control qubits during construction, write the expected amount here. Assigning a negative number or not assigning it means there is no constraint.
Returns
The constructed matrix.
Exceptions
std::exceptionWhen an exception is thrown, its what() is returned to the user.

The default implementation throws an exception indicating that no constructor is defined.

Definition at line 4708 of file dqcsim.


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