QPanda3  0.1.0
Supported by OriginQ
Loading...
Searching...
No Matches
pyqpanda3.core Namespace Reference

Classes

class  CBit
 
class  CPUQVM
 
class  DAGNode
 
class  DAGQCircuit
 
class  DensityMatrixSimulator
 
class  GateType
 
class  GPUQVM
 
class  NoiseModel
 
class  NoiseOpType
 
class  Operation
 
class  OpType
 
class  PartialAmplitudeQVM
 
class  PIC_TYPE
 
class  QCircuit
 
class  QGate
 
class  QMeasure
 
class  QProg
 
class  QResult
 
class  QuantumError
 
class  Qubit
 
class  Stabilizer
 
class  StabilizerResult
 
class  VQGate
 

Functions

QGate BARRIER (list[int] qubits)
 BARRIER(qubits: list[int]) -> core.QGate.
 
QGate CNOT (int qubit1, int qubit2)
 CNOT(qubit1: int, qubit2: int) -> core.QGate.
 
QGate CP (int control, int target, float theta)
 CP(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] CP (int control_qbit_idx, int target_qbit_idx, list[int] param)
 CP(*args, **kwargs) Overloaded function.
 
QGate CR (int control, int target, float theta)
 CR(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] CR (int control_qbit_idx, int target_qbit_idx, list[int] param)
 CR(*args, **kwargs) Overloaded function.
 
QGate CU (int control, int target, float theta, float phi, float _lambda, float gamma)
 CU(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] CU (int control_qbit_idx, int target_qbit_idx, list[int] param1, float|list[int] param2, float|list[int] param3, float|list[int] param4)
 CU(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] CU (int control_qbit_idx, int target_qbit_idx, float param1, list[int] param2, float|list[int] param3, float|list[int] param4)
 CU(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] CU (int control_qbit_idx, int target_qbit_idx, float param1, float param2, list[int] param3, float|list[int] param4)
 CU(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] CU (int control_qbit_idx, int target_qbit_idx, float param1, float param2, float param3, list[int] param4)
 CU(*args, **kwargs) Overloaded function.
 
QGate CZ (int qubit1, int qubit2)
 CZ(qubit1: int, qubit2: int) -> core.QGate.
 
QGate H (int qubit)
 H(qubit: int) -> core.QGate.
 
QGate I (int qubit)
 I(qubit: int) -> core.QGate.
 
QGate ISWAP (int qubit1, int qubit2)
 ISWAP(qubit1: int, qubit2: int) -> core.QGate.
 
QGate Oracle (list[int] qubits, numpy.ndarray[numpy.complex128[m, n]] matrix)
 Oracle(qubits: list[int], matrix: numpy.ndarray[numpy.complex128[m, n]]) -> core.QGate.
 
QGate P (int qubit, float theta)
 P(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] P (int qbit_idx, list[int] param)
 P(*args, **kwargs) Overloaded function.
 
QCircuit QV (int num_qubit, int depth, int seed)
 QV(num_qubit: int, depth: int, seed: int) -> core.QCircuit.
 
QGate RPHI (int control, float theta, float phi)
 RPHI(control: int, theta: float, phi: float) -> core.QGate.
 
tuple[VQGate, list[float|list[int]]] RPhi (int qbit_idx, list[int] param1, float|list[int] param2)
 RPhi(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] RPhi (int qbit_idx, float param1, list[int] param2)
 RPhi(*args, **kwargs) Overloaded function.
 
QGate RX (int qubit, float theta)
 RX(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] RX (int qbit_idx, list[int] param)
 RX(*args, **kwargs) Overloaded function.
 
QGate RXX (int control, int target, float theta)
 RXX(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] RXX (int control_qbit_idx, int target_qbit_idx, list[int] param)
 RXX(*args, **kwargs) Overloaded function.
 
QGate RY (int qubit, float theta)
 RY(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] RY (int qbit_idx, list[int] param)
 RY(*args, **kwargs) Overloaded function.
 
QGate RYY (int control, int target, float theta)
 RYY(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] RYY (int control_qbit_idx, int target_qbit_idx, list[int] param)
 RYY(*args, **kwargs) Overloaded function.
 
QGate RZ (int qubit, float theta)
 RZ(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] RZ (int qbit_idx, list[int] param)
 RZ(*args, **kwargs) Overloaded function.
 
QGate RZX (int control, int target, float theta)
 RZX(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] RZX (int control_qbit_idx, int target_qbit_idx, list[int] param)
 RZX(*args, **kwargs) Overloaded function.
 
QGate RZZ (int control, int target, float theta)
 RZZ(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] RZZ (int control_qbit_idx, int target_qbit_idx, list[int] param)
 RZZ(*args, **kwargs) Overloaded function.
 
QGate S (int qubit)
 S(qubit: int) -> core.QGate.
 
QGate SWAP (int qubit1, int qubit2)
 SWAP(qubit1: int, qubit2: int) -> core.QGate.
 
QGate T (int qubit)
 T(qubit: int) -> core.QGate.
 
QGate TOFFOLI (int qubit1, int qubit2, int qubit3)
 TOFFOLI(qubit1: int, qubit2: int, qubit3: int) -> core.QGate.
 
QGate U1 (int qubit, float theta)
 U1(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] U1 (int qbit_idx, list[int] param)
 U1(*args, **kwargs) Overloaded function.
 
QGate U2 (int qubit, float theta, float phi)
 U2(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] U2 (int qbit_idx, list[int] param1, float|list[int] param2)
 U2(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] U2 (int qbit_idx, float param1, list[int] param2)
 U2(*args, **kwargs) Overloaded function.
 
QGate U3 (int qubit, float theta, float phi, float _lambda)
 U3(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] U3 (int qbit_idx, list[int] param1, float|list[int] param2, float|list[int] param3)
 U3(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] U3 (int qbit_idx, float param1, list[int] param2, float|list[int] param3)
 U3(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] U3 (int qbit_idx, float param1, float param2, list[int] param3)
 U3(*args, **kwargs) Overloaded function.
 
QGate U4 (int qubit, float theta, float phi, float _lambda, float gamma)
 U4(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] U4 (int qbit_idx, list[int] param1, float|list[int] param2, float|list[int] param3, float|list[int] param4)
 U4(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] U4 (int qbit_idx, float param1, list[int] param2, float|list[int] param3, float|list[int] param4)
 U4(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] U4 (int qbit_idx, float param1, float param2, list[int] param3, float|list[int] param4)
 U4(*args, **kwargs) Overloaded function.
 
tuple[VQGate, list[float|list[int]]] U4 (int qbit_idx, float param1, float param2, float param3, list[int] param4)
 U4(*args, **kwargs) Overloaded function.
 
