scaluq.default.f64.gate
Define gates.
Functions
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate computational-basis measurement gate. |
|
Generate rotation gate around X-axis. Rotation angle is specified in radians. |
|
Generate rotation gate around Y-axis. Rotation angle is specified in radians. |
|
Generate rotation gate around Z-axis. Rotation angle is specified in radians. |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate SWAP gate. Swaps the states of two qubits. |
|
Generate ECR gate. Echoed cross-resonance gate. |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generates a general Gate class instance of BitFlipNoise. error_rate is the probability of a bit-flip noise, corresponding to the X gate. |
|
Generates a general Gate class instance of DephasingNoise. error_rate is the probability of a dephasing noise, corresponding to the Z gate. |
|
Generates a general Gate class instance of BitFlipAndDephasingNoise. error_rate is the probability of both bit-flip noise and dephasing noise, corresponding to the X gate and Z gate. |
|
Generates a general Gate class instance of DepolarizingNoise. error_rate is the total probability of depolarizing noise, where an X, Y, or Z gate is applied with a probability of error_rate / 3 each. |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
|
Generate general |
Package Contents
- scaluq.default.f64.gate.DenseMatrix(targets, matrix, controls=[], control_values=[], is_unitary=False)
Generate general
Gateclass instance ofDenseMatrixGate. Performs dense matrix operation.- Parameters:
targets (list[int]) – Target qubit indices
matrix (numpy.ndarray) – Matrix to be applied
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
is_unitary (bool, optional) – Whether the matrix is unitary. When the flag indicating that the gate is unitary is set to True, a more efficient implementation is used.
- Returns:
DenseMatrix gate instance
- Return type:
Examples
>>> import numpy as np >>> matrix = np.array([[1, 0], [0, 1]]) >>> gate = DenseMatrix([0], matrix) >>> gate = DenseMatrix([0], matrix, [1]) # Controlled-DenseMatrix
Notes
If you need to use functions specific to the
DenseMatrixGateclass, please downcast it.
- scaluq.default.f64.gate.SparseMatrix(targets, matrix, controls=[], control_values=[])
Generate general
Gateclass instance ofSparseMatrixGate. Performs sparse matrix operation.- Parameters:
targets (list[int]) – Target qubit indices
matrix (scipy.sparse.csr_matrix) – Matrix to be applied
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
SparseMatrix gate instance
- Return type:
Examples
>>> import scipy >>> matrix = scipy.sparse.csr_matrix([[1, 0], [0, 1]]) >>> gate = SparseMatrix([0], matrix) >>> gate = SparseMatrix([0], matrix, [1]) # Controlled-SparseMatrix
Notes
If you need to use functions specific to the
SparseMatrixGateclass, please downcast it.
- scaluq.default.f64.gate.I()
Generate general
Gateclass instance ofIGate.- Returns:
Identity gate instance
- Return type:
Examples
>>> gate = I() >>> print(gate) Gate Type: I Target Qubits: {} Control Qubits: {} Control Value: {}
- scaluq.default.f64.gate.GlobalPhase(gamma, controls=[], control_values=[])
Generate general
Gateclass instance ofGlobalPhaseGate.- Parameters:
gamma (float) – Global phase angle in radians
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
Global phase gate instance
- Return type:
Examples
>>> import math >>> gate = GlobalPhase(math.pi/2) >>> print(gate) Gate Type: GlobalPhase Phase: 1.5708 Target Qubits: {} Control Qubits: {} Control Value: {}
Notes
If you need to use functions specific to the
GlobalPhaseGateclass, please downcast it.
- scaluq.default.f64.gate.X(target, controls=[], control_values=[])
Generate general
Gateclass instance ofXGate. Performs bit flip operation.- Parameters:
target (int) – Target qubit index
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
Pauli-X gate instance
- Return type:
Examples
>>> gate = X(0) # X gate on qubit 0 >>> gate = X(1, [0]) # Controlled-X with control on qubit 0
Notes
XGate represents the Pauli-X (NOT) gate class.If you need to use functions specific to the
XGateclass, please downcast it.
- scaluq.default.f64.gate.Y(target, controls=[], control_values=[])
Generate general
Gateclass instance ofYGate. Performs bit flip and phase flip operation.- Parameters:
target (int) – Target qubit index
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
Pauli-Y gate instance
- Return type:
Examples
>>> gate = Y(0) # Y gate on qubit 0 >>> gate = Y(1, [0]) # Controlled-Y with control on qubit 0
Notes
YGate represents the Pauli-Y gate class. If you need to use functions specific to the
YGateclass, please downcast it.
- scaluq.default.f64.gate.Z(target, controls=[], control_values=[])
Generate general
Gateclass instance ofZGate. Performs bit flip and phase flip operation.- Parameters:
target (int) – Target qubit index
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
Pauli-Z gate instance
- Return type:
Examples
>>> gate = Z(0) # Z gate on qubit 0 >>> gate = Z(1, [0]) # Controlled-Z with control on qubit 0
Notes
ZGate represents the Pauli-Z gate class. If you need to use functions specific to the
ZGateclass, please downcast it.
- scaluq.default.f64.gate.H(target, controls=[], control_values=[])
Generate general
Gateclass instance ofHGate. Performs superposition operation.- Parameters:
target (int) – Target qubit index
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
Hadamard gate instance
- Return type:
Examples
>>> gate = H(0) # H gate on qubit 0 >>> gate = H(1, [0]) # Controlled-H with control on qubit 0
Notes
If you need to use functions specific to the
HGateclass, please downcast it.
- scaluq.default.f64.gate.S(target, controls=[], control_values=[])
Generate general
Gateclass instance ofSGate.- Parameters:
target (int) – Target qubit index
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
S gate instance
- Return type:
Examples
>>> gate = S(0) # S gate on qubit 0 >>> gate = S(1, [0]) # Controlled-S with control on qubit 0
Notes
If you need to use functions specific to the
SGateclass, please downcast it.
- scaluq.default.f64.gate.Sdag(target, controls=[], control_values=[])
Generate general
Gateclass instance ofSdagGate.- Parameters:
target (int) – Target qubit index
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
Sdag gate instance
- Return type:
Examples
>>> gate = Sdag(0) # Sdag gate on qubit 0 >>> gate = Sdag(1, [0]) # Controlled-Sdag with control on qubit 0
Notes
If you need to use functions specific to the
SdagGateclass, please downcast it.
- scaluq.default.f64.gate.T(target, controls=[], control_values=[])
Generate general
Gateclass instance ofTGate.- Parameters:
target (int) – Target qubit index
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
T gate instance
- Return type:
Examples
>>> gate = T(0) # T gate on qubit 0 >>> gate = T(1, [0]) # Controlled-T with control on qubit 0
Notes
If you need to use functions specific to the
TGateclass, please downcast it.
- scaluq.default.f64.gate.Tdag(target, controls=[], control_values=[])
Generate general
Gateclass instance ofTdagGate.- Parameters:
target (int) – Target qubit index
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
Tdag gate instance
- Return type:
Examples
>>> gate = Tdag(0) # Tdag gate on qubit 0 >>> gate = Tdag(1, [0]) # Controlled-Tdag with control on qubit 0
Notes
If you need to use functions specific to the
TdagGateclass, please downcast it.
- scaluq.default.f64.gate.SqrtX(target, controls=[], control_values=[])
Generate general
Gateclass instance ofSqrtXGate, represented as \(\frac{1}{2}\begin{bmatrix} 1+i & 1-i \\ 1-i & 1+i \end{bmatrix}\).- Parameters:
target (int) – Target qubit index
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
SqrtX gate instance
- Return type:
Examples
>>> gate = SqrtX(0) # SqrtX gate on qubit 0 >>> gate = SqrtX(1, [0]) # Controlled-SqrtX
Notes
If you need to use functions specific to the
SqrtXGateclass, please downcast it.
- scaluq.default.f64.gate.SqrtXdag(target, controls=[], control_values=[])
Generate general
Gateclass instance ofSqrtXdagGate, represented as \(\begin{bmatrix} 1-i & 1+i\\ 1+i & 1-i \end{bmatrix}\).- Parameters:
target (int) – Target qubit index
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
SqrtXdag gate instance
- Return type:
Examples
>>> gate = SqrtXdag(0) # SqrtXdag gate on qubit 0 >>> gate = SqrtXdag(1, [0]) # Controlled-SqrtXdag
Notes
If you need to use functions specific to the
SqrtXdagGateclass, please downcast it.
- scaluq.default.f64.gate.SqrtY(target, controls=[], control_values=[])
Generate general
Gateclass instance ofSqrtYGate, represented as \(\begin{bmatrix} 1+i & -1-i \\ 1+i & 1+i \end{bmatrix}\).- Parameters:
target (int) – Target qubit index
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
SqrtY gate instance
- Return type:
Examples
>>> gate = SqrtY(0) # SqrtY gate on qubit 0 >>> gate = SqrtY(1, [0]) # Controlled-SqrtY
Notes
If you need to use functions specific to the
SqrtYGateclass, please downcast it.
- scaluq.default.f64.gate.SqrtYdag(target, controls=[], control_values=[])
Generate general
Gateclass instance ofSqrtYdagGate, represented as \(\begin{bmatrix} 1-i & 1-i \\ -1+i & 1-i \end{bmatrix}\).- Parameters:
target (int) – Target qubit index
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
SqrtYdag gate instance
- Return type:
Examples
>>> gate = SqrtYdag(0) # SqrtYdag gate on qubit 0 >>> gate = SqrtYdag(1, [0]) # Controlled-SqrtYdag
Notes
If you need to use functions specific to the
SqrtYdagGateclass, please downcast it.
- scaluq.default.f64.gate.P0(target, controls=[], control_values=[])
Generate general
Gateclass instance ofP0Gate.- Parameters:
target (int) – Target qubit index
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
P0 gate instance
- Return type:
Examples
>>> gate = P0(0) # P0 gate on qubit 0 >>> gate = P0(1, [0]) # Controlled-P0
Notes
If you need to use functions specific to the
P0Gateclass, please downcast it.
- scaluq.default.f64.gate.P1(target, controls=[], control_values=[])
Generate general
Gateclass instance ofP1Gate.- Parameters:
target (int) – Target qubit index
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
P1 gate instance
- Return type:
Examples
>>> gate = P1(0) # P1 gate on qubit 0 >>> gate = P1(1, [0]) # Controlled-P1
Notes
If you need to use functions specific to the
P1Gateclass, please downcast it.
- scaluq.default.f64.gate.Measurement(target, classical_bit, reset=False)
Generate computational-basis measurement gate.
- Parameters:
target (int) – Target qubit index
classical_bit (int) – Destination classical bit index
reset (bool, optional) – Whether to reset the target qubit to |0>
- Returns:
Measurement gate instance
- Return type:
Examples
>>> gate = Measurement(0, 1)
Notes
Applying this gate requires a classical register whose size is greater than classical_bit. If reset is true, the target qubit is reset to |0> after the measurement.
- scaluq.default.f64.gate.RX(target, theta, controls=[], control_values=[])
Generate rotation gate around X-axis. Rotation angle is specified in radians.
- Parameters:
target (int) – Target qubit index
theta (float) – Rotation angle in radians
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
RX gate instance
- Return type:
Examples
>>> import math >>> gate = RX(0, math.pi/2) # π/2 rotation around X-axis >>> gate = RX(1, math.pi, [0]) # Controlled-RX
Notes
If you need to use functions specific to the
RXGateclass, please downcast it.
- scaluq.default.f64.gate.RY(target, theta, controls=[], control_values=[])
Generate rotation gate around Y-axis. Rotation angle is specified in radians.
- Parameters:
target (int) – Target qubit index
theta (float) – Rotation angle in radians
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
RY gate instance
- Return type:
Examples
>>> import math >>> gate = RY(0, math.pi/2) # π/2 rotation around Y-axis >>> gate = RY(1, math.pi, [0]) # Controlled-RY
Notes
If you need to use functions specific to the
RYGateclass, please downcast it.
- scaluq.default.f64.gate.RZ(target, theta, controls=[], control_values=[])
Generate rotation gate around Z-axis. Rotation angle is specified in radians.
- Parameters:
target (int) – Target qubit index
theta (float) – Rotation angle in radians
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
RZ gate instance
- Return type:
Examples
>>> import math >>> gate = RZ(0, math.pi/2) # π/2 rotation around Z-axis >>> gate = RZ(1, math.pi, [0]) # Controlled-RZ
Notes
If you need to use functions specific to the
RZGateclass, please downcast it.
- scaluq.default.f64.gate.U1(target, lambda_, controls=[], control_values=[])
Generate general
Gateclass instance ofU1Gate.- Parameters:
target (int) – Target qubit index
lambda (float) – Rotation angle in radians
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
lambda_ (float)
- Returns:
U1 gate instance
- Return type:
Examples
>>> import math >>> gate = U1(0, math.pi/2) # π/2 rotation around Z-axis >>> gate = U1(1, math.pi, [0]) # Controlled-U1
Notes
If you need to use functions specific to the
U1Gateclass, please downcast it.
- scaluq.default.f64.gate.U2(target, phi, lambda_, controls=[], control_values=[])
Generate general
Gateclass instance ofU2Gate.- Parameters:
target (int) – Target qubit index
phi (float) – Rotation angle in radians
lambda (float) – Rotation angle in radians
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
lambda_ (float)
- Returns:
U2 gate instance
- Return type:
Examples
>>> import math >>> gate = U2(0, math.pi/2, math.pi) # π/2 rotation around Z-axis >>> gate = U2(1, math.pi, math.pi/2, [0]) # Controlled-U2
Notes
If you need to use functions specific to the
U2Gateclass, please downcast it.
- scaluq.default.f64.gate.U3(target, theta, phi, lambda_, controls=[], control_values=[])
Generate general
Gateclass instance ofU3Gate.- Parameters:
target (int) – Target qubit index
theta (float) – Rotation angle in radians
phi (float) – Rotation angle in radians
lambda (float) – Rotation angle in radians
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
lambda_ (float)
- Returns:
U3 gate instance
- Return type:
Examples
>>> import math >>> gate = U3(0, math.pi/2, math.pi, math.pi) # π/2 rotation around Z-axis >>> gate = U3(1, math.pi, math.pi/2, math.pi, [0]) # Controlled-U3
Notes
If you need to use functions specific to the
U3Gateclass, please downcast it.
- scaluq.default.f64.gate.Swap(target1, target2, controls=[], control_values=[])
Generate SWAP gate. Swaps the states of two qubits.
- Parameters:
target1 (int) – First target qubit index
target2 (int) – Second target qubit index
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
SWAP gate instance
- Return type:
Examples
>>> gate = Swap(0, 1) # Swap qubits 0 and 1 >>> gate = Swap(1, 2, [0]) # Controlled-SWAP
Notes
If you need to use functions specific to the
SwapGateclass, please downcast it.
- scaluq.default.f64.gate.Ecr(physical_control, physical_target, controls=[], control_values=[])
Generate ECR gate. Echoed cross-resonance gate.
- Parameters:
physical_control (int) – Physical control qubit index
physical_target (int) – Physical target qubit index
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
Ecr gate instance
- Return type:
Examples
>>> gate = Ecr(0, 1) # control : 0 and target : 1 >>> gate = Ecr(1, 2, [0]) #Controlled-ECR
Notes
If you need to use functions specific to the
EcrGateclass, please downcast it.
- scaluq.default.f64.gate.CX(control, target)
Generate general
Gateclass instance ofXGatewith one control qubit. Performs controlled-X operation.- Parameters:
control (int) – Control qubit index
target (int) – Target qubit index
- Returns:
CX gate instance
- Return type:
Examples
>>> gate = CX(0, 1) # CX gate with control on qubit 0 >>> gate = CX(1, 2) # CX gate with control on qubit 1
Notes
CX is a specialization of X. If you need to use functions specific to the
XGateclass, please downcast it.
- scaluq.default.f64.gate.CNot(control, target)
Generate general
Gateclass instance ofXGatewith one control qubit. Performs controlled-X operation.- Parameters:
control (int) – Control qubit index
target (int) – Target qubit index
- Returns:
CNot gate instance
- Return type:
Examples
>>> gate = CNot(0, 1) # CNot gate with control on qubit 0 >>> gate = CNot(1, 2) # CNot gate with control on qubit 1
Notes
CNot is an alias of CX. If you need to use functions specific to the
XGateclass, please downcast it.
- scaluq.default.f64.gate.CZ(control, target)
Generate general
Gateclass instance ofZGatewith one control qubit. Performs controlled-Z operation.- Parameters:
control (int) – Control qubit index
target (int) – Target qubit index
- Returns:
CZ gate instance
- Return type:
Examples
>>> gate = CZ(0, 1) # CZ gate with control on qubit 0 >>> gate = CZ(1, 2) # CZ gate with control on qubit 1
Notes
CZ is a specialization of Z. If you need to use functions specific to the
ZGateclass, please downcast it.
- scaluq.default.f64.gate.CCX(control1, control2, target)
Generate general
Gateclass instance ofXGatewith two control qubits. Performs controlled-controlled-X operation.- Parameters:
control1 (int) – First control qubit index
control2 (int) – Second control qubit index
target (int) – Target qubit index
- Returns:
CCX gate instance
- Return type:
Examples
>>> gate = CCX(0, 1, 2) # CCX gate with controls on qubits 0 and 1 >>> gate = CCX(1, 2, 3) # CCX gate with controls on qubits 1 and 2
Notes
If you need to use functions specific to the
XGateclass, please downcast it.
- scaluq.default.f64.gate.CCNot(control1, control2, target)
Generate general
Gateclass instance ofXGatewith two control qubits. Performs controlled-controlled-X operation.- Parameters:
control1 (int) – First control qubit index
control2 (int) – Second control qubit index
target (int) – Target qubit index
- Returns:
CCNot gate instance
- Return type:
Examples
>>> gate = CCNot(0, 1, 2) # CCNot gate with controls on qubits 0 and 1 >>> gate = CCNot(1, 2, 3) # CCNot gate with controls on qubits 1 and 2
Notes
CCNot is an alias of CCX. If you need to use functions specific to the
XGateclass, please downcast it.
- scaluq.default.f64.gate.Toffoli(control1, control2, target)
Generate general
Gateclass instance ofXGatewith two control qubits. Performs controlled-controlled-X operation.- Parameters:
control1 (int) – First control qubit index
control2 (int) – Second control qubit index
target (int) – Target qubit index
- Returns:
Toffoli gate instance
- Return type:
Examples
>>> gate = Toffoli(0, 1, 2) # Toffoli gate with controls on qubits 0 and 1 >>> gate = Toffoli(1, 2, 3) # Toffoli gate with controls on qubits 1 and 2
Notes
Toffoli is an alias of CCX. If you need to use functions specific to the
XGateclass, please downcast it.
- scaluq.default.f64.gate.Pauli(pauli, controls=[], control_values=[])
Generate general
Gateclass instance ofPauliGate. Performs Pauli operation.- Parameters:
pauli (PauliOperator) – Pauli operator
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
Pauli gate instance
- Return type:
Examples
>>> pauli = PauliOperator('X 0') >>> gate = Pauli(pauli) >>> gate = Pauli(pauli, [1]) # Controlled-Pauli
Notes
If you need to use functions specific to the
PauliGateclass, please downcast it.
- scaluq.default.f64.gate.PauliRotation(pauli, theta, controls=[], control_values=[])
Generate general
Gateclass instance ofPauliRotationGate. Performs Pauli rotation operation.- Parameters:
pauli (PauliOperator) – Pauli operator
theta (float) – Rotation angle in radians
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
PauliRotation gate instance
- Return type:
Examples
>>> pauli = PauliOperator('X 0') >>> import math >>> gate = PauliRotation(pauli, math.pi/2) >>> gate = PauliRotation(pauli, math.pi/2, [1]) # Controlled-Pauli
Notes
If you need to use functions specific to the
PauliRotationGateclass, please downcast it.
- scaluq.default.f64.gate.Probabilistic(distribution, gate_list)
Generate general
Gateclass instance ofProbabilisticGate. Performs probabilistic operation.- Parameters:
distribution (list[float]) – Probabilistic distribution
gate_list (list[Gate]) – List of gates
- Returns:
Probabilistic gate instance
- Return type:
Examples
>>> distribution = [0.3, 0.7] >>> gate_list = [X(0), Y(0)] >>> # X is applied with probability 0.3, Y is applied with probability 0.7 >>> gate = Probabilistic(distribution, gate_list)
Notes
If you need to use functions specific to the
ProbabilisticGateclass, please downcast it.
- scaluq.default.f64.gate.BitFlipNoise(target, error_rate)
Generates a general Gate class instance of BitFlipNoise. error_rate is the probability of a bit-flip noise, corresponding to the X gate.
- Parameters:
target (int)
error_rate (float)
- Return type:
scaluq.scaluq_core.default.f64.Gate
- scaluq.default.f64.gate.DephasingNoise(target, error_rate)
Generates a general Gate class instance of DephasingNoise. error_rate is the probability of a dephasing noise, corresponding to the Z gate.
- Parameters:
target (int)
error_rate (float)
- Return type:
scaluq.scaluq_core.default.f64.Gate
- scaluq.default.f64.gate.BitFlipAndDephasingNoise(target, error_rate)
Generates a general Gate class instance of BitFlipAndDephasingNoise. error_rate is the probability of both bit-flip noise and dephasing noise, corresponding to the X gate and Z gate.
- Parameters:
target (int)
error_rate (float)
- Return type:
scaluq.scaluq_core.default.f64.Gate
- scaluq.default.f64.gate.DepolarizingNoise(target, error_rate)
Generates a general Gate class instance of DepolarizingNoise. error_rate is the total probability of depolarizing noise, where an X, Y, or Z gate is applied with a probability of error_rate / 3 each.
- Parameters:
target (int)
error_rate (float)
- Return type:
scaluq.scaluq_core.default.f64.Gate
- scaluq.default.f64.gate.ParamRX(target, coef=1.0, controls=[], control_values=[])
Generate general
ParamGateclass instance ofParamRXGate.- Parameters:
target (int) – Target qubit index
coef (float, optional) – Parameter coefficient
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
ParamRX gate instance
- Return type:
Examples
>>> gate = ParamRX(0) # ParamRX gate on qubit 0 >>> gate = ParamRX(1, controls=[0]) # Controlled-ParamRX
Notes
If you need to use functions specific to the
ParamRXGateclass, please downcast it.
- scaluq.default.f64.gate.ParamRY(target, coef=1.0, controls=[], control_values=[])
Generate general
ParamGateclass instance ofParamRYGate.- Parameters:
target (int) – Target qubit index
coef (float, optional) – Parameter coefficient
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
ParamRY gate instance
- Return type:
Examples
>>> gate = ParamRY(0) # ParamRY gate on qubit 0 >>> gate = ParamRY(1, controls=[0]) # Controlled-ParamRY
Notes
If you need to use functions specific to the
ParamRYGateclass, please downcast it.
- scaluq.default.f64.gate.ParamRZ(target, coef=1.0, controls=[], control_values=[])
Generate general
ParamGateclass instance ofParamRZGate.- Parameters:
target (int) – Target qubit index
coef (float, optional) – Parameter coefficient
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
ParamRZ gate instance
- Return type:
Examples
>>> gate = ParamRZ(0) # ParamRZ gate on qubit 0 >>> gate = ParamRZ(1, controls=[0]) # Controlled-ParamRZ
Notes
If you need to use functions specific to the
ParamRZGateclass, please downcast it.
- scaluq.default.f64.gate.ParamPauliRotation(pauli, coef=1.0, controls=[], control_values=[])
Generate general
ParamGateclass instance ofParamPauliRotationGate.- Parameters:
pauli (PauliOperator) – Pauli operator
coef (float, optional) – Parameter coefficient
controls (list[int], optional) – Control qubit indices
control_values (list[int], optional) – Control qubit values
- Returns:
ParamPauliRotation gate instance
- Return type:
Examples
>>> gate = ParamPauliRotation(PauliOperator(), 0.5) # Pauli rotation gate with PauliOperator and coefficient 0.5 >>> gate = ParamPauliRotation(PauliOperator(), 0.5, [0]) # Controlled-ParamPauliRotation
Notes
If you need to use functions specific to the
ParamPauliRotationGateclass, please downcast it.
- scaluq.default.f64.gate.ParamProbabilistic(distribution, gate_list)
Generate general
ParamGateclass instance ofParamProbabilisticGate.- Parameters:
- Returns:
ParamProbabilistic gate instance
- Return type:
Examples
>>> gate = ParamProbabilistic([0.1, 0.9], [X(0), ParamRX(0, 0.5)]) # probabilistic gate with X and ParamRX
- scaluq.default.f64.gate.ParamProbabilistic(prob_gate_list)
Generate general
ParamGateclass instance ofParamProbabilisticGate.- Parameters:
prob_gate_list (list[tuple[float, Union[Gate, ParamGate]]]) – List of tuple of probability and gate
- Returns:
ParamProbabilistic gate instance
- Return type:
Examples
>>> gate = ParamProbabilistic([(0.1, X(0)), (0.9, I())]) # probabilistic gate with X and I