QPanda3  0.1.0
Supported by OriginQ
Loading...
Searching...
No Matches
pyqpanda3.core.QGate Class Reference
Inheritance diagram for pyqpanda3.core.QGate:

Public Member Functions

None __init__ (self, *args, **kwargs)
 Initialize self.
 
QGate add_control (self, int qubit)
 add_control(self: core.QGate, qubit: int) -> core.QGate
 
None clear_control (self)
 clear_control(self: core.QGate) -> None
 
QGate control (self, int qubit)
 control(*args, **kwargs) Overloaded function.
 
QGate control (self, list[int] controls)
 control(*args, **kwargs) Overloaded function.
 
list[int] control_qubits (self)
 control_qubits(self: core.QGate) -> list[int]
 
QGate dagger (self)
 dagger(self: core.QGate) -> core.QGate
 
GateType gate_type (self)
 gate_type(self: core.QGate) -> core.GateType
 
bool is_dagger (self)
 is_dagger(self: core.QGate) -> bool
 
numpy.ndarray[numpy.complex128[m, n]] matrix (self, bool expanded=...)
 matrix(self: core.QGate, expanded: bool = False) -> numpy.ndarray[numpy.complex128[m, n]]
 
str name (self)
 name(self: core.QGate) -> str
 
list[float] parameters (self)
 parameters(self: core.QGate) -> list[float]
 
QGate power (self, float k)
 power(self: core.QGate, k: float) -> core.QGate
 
list[int] qubits (self)
 qubits(self: core.QGate) -> list[int]
 
int qubits_num (self)
 qubits_num(self: core.QGate) -> int
 
None set_parameters (self, list[float] params)
 set_parameters(self: core.QGate, params: list[float]) -> None
 
list[int] target_qubits (self)
 target_qubits(self: core.QGate) -> list[int]
 
- Public Member Functions inherited from pyqpanda3.core.Operation
bool is_controlled (self)
 is_controlled(self: core.Operation) -> bool
 

Additional Inherited Members

- Static Public Attributes inherited from pyqpanda3.core.Operation
list m_control_qubits [int]
 
list m_measure_cbits [int]
 
list m_target_qubits [int]
 

Constructor & Destructor Documentation

◆ __init__()

None pyqpanda3.core.QGate.__init__ ( self,
* args,
** kwargs )

Initialize self.

See help(type(self)) for accurate signature.

Reimplemented from pyqpanda3.core.Operation.

Member Function Documentation

◆ add_control()

QGate pyqpanda3.core.QGate.add_control ( self,
int qubit )

add_control(self: core.QGate, qubit: int) -> core.QGate

Add a control qubit.

Parameters
qubitThe control qubit index to add.
Returns
Reference to this modified QGate.

◆ clear_control()

None pyqpanda3.core.QGate.clear_control ( self)

clear_control(self: core.QGate) -> None

Clear all control qubits from this gate.

◆ control() [1/2]

QGate pyqpanda3.core.QGate.control ( self,
int qubit )

control(*args, **kwargs) Overloaded function.

  1. control(self: core.QGate, qubit: int) -> core.QGate

Get a controlled version of this gate with the specified control qubit.

Parameters
qubitThe control qubit index.
Returns
A new QGate instance representing the controlled gate.
  1. control(self: core.QGate, controls: list[int]) -> core.QGate

Get a controlled version of this gate with multiple control qubits.

Parameters
controlsA vector of control qubit indices.
Returns
A new QGate instance representing the controlled gate.

◆ control() [2/2]

QGate pyqpanda3.core.QGate.control ( self,
list[int] controls )

control(*args, **kwargs) Overloaded function.

  1. control(self: core.QGate, qubit: int) -> core.QGate

Get a controlled version of this gate with the specified control qubit.

Parameters
qubitThe control qubit index.
Returns
A new QGate instance representing the controlled gate.
  1. control(self: core.QGate, controls: list[int]) -> core.QGate

Get a controlled version of this gate with multiple control qubits.

Parameters
controlsA vector of control qubit indices.
Returns
A new QGate instance representing the controlled gate.

◆ control_qubits()

list[int] pyqpanda3.core.QGate.control_qubits ( self)

control_qubits(self: core.QGate) -> list[int]

Get the control qubits for this gate.

Returns
A vector of control qubit indices.

◆ dagger()

QGate pyqpanda3.core.QGate.dagger ( self)

dagger(self: core.QGate) -> core.QGate

Get the adjoint (dagger) of this gate.

Returns
A new QGate instance representing the dagger.

◆ gate_type()

GateType pyqpanda3.core.QGate.gate_type ( self)

gate_type(self: core.QGate) -> core.GateType

Get the type of this gate.

Returns
The GateType of this gate.

◆ is_dagger()

bool pyqpanda3.core.QGate.is_dagger ( self)

is_dagger(self: core.QGate) -> bool

Check if this gate is a dagger.

Returns
True if this gate is a dagger, false otherwise.

◆ matrix()

numpy.ndarray[numpy.complex128[m, n]] pyqpanda3.core.QGate.matrix ( self,
bool expanded = ... )

matrix(self: core.QGate, expanded: bool = False) -> numpy.ndarray[numpy.complex128[m, n]]

Get the matrix representation of this gate.

Parameters
expandedWhether to return the expanded matrix.
Returns
The matrix representation as a matrixXcd.

◆ name()

str pyqpanda3.core.QGate.name ( self)

name(self: core.QGate) -> str

Get the name of this gate.

Returns
The name as a string.

◆ parameters()

list[float] pyqpanda3.core.QGate.parameters ( self)

parameters(self: core.QGate) -> list[float]

Get the parameters of this gate.

Returns
A vector of parameters.

◆ power()

QGate pyqpanda3.core.QGate.power ( self,
float k )

power(self: core.QGate, k: float) -> core.QGate

Get this gate raised to a power.

Parameters
kThe exponent to raise this gate to.
Returns
A new QGate instance representing the power.

◆ qubits()

list[int] pyqpanda3.core.QGate.qubits ( self)

qubits(self: core.QGate) -> list[int]

Get the target qubits.

Returns
A vector of target qubit indices.

◆ qubits_num()

int pyqpanda3.core.QGate.qubits_num ( self)

qubits_num(self: core.QGate) -> int

Get the number of qubits that this gate acts on.

Returns
Number of qubits.

◆ set_parameters()

None pyqpanda3.core.QGate.set_parameters ( self,
list[float] params )

set_parameters(self: core.QGate, params: list[float]) -> None

Set the parameters for this gate.

Parameters
paramsA vector of parameters to set.

◆ target_qubits()

list[int] pyqpanda3.core.QGate.target_qubits ( self)

target_qubits(self: core.QGate) -> list[int]

Get the target qubits for this gate.

Returns
A vector of target qubit indices.

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