QGate X (int qubit)
 X(qubit: int) -> core.QGate.
 
QGate X1 (int qubit)
 X1(qubit: int) -> core.QGate.
 
QGate Y (int qubit)
 Y(qubit: int) -> core.QGate.
 
QGate Y1 (int qubit)
 Y1(qubit: int) -> core.QGate.
 
QGate Z (int qubit)
 Z(qubit: int) -> core.QGate.
 
QGate Z1 (int qubit)
 Z1(qubit: int) -> core.QGate.
 
QuantumError amplitude_damping_error (float prob)
 amplitude_damping_error(prob: float) -> core.QuantumError
 
QGate create_gate (str gate_name, list[int] qubits, list[float] params)
 create_gate(gate_name: str, qubits: list[int], params: list[float]) -> core.QGate
 
QuantumError decoherence_error (float arg0, float arg1, float arg2)
 decoherence_error(arg0: float, arg1: float, arg2: float) -> core.QuantumError
 
QuantumError depolarizing_error (float prob)
 depolarizing_error(prob: float) -> core.QuantumError
 
QProg direct_twirl (QProg arg0, str arg1, int arg2)
 direct_twirl(arg0: core.QProg, arg1: str, arg2: int) -> core.QProg
 
str draw_qprog (QProg qprog, PIC_TYPE p=..., dict[str, int] expend_map=..., bool param_show=..., bool with_logo=..., int line_length=..., str output_file=..., str encode=...)
 draw_qprog(*args, **kwargs) Overloaded function.
 
str draw_qprog (QCircuit circuit, PIC_TYPE p=..., dict[str, int] expend_map=..., bool param_show=..., bool with_logo=..., int line_length=..., str output_file=..., str encode=...)
 draw_qprog(*args, **kwargs) Overloaded function.
 
QMeasure measure (int qubit, int cbit)
 measure(qubit: int, cbit: int) -> core.QMeasure
 
QuantumError pauli_x_error (float prob)
 pauli_x_error(prob: float) -> core.QuantumError
 
QuantumError pauli_y_error (float prob)
 pauli_y_error(prob: float) -> core.QuantumError
 
QuantumError pauli_z_error (float prob)
 pauli_z_error(prob: float) -> core.QuantumError
 
QuantumError phase_damping_error (float prob)
 phase_damping_error(prob: float) -> core.QuantumError
 
QCircuit random_qcircuit (list[int] qubits, int depth, list[str] gate_type)
 random_qcircuit(qubits: list[int], depth: int, gate_type: list[str]) -> core.QCircuit
 
None set_print_options (int precision=..., int param_show=..., int linewidth=...)
 set_print_options(precision: int = 8, param_show: int = True, linewidth: int = 100) -> None
 

Function Documentation

◆ amplitude_damping_error()

QuantumError pyqpanda3.core.amplitude_damping_error ( float prob)

amplitude_damping_error(prob: float) -> core.QuantumError

Create an amplitude damping error.

Returns
A QuantumError representing an amplitude damping error.

◆ BARRIER()

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

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

Apply the BARRIER operation to input qubits.

The BARRIER operation prevents any operations from being moved above this point in the circuit.

Matrix representation:

BARRIER does not have a matrix representation since it does not change the quantum state.

◆ CNOT()

QGate pyqpanda3.core.CNOT ( int qubit1,
int qubit2 )

CNOT(qubit1: int, qubit2: int) -> core.QGate.

Apply the CNOT (controlled-NOT) gate to two qubits.

Matrix representation:

CNOT = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{bmatrix}

◆ CP() [1/2]

QGate pyqpanda3.core.CP ( int control,
int target,
float theta )

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

  1. CP(control: int, target: int, theta: float) -> core.QGate

Apply the CP gate to a qubit.

Matrix representation:

