sys-sage
|
Represents a quantum gate in a quantum circuit. More...
#include <QuantumGate.hpp>
Public Member Functions | |
QuantumGate () | |
Default constructor for QuantumGate. | |
QuantumGate (size_t _gate_size) | |
Constructor that initializes a quantum gate with a specified size. | |
QuantumGate (size_t _gate_size, std::string _name, double _fidelity, std::string _unitary) | |
Constructor that initializes a quantum gate with specific properties. | |
QuantumGate (size_t _gate_size, const std::vector< Qubit * > &_qubits) | |
Constructor that initializes a quantum gate with a list of qubits. | |
QuantumGate (size_t _gate_size, const std::vector< Qubit * > &_qubits, std::string _name, double _fidelity, std::string _unitary) | |
Constructor that initializes a quantum gate with detailed properties and qubits. | |
QuantumGate (const std::vector< Component * > &components, int _id=0, bool _ordered=true, size_t _gate_size=0, std::string _name="", int _gate_length=0, QuantumGateType::type _gate_type=QuantumGateType::Unknown, double _fidelity=0, std::string _unitary="") | |
Constructor for advanced initialization, including all properties and components. | |
void | SetGateProperties (std::string _name, double _fidelity, std::string _unitary) |
Sets the properties of the quantum gate. | |
void | SetGateCouplingMap (std::vector< std::vector< Qubit * > > _coupling_mapping) |
Sets the coupling map for the quantum gate. | |
void | SetAdditionalProperties () |
Sets additional properties for the quantum gate. | |
void | SetQuantumGateType () |
Sets the type of the quantum gate. | |
QuantumGateType::type | GetQuantumGateType () const |
Gets the type of the quantum gate. | |
double | GetFidelity () const |
Gets the fidelity of the quantum gate. | |
size_t | GetGateSize () const |
Gets the size of the quantum gate. | |
void | SetGateSize (size_t gateSize) |
Sets the size of the quantum gate. | |
void | SetGateLength (int GateLength) |
Sets the length of the quantum gate operation (e.g., in time or circuit depth). | |
const std::string & | GetUnitary () const |
Gets the unitary matrix of the quantum gate. | |
void | SetName (std::string _name) |
Sets the name of the relationship. | |
std::string | GetName () const |
Gets the name of the relationship. | |
void | Print () const override |
Prints the details of the quantum gate. | |
![]() | |
Relation (const std::vector< Component * > &components, int _id=0, bool _ordered=true) | |
Construct a new Relation object. | |
void | SetId (int _id) |
Sets the id of the relationship. | |
int | GetId () const |
Gets the id of the relationship. | |
RelationType::type | GetType () const |
Get the type of the relation. | |
std::string | GetTypeStr () const |
Return a human-readable name of the relation type. | |
bool | IsOrdered () const |
Check if this relation treats component order as meaningful. | |
bool | ContainsComponent (Component *c) const |
Check whether the given component is part of this relation. | |
Component * | GetComponent (int index) const |
Get the component at a specific position. | |
const std::vector< Component * > & | GetComponents () const |
Access the list of components. | |
void | AddComponent (Component *c) |
Add a new component to the relation. | |
int | UpdateComponent (int index, Component *_new_component) |
Replace a component at the given index. | |
int | UpdateComponent (Component *_old_component, Component *_new_component) |
Replace the first occurrence of a given component. | |
virtual void | Delete () |
Virtual function to delete the relation. | |
~Relation ()=default | |
Destructor for the Relation class. | |
Additional Inherited Members | |
![]() | |
std::map< std::string, void * > | attrib |
![]() | |
bool | ordered |
Whether order in the component list is meaningful. | |
int | id |
The id of the relationship. | |
RelationType::type | type |
The type of the relationship (see RelationType::type). | |
std::vector< Component * > | components |
A vector of components associated with the relationship. | |
Represents a quantum gate in a quantum circuit.
This class extends the Relation class to model quantum gates. It includes various properties specific to quantum gates, such as gate size, fidelity, and unitary matrix. The class also handles the coupling map and additional properties related to quantum gate operations. QuantumGate objects can represent both single- and multi-qubit gates, and are used to describe the logical operations that can be performed on a quantum backend.
sys_sage::QuantumGate::QuantumGate | ( | ) |
Default constructor for QuantumGate.
Initializes a quantum gate with default properties.
sys_sage::QuantumGate::QuantumGate | ( | size_t | _gate_size | ) |
Constructor that initializes a quantum gate with a specified size.
_gate_size | The number of qubits this gate operates on. |
sys_sage::QuantumGate::QuantumGate | ( | size_t | _gate_size, |
std::string | _name, | ||
double | _fidelity, | ||
std::string | _unitary ) |
Constructor that initializes a quantum gate with specific properties.
_gate_size | The number of qubits this gate operates on. |
_name | The name of the quantum gate. |
_fidelity | The fidelity of the quantum gate. |
_unitary | The unitary matrix representing the quantum gate operation. |
sys_sage::QuantumGate::QuantumGate | ( | size_t | _gate_size, |
const std::vector< Qubit * > & | _qubits ) |
Constructor that initializes a quantum gate with a list of qubits.
_gate_size | The number of qubits this gate operates on. |
_qubits | A vector of pointers to Qubit objects that the gate operates on. |
sys_sage::QuantumGate::QuantumGate | ( | size_t | _gate_size, |
const std::vector< Qubit * > & | _qubits, | ||
std::string | _name, | ||
double | _fidelity, | ||
std::string | _unitary ) |
Constructor that initializes a quantum gate with detailed properties and qubits.
_gate_size | The number of qubits this gate operates on. |
_qubits | A vector of pointers to Qubit objects that the gate operates on. |
_name | The name of the quantum gate. |
_fidelity | The fidelity of the quantum gate. |
_unitary | The unitary matrix representing the quantum gate operation. |
sys_sage::QuantumGate::QuantumGate | ( | const std::vector< Component * > & | components, |
int | _id = 0, | ||
bool | _ordered = true, | ||
size_t | _gate_size = 0, | ||
std::string | _name = "", | ||
int | _gate_length = 0, | ||
QuantumGateType::type | _gate_type = QuantumGateType::Unknown, | ||
double | _fidelity = 0, | ||
std::string | _unitary = "" ) |
Constructor for advanced initialization, including all properties and components.
components | Vector of pointers to components (qubits) the gate acts on. |
_id | Optional relation ID (default 0). |
_ordered | Whether the gate is ordered (default true). |
_gate_size | The number of qubits this gate operates on. |
_name | The name of the quantum gate. |
_gate_length | The length of the gate operation (e.g., in time or circuit depth). |
_gate_type | The type of the quantum gate (see QuantumGateType::type). |
_fidelity | The fidelity of the quantum gate. |
_unitary | The unitary matrix representing the quantum gate operation. |
double sys_sage::QuantumGate::GetFidelity | ( | ) | const |
Gets the fidelity of the quantum gate.
size_t sys_sage::QuantumGate::GetGateSize | ( | ) | const |
Gets the size of the quantum gate.
std::string sys_sage::QuantumGate::GetName | ( | ) | const |
Gets the name of the relationship.
sys_sage::QuantumGateType::type sys_sage::QuantumGate::GetQuantumGateType | ( | ) | const |
Gets the type of the quantum gate.
const std::string & sys_sage::QuantumGate::GetUnitary | ( | ) | const |
Gets the unitary matrix of the quantum gate.
|
overridevirtual |
Prints the details of the quantum gate.
This method overrides the Print function in the Relation class to provide specific printing behavior for quantum gates.
Reimplemented from sys_sage::Relation.
void sys_sage::QuantumGate::SetAdditionalProperties | ( | ) |
Sets additional properties for the quantum gate.
This function allows setting properties that are not part of the core quantum gate attributes.
void sys_sage::QuantumGate::SetGateCouplingMap | ( | std::vector< std::vector< Qubit * > > | _coupling_mapping | ) |
Sets the coupling map for the quantum gate.
_coupling_mapping | A vector of vectors of pointers to Qubit objects representing the coupling map. |
void sys_sage::QuantumGate::SetGateLength | ( | int | GateLength | ) |
Sets the length of the quantum gate operation (e.g., in time or circuit depth).
GateLength | The length of the gate operation. |
void sys_sage::QuantumGate::SetGateProperties | ( | std::string | _name, |
double | _fidelity, | ||
std::string | _unitary ) |
Sets the properties of the quantum gate.
_name | The name of the quantum gate. |
_fidelity | The fidelity of the quantum gate. |
_unitary | The unitary matrix representing the quantum gate operation. |
void sys_sage::QuantumGate::SetGateSize | ( | size_t | gateSize | ) |
Sets the size of the quantum gate.
gateSize | The number of qubits this gate operates on. |
void sys_sage::QuantumGate::SetName | ( | std::string | _name | ) |
Sets the name of the relationship.
_name | The name of the relationship to set. |
void sys_sage::QuantumGate::SetQuantumGateType | ( | ) |
Sets the type of the quantum gate.
Sets the specific type for quantum gates.