CP = \begin{ bmatrix } 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & \exp(i\theta) \end{ bmatrix }

  1. CP(control_qbit_idx: int, target_qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CP gate to a qubit with an angle

Parameters
control_qbit_idxthe idx of qbit which will control the target_qbit_idx
target_qbit_idxthe idx of qbit which will be controled by the control_qbit_idx
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CP

◆ CP() [2/2]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.CP ( int control_qbit_idx,
int target_qbit_idx,
list[int] param )

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

  1. CP(control: int, target: int, theta: float) -> core.QGate

Apply the CP gate to a qubit.

Matrix representation:

CP = \begin{ bmatrix } 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & \exp(i\theta) \end{ bmatrix }

  1. CP(control_qbit_idx: int, target_qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CP gate to a qubit with an angle

Parameters
control_qbit_idxthe idx of qbit which will control the target_qbit_idx
target_qbit_idxthe idx of qbit which will be controled by the control_qbit_idx
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CP

◆ CR() [1/2]

QGate pyqpanda3.core.CR ( int control,
int target,
float theta )

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

  1. CR(control: int, target: int, theta: float) -> core.QGate

CR is equivalently replaced with CP, Apply the CP gate to a qubit.

Matrix representation:

CR = \begin{ bmatrix } 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & \exp(i\theta) \end{ bmatrix }

  1. CR(control_qbit_idx: int, target_qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CR gate to a qubit with an angle.

This gate is same with CP gate. Here, the gate type of it will be same with CP gate.

Parameters
control_qbit_idxthe idx of qbit which will control the target_qbit_idx
target_qbit_idxthe idx of qbit which will be controled by the control_qbit_idx
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CR

◆ CR() [2/2]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.CR ( int control_qbit_idx,
int target_qbit_idx,
list[int] param )

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

  1. CR(control: int, target: int, theta: float) -> core.QGate

CR is equivalently replaced with CP, Apply the CP gate to a qubit.

Matrix representation:

CR = \begin{ bmatrix } 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & \exp(i\theta) \end{ bmatrix }

  1. CR(control_qbit_idx: int, target_qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CR gate to a qubit with an angle.

This gate is same with CP gate. Here, the gate type of it will be same with CP gate.

Parameters
control_qbit_idxthe idx of qbit which will control the target_qbit_idx
target_qbit_idxthe idx of qbit which will be controled by the control_qbit_idx
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CR

◆ create_gate()

QGate pyqpanda3.core.create_gate ( str gate_name,
list[int] qubits,
list[float] params )

create_gate(gate_name: str, qubits: list[int], params: list[float]) -> core.QGate

◆ CU() [1/5]

QGate pyqpanda3.core.CU ( int control,
int target,
float theta,
float phi,
float _lambda,
float gamma )

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

  1. CU(control: int, target: int, theta: float, phi: float, lambda: float, gamma: float) -> core.QGate

Apply the CU (controlled-U) gate to two qubits.

Matrix representation:

CU = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & u_0 & u_1 \\ 0 & 0 & u_2 & u_3 \end{bmatrix}

  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: list[int], param2: Union[float, list[int]], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the mutable param's pos in Parameter which will be used to update the val of the angle
param2the fixed param val or mutable param's pos in Parameter which will be used to ppdate the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU
  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: float, param2: list[int], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU
  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: float, param2: float, param3: list[int], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU
  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: float, param2: float, param3: float, param4: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the fixed param's val
param4the mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU

◆ CU() [2/5]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.CU ( int control_qbit_idx,
int target_qbit_idx,
float param1,
float param2,
float param3,
list[int] param4 )

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

  1. CU(control: int, target: int, theta: float, phi: float, lambda: float, gamma: float) -> core.QGate

Apply the CU (controlled-U) gate to two qubits.

Matrix representation:

CU = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & u_0 & u_1 \\ 0 & 0 & u_2 & u_3 \end{bmatrix}

  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: list[int], param2: Union[float, list[int]], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the mutable param's pos in Parameter which will be used to update the val of the angle
param2the fixed param val or mutable param's pos in Parameter which will be used to ppdate the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU
  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: float, param2: list[int], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU
  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: float, param2: float, param3: list[int], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU
  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: float, param2: float, param3: float, param4: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the fixed param's val
param4the mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU

◆ CU() [3/5]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.CU ( int control_qbit_idx,
int target_qbit_idx,
float param1,
float param2,
list[int] param3,
float | list[int] param4 )

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

  1. CU(control: int, target: int, theta: float, phi: float, lambda: float, gamma: float) -> core.QGate

Apply the CU (controlled-U) gate to two qubits.

Matrix representation:

CU = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & u_0 & u_1 \\ 0 & 0 & u_2 & u_3 \end{bmatrix}

  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: list[int], param2: Union[float, list[int]], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the mutable param's pos in Parameter which will be used to update the val of the angle
param2the fixed param val or mutable param's pos in Parameter which will be used to ppdate the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU
  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: float, param2: list[int], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU
  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: float, param2: float, param3: list[int], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU
  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: float, param2: float, param3: float, param4: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the fixed param's val
param4the mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU

◆ CU() [4/5]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.CU ( int control_qbit_idx,
int target_qbit_idx,
float param1,
list[int] param2,
float | list[int] param3,
float | list[int] param4 )

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

  1. CU(control: int, target: int, theta: float, phi: float, lambda: float, gamma: float) -> core.QGate

Apply the CU (controlled-U) gate to two qubits.

Matrix representation:

CU = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & u_0 & u_1 \\ 0 & 0 & u_2 & u_3 \end{bmatrix}

  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: list[int], param2: Union[float, list[int]], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the mutable param's pos in Parameter which will be used to update the val of the angle
param2the fixed param val or mutable param's pos in Parameter which will be used to ppdate the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU
  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: float, param2: list[int], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU
  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: float, param2: float, param3: list[int], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU
  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: float, param2: float, param3: float, param4: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the fixed param's val
param4the mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU

◆ CU() [5/5]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.CU ( int control_qbit_idx,
int target_qbit_idx,
list[int] param1,
float | list[int] param2,
float | list[int] param3,
float | list[int] param4 )

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

  1. CU(control: int, target: int, theta: float, phi: float, lambda: float, gamma: float) -> core.QGate

Apply the CU (controlled-U) gate to two qubits.

Matrix representation:

CU = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & u_0 & u_1 \\ 0 & 0 & u_2 & u_3 \end{bmatrix}

  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: list[int], param2: Union[float, list[int]], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the mutable param's pos in Parameter which will be used to update the val of the angle
param2the fixed param val or mutable param's pos in Parameter which will be used to ppdate the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU
  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: float, param2: list[int], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU
  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: float, param2: float, param3: list[int], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU
  1. CU(control_qbit_idx: int, target_qbit_idx: int, param1: float, param2: float, param3: float, param4: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the CU gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the fixed param's val
param4the mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is CU

◆ CZ()

QGate pyqpanda3.core.CZ ( int qubit1,
int qubit2 )

CZ(qubit1: int, qubit2: int) -> core.QGate.

Apply the CZ (controlled-Z) gate to two qubits.

Matrix representation:

CZ = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & -1 \end{bmatrix}

◆ decoherence_error()

QuantumError pyqpanda3.core.decoherence_error ( float arg0,
float arg1,
float arg2 )

decoherence_error(arg0: float, arg1: float, arg2: float) -> core.QuantumError

Create a decoherence error.

Returns
A QuantumError representing a decoherence error.

◆ depolarizing_error()

QuantumError pyqpanda3.core.depolarizing_error ( float prob)

depolarizing_error(prob: float) -> core.QuantumError

Create a depolarizing error.

Returns
A QuantumError representing a depolarizing error.

◆ direct_twirl()

QProg pyqpanda3.core.direct_twirl ( QProg arg0,
str arg1,
int arg2 )

direct_twirl(arg0: core.QProg, arg1: str, arg2: int) -> core.QProg

Perform direct twirling on a quantum circuit.

Parameters
input_circThe input quantum circuit to twirl.
twirled_gateThe gate to use for the twirling operation (default is 'CNOT').
seedThe random seed to use for the twirling (default is 0).
Returns
The twirled quantum circuit.

◆ draw_qprog() [1/2]

str pyqpanda3.core.draw_qprog ( QCircuit circuit,
PIC_TYPE p = ...,
dict[str, int] expend_map = ...,
bool param_show = ...,
bool with_logo = ...,
int line_length = ...,
str output_file = ...,
str encode = ... )

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

  1. draw_qprog(qprog: core.QProg, p: core.PIC_TYPE = <PIC_TYPE.TEXT: 0>, expend_map: dict[str, int] = {\'all\': 1}, param_show: bool = False, with_logo: bool = False, line_length: int = 100, output_file: str = \'\', encode: str = \'utf-8\') -> str

Draws a quantum program (QProg) graphically. This function generates a graphical representation of the given quantum program object.

Parameters
circuitA reference to the quantum program object of type QProg that needs to be drawn.
pThe drawing type, defaulting to PIC_TYPE.TEXT, which means to draw in text format.
expend_mapA map used to control drawing expansion options, defaulting to { {"all", 1} }. This parameter can specify whether to expand all subprograms.
param_showA boolean indicating whether to show parameters, defaulting to false.
with_logoA boolean indicating whether to include a logo in the output, defaulting to false.
line_lengthThe maximum character length per line, defaulting to 100.
output_fileThe path for the output file, defaulting to an empty string, which means do not write to a file.
Returns
A string representing the generated graphical representation.
  1. draw_qprog(circuit: core.QCircuit, p: core.PIC_TYPE = <PIC_TYPE.TEXT: 0>, expend_map: dict[str, int] = {\'all\': 1}, param_show: bool = False, with_logo: bool = False, line_length: int = 100, output_file: str = \'\', encode: str = \'utf-8\') -> str

Draws a QCircuit graphically. This function generates a graphical representation of the given quantum program object.

Parameters
circuitA reference to the quantum program object of type QProg that needs to be drawn.
pThe drawing type, defaulting to PIC_TYPE.TEXT, which means to draw in text format.
expend_mapA map used to control drawing expansion options, defaulting to { {"all", 1} }. This parameter can specify whether to expand all subprograms.
param_showA boolean indicating whether to show parameters, defaulting to false.
with_logoA boolean indicating whether to include a logo in the output, defaulting to false.
line_lengthThe maximum character length per line, defaulting to 100.
output_fileThe path for the output file, defaulting to an empty string, which means do not write to a file.
Returns
A string representing the generated graphical representation.

◆ draw_qprog() [2/2]

str pyqpanda3.core.draw_qprog ( QProg qprog,
PIC_TYPE p = ...,
dict[str, int] expend_map = ...,
bool param_show = ...,
bool with_logo = ...,
int line_length = ...,
str output_file = ...,
str encode = ... )

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

  1. draw_qprog(qprog: core.QProg, p: core.PIC_TYPE = <PIC_TYPE.TEXT: 0>, expend_map: dict[str, int] = {\'all\': 1}, param_show: bool = False, with_logo: bool = False, line_length: int = 100, output_file: str = \'\', encode: str = \'utf-8\') -> str

Draws a quantum program (QProg) graphically. This function generates a graphical representation of the given quantum program object.

Parameters
circuitA reference to the quantum program object of type QProg that needs to be drawn.
pThe drawing type, defaulting to PIC_TYPE.TEXT, which means to draw in text format.
expend_mapA map used to control drawing expansion options, defaulting to { {"all", 1} }. This parameter can specify whether to expand all subprograms.
param_showA boolean indicating whether to show parameters, defaulting to false.
with_logoA boolean indicating whether to include a logo in the output, defaulting to false.
line_lengthThe maximum character length per line, defaulting to 100.
output_fileThe path for the output file, defaulting to an empty string, which means do not write to a file.
Returns
A string representing the generated graphical representation.
  1. draw_qprog(circuit: core.QCircuit, p: core.PIC_TYPE = <PIC_TYPE.TEXT: 0>, expend_map: dict[str, int] = {\'all\': 1}, param_show: bool = False, with_logo: bool = False, line_length: int = 100, output_file: str = \'\', encode: str = \'utf-8\') -> str

Draws a QCircuit graphically. This function generates a graphical representation of the given quantum program object.

Parameters
circuitA reference to the quantum program object of type QProg that needs to be drawn.
pThe drawing type, defaulting to PIC_TYPE.TEXT, which means to draw in text format.
expend_mapA map used to control drawing expansion options, defaulting to { {"all", 1} }. This parameter can specify whether to expand all subprograms.
param_showA boolean indicating whether to show parameters, defaulting to false.
with_logoA boolean indicating whether to include a logo in the output, defaulting to false.
line_lengthThe maximum character length per line, defaulting to 100.
output_fileThe path for the output file, defaulting to an empty string, which means do not write to a file.
Returns
A string representing the generated graphical representation.

◆ H()

QGate pyqpanda3.core.H ( int qubit)

H(qubit: int) -> core.QGate.

Apply the Hadamard gate to a qubit.

Matrix representation:

H = \begin{bmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \end{bmatrix}

◆ I()

QGate pyqpanda3.core.I ( int qubit)

I(qubit: int) -> core.QGate.

Apply the identity gate to a qubit.

Matrix representation:

I = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}

◆ ISWAP()

QGate pyqpanda3.core.ISWAP ( int qubit1,
int qubit2 )

ISWAP(qubit1: int, qubit2: int) -> core.QGate.

Apply the ISWAP gate to two qubits.

Matrix representation:

ISWAP = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos(\theta) & i\sin(\theta) & 0 \\ 0 & i\sin(\theta) & \cos(\theta) & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}

◆ measure()

QMeasure pyqpanda3.core.measure ( int qubit,
int cbit )

measure(qubit: int, cbit: int) -> core.QMeasure

Create the QMeasure to a qubit.

◆ Oracle()

QGate pyqpanda3.core.Oracle ( list[int] qubits,
numpy.ndarray[numpy.complex128[m, n]] matrix )

Oracle(qubits: list[int], matrix: numpy.ndarray[numpy.complex128[m, n]]) -> core.QGate.

Apply the Oracle gate to qubits.

◆ P() [1/2]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.P ( int qbit_idx,
list[int] param )

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

  1. P(qubit: int, theta: float) -> core.QGate

Apply the P gate to a qubit.

  1. P(qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the P gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is P

◆ P() [2/2]

QGate pyqpanda3.core.P ( int qubit,
float theta )

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

  1. P(qubit: int, theta: float) -> core.QGate

Apply the P gate to a qubit.

  1. P(qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the P gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is P

◆ pauli_x_error()

QuantumError pyqpanda3.core.pauli_x_error ( float prob)

pauli_x_error(prob: float) -> core.QuantumError

Create a Pauli-X error.

Returns
A QuantumError representing a Pauli-X error.

◆ pauli_y_error()

QuantumError pyqpanda3.core.pauli_y_error ( float prob)

pauli_y_error(prob: float) -> core.QuantumError

Create a Pauli-Y error.

Returns
A QuantumError representing a Pauli-Y error.

◆ pauli_z_error()

QuantumError pyqpanda3.core.pauli_z_error ( float prob)

pauli_z_error(prob: float) -> core.QuantumError

Create a Pauli-Z error.

Returns
A QuantumError representing a Pauli-Z error.

◆ phase_damping_error()

QuantumError pyqpanda3.core.phase_damping_error ( float prob)

phase_damping_error(prob: float) -> core.QuantumError

Create a phase damping error.

Returns
A QuantumError representing a phase damping error.

◆ QV()

QCircuit pyqpanda3.core.QV ( int num_qubit,
int depth,
int seed )

QV(num_qubit: int, depth: int, seed: int) -> core.QCircuit.

Perform a quantum volume (QV) test.

Parameters
num_qubitThe number of qubits for the quantum circuit.
depthThe depth (number of layers) of the quantum circuit.
seedThe random seed to use for the circuit generation.
Returns
The computed quantum volume.

◆ random_qcircuit()

QCircuit pyqpanda3.core.random_qcircuit ( list[int] qubits,
int depth,
list[str] gate_type )

random_qcircuit(qubits: list[int], depth: int, gate_type: list[str]) -> core.QCircuit

Generate a random quantum circuit.

Parameters
qubitsThe number of qubits in the circuit.
depthThe depth (number of layers) of the quantum circuit.
gate_typeThe type of gates to use in the circuit.
Returns
A random quantum circuit.

◆ RPHI()

QGate pyqpanda3.core.RPHI ( int control,
float theta,
float phi )

RPHI(control: int, theta: float, phi: float) -> core.QGate.

Apply the RPHI gate to a qubit.

◆ RPhi() [1/2]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.RPhi ( int qbit_idx,
float param1,
list[int] param2 )

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

  1. RPhi(qbit_idx: int, param1: list[int], param2: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the RPhi gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
param2the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is RPhi
  1. RPhi(qbit_idx: int, param1: float, param2: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the RPhi gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe fixed param's val
param2the mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is RPhi

◆ RPhi() [2/2]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.RPhi ( int qbit_idx,
list[int] param1,
float | list[int] param2 )

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

  1. RPhi(qbit_idx: int, param1: list[int], param2: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the RPhi gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
param2the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is RPhi
  1. RPhi(qbit_idx: int, param1: float, param2: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the RPhi gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe fixed param's val
param2the mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is RPhi

◆ RX() [1/2]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.RX ( int qbit_idx,
list[int] param )

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

  1. RX(qubit: int, theta: float) -> core.QGate

Apply the RX rotation gate to a qubit.

Matrix representation:

RX = \begin{bmatrix} \cos\left(\frac{\theta}{2}\right) & -i\sin\left(\frac{\theta}{2}\right) \\ -i\sin\left(\frac{\theta}{2}\right) & \cos\left(\frac{\theta}{2}\right) \end{bmatrix}

  1. RX(qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the RX gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is RX

◆ RX() [2/2]

QGate pyqpanda3.core.RX ( int qubit,
float theta )

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

  1. RX(qubit: int, theta: float) -> core.QGate

Apply the RX rotation gate to a qubit.

Matrix representation:

RX = \begin{bmatrix} \cos\left(\frac{\theta}{2}\right) & -i\sin\left(\frac{\theta}{2}\right) \\ -i\sin\left(\frac{\theta}{2}\right) & \cos\left(\frac{\theta}{2}\right) \end{bmatrix}

  1. RX(qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the RX gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is RX

◆ RXX() [1/2]

QGate pyqpanda3.core.RXX ( int control,
int target,
float theta )

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

  1. RXX(control: int, target: int, theta: float) -> core.QGate

Apply the RXX gate to two qubits.

Matrix representation:

RXX = \begin{bmatrix} \cos(\theta/2) & 0 & 0 & -i\sin(\theta/2) \\ 0 & \cos(\theta/2) & -i\sin(\theta/2) & 0 \\ 0 & -i\sin(\theta/2) & \cos(\theta/2) & 0 \\ -i\sin(\theta/2) & 0 & 0 & \cos(\theta/2) \end{bmatrix}

  1. RXX(control_qbit_idx: int, target_qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the RXX gate to a qubit with an angle

Parameters
control_qbit_idxthe idx of qbit which will control the target_qbit_idx
target_qbit_idxthe idx of qbit which will be controled by the control_qbit_idx
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is RXX

◆ RXX() [2/2]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.RXX ( int control_qbit_idx,
int target_qbit_idx,
list[int] param )

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

  1. RXX(control: int, target: int, theta: float) -> core.QGate

Apply the RXX gate to two qubits.

Matrix representation:

RXX = \begin{bmatrix} \cos(\theta/2) & 0 & 0 & -i\sin(\theta/2) \\ 0 & \cos(\theta/2) & -i\sin(\theta/2) & 0 \\ 0 & -i\sin(\theta/2) & \cos(\theta/2) & 0 \\ -i\sin(\theta/2) & 0 & 0 & \cos(\theta/2) \end{bmatrix}

  1. RXX(control_qbit_idx: int, target_qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the RXX gate to a qubit with an angle

Parameters
control_qbit_idxthe idx of qbit which will control the target_qbit_idx
target_qbit_idxthe idx of qbit which will be controled by the control_qbit_idx
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is RXX

◆ RY() [1/2]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.RY ( int qbit_idx,
list[int] param )

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

  1. RY(qubit: int, theta: float) -> core.QGate

Apply the RY rotation gate to a qubit.

Matrix representation:

RY = \begin{bmatrix} \cos\left(\frac{\theta}{2}\right) & -\sin\left(\frac{\theta}{2}\right) \\ \sin\left(\frac{\theta}{2}\right) & \cos\left(\frac{\theta}{2}\right) \end{bmatrix}

  1. RY(qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the RY gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is RY

◆ RY() [2/2]

QGate pyqpanda3.core.RY ( int qubit,
float theta )

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

  1. RY(qubit: int, theta: float) -> core.QGate

Apply the RY rotation gate to a qubit.

Matrix representation:

RY = \begin{bmatrix} \cos\left(\frac{\theta}{2}\right) & -\sin\left(\frac{\theta}{2}\right) \\ \sin\left(\frac{\theta}{2}\right) & \cos\left(\frac{\theta}{2}\right) \end{bmatrix}

  1. RY(qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the RY gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is RY

◆ RYY() [1/2]

QGate pyqpanda3.core.RYY ( int control,
int target,
float theta )

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

  1. RYY(control: int, target: int, theta: float) -> core.QGate

Apply the RYY gate to two qubits.

Matrix representation:

RYY = \begin{bmatrix} \cos(\theta/2) & 0 & 0 & i\sin(\theta/2) \\ 0 & \cos(\theta/2) & -i\sin(\theta/2) & 0 \\ 0 & -i\sin(\theta/2) & \cos(\theta/2) & 0 \\ i\sin(\theta/2) & 0 & 0 & \cos(\theta/2) \end{bmatrix}

  1. RYY(control_qbit_idx: int, target_qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the RYY gate to a qubit with an angle

Parameters
control_qbit_idxthe idx of qbit which will control the target_qbit_idx
target_qbit_idxthe idx of qbit which will be controled by the control_qbit_idx
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is RYY

◆ RYY() [2/2]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.RYY ( int control_qbit_idx,
int target_qbit_idx,
list[int] param )

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

  1. RYY(control: int, target: int, theta: float) -> core.QGate

Apply the RYY gate to two qubits.

Matrix representation:

RYY = \begin{bmatrix} \cos(\theta/2) & 0 & 0 & i\sin(\theta/2) \\ 0 & \cos(\theta/2) & -i\sin(\theta/2) & 0 \\ 0 & -i\sin(\theta/2) & \cos(\theta/2) & 0 \\ i\sin(\theta/2) & 0 & 0 & \cos(\theta/2) \end{bmatrix}

  1. RYY(control_qbit_idx: int, target_qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the RYY gate to a qubit with an angle

Parameters
control_qbit_idxthe idx of qbit which will control the target_qbit_idx
target_qbit_idxthe idx of qbit which will be controled by the control_qbit_idx
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is RYY

◆ RZ() [1/2]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.RZ ( int qbit_idx,
list[int] param )

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

  1. RZ(qubit: int, theta: float) -> core.QGate

Apply the RZ rotation gate to a qubit.

Matrix representation:

RZ = \begin{bmatrix} \exp\left(-\frac{i\theta}{2}\right) & 0 \\ 0 & \exp\left(\frac{i\theta}{2}\right) \end{bmatrix}

  1. RZ(qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the RZ gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is RZ

◆ RZ() [2/2]

QGate pyqpanda3.core.RZ ( int qubit,
float theta )

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

  1. RZ(qubit: int, theta: float) -> core.QGate

Apply the RZ rotation gate to a qubit.

Matrix representation:

RZ = \begin{bmatrix} \exp\left(-\frac{i\theta}{2}\right) & 0 \\ 0 & \exp\left(\frac{i\theta}{2}\right) \end{bmatrix}

  1. RZ(qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the RZ gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is RZ

◆ RZX() [1/2]

QGate pyqpanda3.core.RZX ( int control,
int target,
float theta )

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

  1. RZX(control: int, target: int, theta: float) -> core.QGate

Apply the RZX gate to two qubits.

Matrix representation:

RZX = \begin{bmatrix} \cos(\theta/2) & 0 & -i\sin(\theta/2) & 0 \\ 0 & \cos(\theta/2) & 0 & i\sin(\theta/2) \\ -i\sin(\theta/2) & 0 & \cos(\theta/2) & 0 \\ 0 & i\sin(\theta/2) & 0 & \cos(\theta/2) \end{bmatrix}

  1. RZX(control_qbit_idx: int, target_qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the RZX gate to a qubit with an angle

Parameters
control_qbit_idxthe idx of qbit which will control the target_qbit_idx
target_qbit_idxthe idx of qbit which will be controled by the control_qbit_idx
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is RZX

◆ RZX() [2/2]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.RZX ( int control_qbit_idx,
int target_qbit_idx,
list[int] param )

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

  1. RZX(control: int, target: int, theta: float) -> core.QGate

Apply the RZX gate to two qubits.

Matrix representation:

RZX = \begin{bmatrix} \cos(\theta/2) & 0 & -i\sin(\theta/2) & 0 \\ 0 & \cos(\theta/2) & 0 & i\sin(\theta/2) \\ -i\sin(\theta/2) & 0 & \cos(\theta/2) & 0 \\ 0 & i\sin(\theta/2) & 0 & \cos(\theta/2) \end{bmatrix}

  1. RZX(control_qbit_idx: int, target_qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the RZX gate to a qubit with an angle

Parameters
control_qbit_idxthe idx of qbit which will control the target_qbit_idx
target_qbit_idxthe idx of qbit which will be controled by the control_qbit_idx
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is RZX

◆ RZZ() [1/2]

QGate pyqpanda3.core.RZZ ( int control,
int target,
float theta )

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

  1. RZZ(control: int, target: int, theta: float) -> core.QGate

Apply the RZZ gate to two qubits.

Matrix representation:

RZZ = \begin{bmatrix} \exp(-i\theta/2) & 0 & 0 & 0 \\ 0 & \exp(i\theta/2) & 0 & 0 \\ 0 & 0 & \exp(i\theta/2) & 0 \\ 0 & 0 & 0 & \exp(-i\theta/2) \end{bmatrix}

  1. RZZ(control_qbit_idx: int, target_qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the RZZ gate to a qubit with an angle

Parameters
control_qbit_idxthe idx of qbit which will control the target_qbit_idx
target_qbit_idxthe idx of qbit which will be controled by the control_qbit_idx
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is RZZ

◆ RZZ() [2/2]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.RZZ ( int control_qbit_idx,
int target_qbit_idx,
list[int] param )

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

  1. RZZ(control: int, target: int, theta: float) -> core.QGate

Apply the RZZ gate to two qubits.

Matrix representation:

RZZ = \begin{bmatrix} \exp(-i\theta/2) & 0 & 0 & 0 \\ 0 & \exp(i\theta/2) & 0 & 0 \\ 0 & 0 & \exp(i\theta/2) & 0 \\ 0 & 0 & 0 & \exp(-i\theta/2) \end{bmatrix}

  1. RZZ(control_qbit_idx: int, target_qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the RZZ gate to a qubit with an angle

Parameters
control_qbit_idxthe idx of qbit which will control the target_qbit_idx
target_qbit_idxthe idx of qbit which will be controled by the control_qbit_idx
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is RZZ

◆ S()

QGate pyqpanda3.core.S ( int qubit)

S(qubit: int) -> core.QGate.

Apply the S gate to a qubit.

Matrix representation:

S = \begin{bmatrix} 1 & 0 \\ 0 & i \end{bmatrix}

◆ set_print_options()

None pyqpanda3.core.set_print_options ( int precision = ...,
int param_show = ...,
int linewidth = ... )

set_print_options(precision: int = 8, param_show: int = True, linewidth: int = 100) -> None

Set the print options

◆ SWAP()

QGate pyqpanda3.core.SWAP ( int qubit1,
int qubit2 )

SWAP(qubit1: int, qubit2: int) -> core.QGate.

Apply the SWAP gate to two qubits.

Matrix representation:

SWAP = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}

◆ T()

QGate pyqpanda3.core.T ( int qubit)

T(qubit: int) -> core.QGate.

Apply the T gate to a qubit.

Matrix representation:

T = \begin{bmatrix} 1 & 0 \\ 0 & \exp\left(\frac{i\pi}{4}\right) \end{bmatrix}

◆ TOFFOLI()

QGate pyqpanda3.core.TOFFOLI ( int qubit1,
int qubit2,
int qubit3 )

TOFFOLI(qubit1: int, qubit2: int, qubit3: int) -> core.QGate.

Apply the TOFFOLI gate (controlled-controlled-NOT) to three qubits.

Matrix representation:

TOFFOLI = \begin{bmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \end{bmatrix}

◆ U1() [1/2]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.U1 ( int qbit_idx,
list[int] param )

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

  1. U1(qubit: int, theta: float) -> core.QGate

Apply the U1 gate to a qubit.

Matrix representation:

U1 = \begin{bmatrix} 1 & 0 \\ 0 & \exp(i\theta) \end{bmatrix}

  1. U1(qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U1 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U1

◆ U1() [2/2]

QGate pyqpanda3.core.U1 ( int qubit,
float theta )

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

  1. U1(qubit: int, theta: float) -> core.QGate

Apply the U1 gate to a qubit.

Matrix representation:

U1 = \begin{bmatrix} 1 & 0 \\ 0 & \exp(i\theta) \end{bmatrix}

  1. U1(qbit_idx: int, param: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U1 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U1

◆ U2() [1/3]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.U2 ( int qbit_idx,
float param1,
list[int] param2 )

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

  1. U2(qubit: int, theta: float, phi: float) -> core.QGate

Apply the U2 gate to a qubit.

Matrix representation:

U2 = \begin{bmatrix} \frac{1}{\sqrt{2}} & -\frac{\exp(i\lambda)}{\sqrt{2}} \\ \frac{\exp(i\phi)}{\sqrt{2}} & \frac{\exp(i\lambda + i\phi)}{\sqrt{2}} \end{bmatrix}

  1. U2(qbit_idx: int, param1: list[int], param2: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U2 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
param2the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U2
  1. U2(qbit_idx: int, param1: float, param2: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U2 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe fixed param's val
param2the mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U2

◆ U2() [2/3]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.U2 ( int qbit_idx,
list[int] param1,
float | list[int] param2 )

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

  1. U2(qubit: int, theta: float, phi: float) -> core.QGate

Apply the U2 gate to a qubit.

Matrix representation:

U2 = \begin{bmatrix} \frac{1}{\sqrt{2}} & -\frac{\exp(i\lambda)}{\sqrt{2}} \\ \frac{\exp(i\phi)}{\sqrt{2}} & \frac{\exp(i\lambda + i\phi)}{\sqrt{2}} \end{bmatrix}

  1. U2(qbit_idx: int, param1: list[int], param2: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U2 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
param2the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U2
  1. U2(qbit_idx: int, param1: float, param2: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U2 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe fixed param's val
param2the mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U2

◆ U2() [3/3]

QGate pyqpanda3.core.U2 ( int qubit,
float theta,
float phi )

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

  1. U2(qubit: int, theta: float, phi: float) -> core.QGate

Apply the U2 gate to a qubit.

Matrix representation:

U2 = \begin{bmatrix} \frac{1}{\sqrt{2}} & -\frac{\exp(i\lambda)}{\sqrt{2}} \\ \frac{\exp(i\phi)}{\sqrt{2}} & \frac{\exp(i\lambda + i\phi)}{\sqrt{2}} \end{bmatrix}

  1. U2(qbit_idx: int, param1: list[int], param2: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U2 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe mutable param's pos in Parameter which will be used to update the val of the angle
param2the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U2
  1. U2(qbit_idx: int, param1: float, param2: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U2 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
paramthe fixed param's val
param2the mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U2

◆ U3() [1/4]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.U3 ( int qbit_idx,
float param1,
float param2,
list[int] param3 )

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

  1. U3(qubit: int, theta: float, phi: float, lambda: float) -> core.QGate

Apply the U3 gate to a qubit.

Matrix representation:

U3 = \begin{bmatrix} \cos\left(\frac{\theta}{2}\right) & -\exp(i\lambda)\sin\left(\frac{\theta}{2}\right) \\ \exp(i\phi)\sin\left(\frac{\theta}{2}\right) & \exp(i\lambda + i\phi)\cos\left(\frac{\theta}{2}\right) \end{bmatrix}

  1. U3(qbit_idx: int, param1: list[int], param2: Union[float, list[int]], param3: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U3 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the mutable param's pos in Parameter which will be used to update the val of the angle
param2the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U3
  1. U3(qbit_idx: int, param1: float, param2: list[int], param3: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U3 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U3
  1. U3(qbit_idx: int, param1: float, param2: float, param3: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U3 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U3

◆ U3() [2/4]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.U3 ( int qbit_idx,
float param1,
list[int] param2,
float | list[int] param3 )

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

  1. U3(qubit: int, theta: float, phi: float, lambda: float) -> core.QGate

Apply the U3 gate to a qubit.

Matrix representation:

U3 = \begin{bmatrix} \cos\left(\frac{\theta}{2}\right) & -\exp(i\lambda)\sin\left(\frac{\theta}{2}\right) \\ \exp(i\phi)\sin\left(\frac{\theta}{2}\right) & \exp(i\lambda + i\phi)\cos\left(\frac{\theta}{2}\right) \end{bmatrix}

  1. U3(qbit_idx: int, param1: list[int], param2: Union[float, list[int]], param3: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U3 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the mutable param's pos in Parameter which will be used to update the val of the angle
param2the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U3
  1. U3(qbit_idx: int, param1: float, param2: list[int], param3: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U3 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U3
  1. U3(qbit_idx: int, param1: float, param2: float, param3: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U3 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U3

◆ U3() [3/4]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.U3 ( int qbit_idx,
list[int] param1,
float | list[int] param2,
float | list[int] param3 )

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

  1. U3(qubit: int, theta: float, phi: float, lambda: float) -> core.QGate

Apply the U3 gate to a qubit.

Matrix representation:

U3 = \begin{bmatrix} \cos\left(\frac{\theta}{2}\right) & -\exp(i\lambda)\sin\left(\frac{\theta}{2}\right) \\ \exp(i\phi)\sin\left(\frac{\theta}{2}\right) & \exp(i\lambda + i\phi)\cos\left(\frac{\theta}{2}\right) \end{bmatrix}

  1. U3(qbit_idx: int, param1: list[int], param2: Union[float, list[int]], param3: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U3 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the mutable param's pos in Parameter which will be used to update the val of the angle
param2the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U3
  1. U3(qbit_idx: int, param1: float, param2: list[int], param3: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U3 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U3
  1. U3(qbit_idx: int, param1: float, param2: float, param3: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U3 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U3

◆ U3() [4/4]

QGate pyqpanda3.core.U3 ( int qubit,
float theta,
float phi,
float _lambda )

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

  1. U3(qubit: int, theta: float, phi: float, lambda: float) -> core.QGate

Apply the U3 gate to a qubit.

Matrix representation:

U3 = \begin{bmatrix} \cos\left(\frac{\theta}{2}\right) & -\exp(i\lambda)\sin\left(\frac{\theta}{2}\right) \\ \exp(i\phi)\sin\left(\frac{\theta}{2}\right) & \exp(i\lambda + i\phi)\cos\left(\frac{\theta}{2}\right) \end{bmatrix}

  1. U3(qbit_idx: int, param1: list[int], param2: Union[float, list[int]], param3: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U3 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the mutable param's pos in Parameter which will be used to update the val of the angle
param2the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U3
  1. U3(qbit_idx: int, param1: float, param2: list[int], param3: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U3 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U3
  1. U3(qbit_idx: int, param1: float, param2: float, param3: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U3 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U3

◆ U4() [1/5]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.U4 ( int qbit_idx,
float param1,
float param2,
float param3,
list[int] param4 )

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

  1. U4(qubit: int, theta: float, phi: float, lambda: float, gamma: float) -> core.QGate

Apply the U4 gate to a qubit.

Matrix representation:

U4 = \begin{bmatrix} u_0 & u_1 \\ u_2 & u_3 \end{bmatrix}

  1. U4(qbit_idx: int, param1: list[int], param2: Union[float, list[int]], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the mutable param's pos in Parameter which will be used to update the val of the angle
param2the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4
  1. U4(qbit_idx: int, param1: float, param2: list[int], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4
  1. U4(qbit_idx: int, param1: float, param2: float, param3: list[int], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4
  1. U4(qbit_idx: int, param1: float, param2: float, param3: float, param4: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the fixed param's val
param4the mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4

◆ U4() [2/5]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.U4 ( int qbit_idx,
float param1,
float param2,
list[int] param3,
float | list[int] param4 )

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

  1. U4(qubit: int, theta: float, phi: float, lambda: float, gamma: float) -> core.QGate

Apply the U4 gate to a qubit.

Matrix representation:

U4 = \begin{bmatrix} u_0 & u_1 \\ u_2 & u_3 \end{bmatrix}

  1. U4(qbit_idx: int, param1: list[int], param2: Union[float, list[int]], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the mutable param's pos in Parameter which will be used to update the val of the angle
param2the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4
  1. U4(qbit_idx: int, param1: float, param2: list[int], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4
  1. U4(qbit_idx: int, param1: float, param2: float, param3: list[int], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4
  1. U4(qbit_idx: int, param1: float, param2: float, param3: float, param4: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the fixed param's val
param4the mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4

◆ U4() [3/5]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.U4 ( int qbit_idx,
float param1,
list[int] param2,
float | list[int] param3,
float | list[int] param4 )

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

  1. U4(qubit: int, theta: float, phi: float, lambda: float, gamma: float) -> core.QGate

Apply the U4 gate to a qubit.

Matrix representation:

U4 = \begin{bmatrix} u_0 & u_1 \\ u_2 & u_3 \end{bmatrix}

  1. U4(qbit_idx: int, param1: list[int], param2: Union[float, list[int]], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the mutable param's pos in Parameter which will be used to update the val of the angle
param2the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4
  1. U4(qbit_idx: int, param1: float, param2: list[int], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4
  1. U4(qbit_idx: int, param1: float, param2: float, param3: list[int], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4
  1. U4(qbit_idx: int, param1: float, param2: float, param3: float, param4: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the fixed param's val
param4the mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4

◆ U4() [4/5]

tuple[VQGate, list[float | list[int]]] pyqpanda3.core.U4 ( int qbit_idx,
list[int] param1,
float | list[int] param2,
float | list[int] param3,
float | list[int] param4 )

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

  1. U4(qubit: int, theta: float, phi: float, lambda: float, gamma: float) -> core.QGate

Apply the U4 gate to a qubit.

Matrix representation:

U4 = \begin{bmatrix} u_0 & u_1 \\ u_2 & u_3 \end{bmatrix}

  1. U4(qbit_idx: int, param1: list[int], param2: Union[float, list[int]], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the mutable param's pos in Parameter which will be used to update the val of the angle
param2the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4
  1. U4(qbit_idx: int, param1: float, param2: list[int], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4
  1. U4(qbit_idx: int, param1: float, param2: float, param3: list[int], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4
  1. U4(qbit_idx: int, param1: float, param2: float, param3: float, param4: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the fixed param's val
param4the mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4

◆ U4() [5/5]

QGate pyqpanda3.core.U4 ( int qubit,
float theta,
float phi,
float _lambda,
float gamma )

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

  1. U4(qubit: int, theta: float, phi: float, lambda: float, gamma: float) -> core.QGate

Apply the U4 gate to a qubit.

Matrix representation:

U4 = \begin{bmatrix} u_0 & u_1 \\ u_2 & u_3 \end{bmatrix}

  1. U4(qbit_idx: int, param1: list[int], param2: Union[float, list[int]], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the mutable param's pos in Parameter which will be used to update the val of the angle
param2the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4
  1. U4(qbit_idx: int, param1: float, param2: list[int], param3: Union[float, list[int]], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the mutable param's pos in Parameter which will be used to update the val of the angle
param3the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4
  1. U4(qbit_idx: int, param1: float, param2: float, param3: list[int], param4: Union[float, list[int]]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the mutable param's pos in Parameter which will be used to update the val of the angle
param4the fixed param val or mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4
  1. U4(qbit_idx: int, param1: float, param2: float, param3: float, param4: list[int]) -> tuple[core.VQGate, list[Union[float, list[int]]]]

Apply the U4 gate to a qubit with an angle

Parameters
qbit_idxthe idx of qbit which will be appled the P gate
param1the fixed param's val
param2the fixed param's val
param3the fixed param's val
param4the mutable param's pos in Parameter which will be used to update the val of the angle
Returns
return a VQGate which gate type is U4

◆ X()

QGate pyqpanda3.core.X ( int qubit)

X(qubit: int) -> core.QGate.

Apply the X gate to a qubit.

Matrix representation:

X = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}

◆ X1()

QGate pyqpanda3.core.X1 ( int qubit)

X1(qubit: int) -> core.QGate.

Apply the X1 gate to a qubit.

Matrix representation:

X1 = \begin{bmatrix} \frac{1}{\sqrt{2}} & -\frac{i}{\sqrt{2}} \\ -\frac{i}{\sqrt{2}} & \frac{1}{\sqrt{2}} \end{bmatrix}

◆ Y()

QGate pyqpanda3.core.Y ( int qubit)

Y(qubit: int) -> core.QGate.

Apply the Y gate to a qubit.

Matrix representation:

Y = \begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix}

◆ Y1()

QGate pyqpanda3.core.Y1 ( int qubit)

Y1(qubit: int) -> core.QGate.

Apply the Y1 gate to a qubit.

Matrix representation:

Y1 = \begin{bmatrix} \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \end{bmatrix}

◆ Z()

QGate pyqpanda3.core.Z ( int qubit)

Z(qubit: int) -> core.QGate.

Apply the Z gate to a qubit.

Matrix representation:

Z = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}

◆ Z1()

QGate pyqpanda3.core.Z1 ( int qubit)

Z1(qubit: int) -> core.QGate.

Apply the Z1 gate to a qubit.

Matrix representation:

Z1 = \begin{bmatrix} \exp\left(-\frac{i\pi}{4}\right) & 0 \\ 0 & \exp\left(\frac{i\pi}{4}\right) \end{bmatrix}