scaluq.host.f64.gate ==================== .. py:module:: scaluq.host.f64.gate .. autoapi-nested-parse:: Define gates. Functions --------- .. autoapisummary:: scaluq.host.f64.gate.DenseMatrix scaluq.host.f64.gate.SparseMatrix scaluq.host.f64.gate.I scaluq.host.f64.gate.GlobalPhase scaluq.host.f64.gate.X scaluq.host.f64.gate.Y scaluq.host.f64.gate.Z scaluq.host.f64.gate.H scaluq.host.f64.gate.S scaluq.host.f64.gate.Sdag scaluq.host.f64.gate.T scaluq.host.f64.gate.Tdag scaluq.host.f64.gate.SqrtX scaluq.host.f64.gate.SqrtXdag scaluq.host.f64.gate.SqrtY scaluq.host.f64.gate.SqrtYdag scaluq.host.f64.gate.P0 scaluq.host.f64.gate.P1 scaluq.host.f64.gate.Measurement scaluq.host.f64.gate.RX scaluq.host.f64.gate.RY scaluq.host.f64.gate.RZ scaluq.host.f64.gate.U1 scaluq.host.f64.gate.U2 scaluq.host.f64.gate.U3 scaluq.host.f64.gate.Swap scaluq.host.f64.gate.Ecr scaluq.host.f64.gate.CX scaluq.host.f64.gate.CNot scaluq.host.f64.gate.CZ scaluq.host.f64.gate.CCX scaluq.host.f64.gate.CCNot scaluq.host.f64.gate.Toffoli scaluq.host.f64.gate.Pauli scaluq.host.f64.gate.PauliRotation scaluq.host.f64.gate.Probabilistic scaluq.host.f64.gate.BitFlipNoise scaluq.host.f64.gate.DephasingNoise scaluq.host.f64.gate.BitFlipAndDephasingNoise scaluq.host.f64.gate.DepolarizingNoise scaluq.host.f64.gate.ParamRX scaluq.host.f64.gate.ParamRY scaluq.host.f64.gate.ParamRZ scaluq.host.f64.gate.ParamPauliRotation scaluq.host.f64.gate.ParamProbabilistic scaluq.host.f64.gate.ParamProbabilistic Package Contents ---------------- .. py:function:: DenseMatrix(targets, matrix, controls = [], control_values = [], is_unitary = False) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.DenseMatrixGate`. Performs dense matrix operation. :param targets: Target qubit indices :type targets: list[int] :param matrix: Matrix to be applied :type matrix: numpy.ndarray :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :param is_unitary: Whether the matrix is unitary. When the flag indicating that the gate is unitary is set to True, a more efficient implementation is used. :type is_unitary: bool, optional :returns: DenseMatrix gate instance :rtype: Gate .. rubric:: Examples >>> import numpy as np >>> matrix = np.array([[1, 0], [0, 1]]) >>> gate = DenseMatrix([0], matrix) >>> gate = DenseMatrix([0], matrix, [1]) # Controlled-DenseMatrix .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.DenseMatrixGate` class, please downcast it. .. py:function:: SparseMatrix(targets, matrix, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.SparseMatrixGate`. Performs sparse matrix operation. :param targets: Target qubit indices :type targets: list[int] :param matrix: Matrix to be applied :type matrix: scipy.sparse.csr_matrix :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: SparseMatrix gate instance :rtype: Gate .. rubric:: Examples >>> import scipy >>> matrix = scipy.sparse.csr_matrix([[1, 0], [0, 1]]) >>> gate = SparseMatrix([0], matrix) >>> gate = SparseMatrix([0], matrix, [1]) # Controlled-SparseMatrix .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.SparseMatrixGate` class, please downcast it. .. py:function:: I() Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.IGate`. :returns: Identity gate instance :rtype: Gate .. rubric:: Examples >>> gate = I() >>> print(gate) Gate Type: I Target Qubits: {} Control Qubits: {} Control Value: {} .. py:function:: GlobalPhase(gamma, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.GlobalPhaseGate`. :param gamma: Global phase angle in radians :type gamma: float :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: Global phase gate instance :rtype: Gate .. rubric:: Examples >>> import math >>> gate = GlobalPhase(math.pi/2) >>> print(gate) Gate Type: GlobalPhase Phase: 1.5708 Target Qubits: {} Control Qubits: {} Control Value: {} .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.GlobalPhaseGate` class, please downcast it. .. py:function:: X(target, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.XGate`. Performs bit flip operation. :param target: Target qubit index :type target: int :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: Pauli-X gate instance :rtype: Gate .. rubric:: Examples >>> gate = X(0) # X gate on qubit 0 >>> gate = X(1, [0]) # Controlled-X with control on qubit 0 .. rubric:: Notes XGate represents the Pauli-X (NOT) gate class.If you need to use functions specific to the :class:`~scaluq.f64.XGate` class, please downcast it. .. py:function:: Y(target, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.YGate`. Performs bit flip and phase flip operation. :param target: Target qubit index :type target: int :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: Pauli-Y gate instance :rtype: Gate .. rubric:: Examples >>> gate = Y(0) # Y gate on qubit 0 >>> gate = Y(1, [0]) # Controlled-Y with control on qubit 0 .. rubric:: Notes YGate represents the Pauli-Y gate class. If you need to use functions specific to the :class:`~scaluq.f64.YGate` class, please downcast it. .. py:function:: Z(target, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.ZGate`. Performs bit flip and phase flip operation. :param target: Target qubit index :type target: int :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: Pauli-Z gate instance :rtype: Gate .. rubric:: Examples >>> gate = Z(0) # Z gate on qubit 0 >>> gate = Z(1, [0]) # Controlled-Z with control on qubit 0 .. rubric:: Notes ZGate represents the Pauli-Z gate class. If you need to use functions specific to the :class:`~scaluq.f64.ZGate` class, please downcast it. .. py:function:: H(target, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.HGate`. Performs superposition operation. :param target: Target qubit index :type target: int :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: Hadamard gate instance :rtype: Gate .. rubric:: Examples >>> gate = H(0) # H gate on qubit 0 >>> gate = H(1, [0]) # Controlled-H with control on qubit 0 .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.HGate` class, please downcast it. .. py:function:: S(target, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.SGate`. :param target: Target qubit index :type target: int :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: S gate instance :rtype: Gate .. rubric:: Examples >>> gate = S(0) # S gate on qubit 0 >>> gate = S(1, [0]) # Controlled-S with control on qubit 0 .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.SGate` class, please downcast it. .. py:function:: Sdag(target, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.SdagGate`. :param target: Target qubit index :type target: int :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: Sdag gate instance :rtype: Gate .. rubric:: Examples >>> gate = Sdag(0) # Sdag gate on qubit 0 >>> gate = Sdag(1, [0]) # Controlled-Sdag with control on qubit 0 .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.SdagGate` class, please downcast it. .. py:function:: T(target, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.TGate`. :param target: Target qubit index :type target: int :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: T gate instance :rtype: Gate .. rubric:: Examples >>> gate = T(0) # T gate on qubit 0 >>> gate = T(1, [0]) # Controlled-T with control on qubit 0 .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.TGate` class, please downcast it. .. py:function:: Tdag(target, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.TdagGate`. :param target: Target qubit index :type target: int :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: Tdag gate instance :rtype: Gate .. rubric:: Examples >>> gate = Tdag(0) # Tdag gate on qubit 0 >>> gate = Tdag(1, [0]) # Controlled-Tdag with control on qubit 0 .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.TdagGate` class, please downcast it. .. py:function:: SqrtX(target, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.SqrtXGate`, represented as $\frac{1}{2}\begin{bmatrix} 1+i & 1-i \\ 1-i & 1+i \end{bmatrix}$. :param target: Target qubit index :type target: int :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: SqrtX gate instance :rtype: Gate .. rubric:: Examples >>> gate = SqrtX(0) # SqrtX gate on qubit 0 >>> gate = SqrtX(1, [0]) # Controlled-SqrtX .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.SqrtXGate` class, please downcast it. .. py:function:: SqrtXdag(target, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.SqrtXdagGate`, represented as $\begin{bmatrix} 1-i & 1+i\\ 1+i & 1-i \end{bmatrix}$. :param target: Target qubit index :type target: int :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: SqrtXdag gate instance :rtype: Gate .. rubric:: Examples >>> gate = SqrtXdag(0) # SqrtXdag gate on qubit 0 >>> gate = SqrtXdag(1, [0]) # Controlled-SqrtXdag .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.SqrtXdagGate` class, please downcast it. .. py:function:: SqrtY(target, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.SqrtYGate`, represented as $\begin{bmatrix} 1+i & -1-i \\ 1+i & 1+i \end{bmatrix}$. :param target: Target qubit index :type target: int :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: SqrtY gate instance :rtype: Gate .. rubric:: Examples >>> gate = SqrtY(0) # SqrtY gate on qubit 0 >>> gate = SqrtY(1, [0]) # Controlled-SqrtY .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.SqrtYGate` class, please downcast it. .. py:function:: SqrtYdag(target, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.SqrtYdagGate`, represented as $\begin{bmatrix} 1-i & 1-i \\ -1+i & 1-i \end{bmatrix}$. :param target: Target qubit index :type target: int :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: SqrtYdag gate instance :rtype: Gate .. rubric:: Examples >>> gate = SqrtYdag(0) # SqrtYdag gate on qubit 0 >>> gate = SqrtYdag(1, [0]) # Controlled-SqrtYdag .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.SqrtYdagGate` class, please downcast it. .. py:function:: P0(target, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.P0Gate`. :param target: Target qubit index :type target: int :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: P0 gate instance :rtype: Gate .. rubric:: Examples >>> gate = P0(0) # P0 gate on qubit 0 >>> gate = P0(1, [0]) # Controlled-P0 .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.P0Gate` class, please downcast it. .. py:function:: P1(target, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.P1Gate`. :param target: Target qubit index :type target: int :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: P1 gate instance :rtype: Gate .. rubric:: Examples >>> gate = P1(0) # P1 gate on qubit 0 >>> gate = P1(1, [0]) # Controlled-P1 .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.P1Gate` class, please downcast it. .. py:function:: Measurement(target, classical_bit, reset = False) Generate computational-basis measurement gate. :param target: Target qubit index :type target: int :param classical_bit: Destination classical bit index :type classical_bit: int :param reset: Whether to reset the target qubit to |0> :type reset: bool, optional :returns: Measurement gate instance :rtype: Gate .. rubric:: Examples >>> gate = Measurement(0, 1) .. rubric:: 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. .. py:function:: RX(target, theta, controls = [], control_values = []) Generate rotation gate around X-axis. Rotation angle is specified in radians. :param target: Target qubit index :type target: int :param theta: Rotation angle in radians :type theta: float :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: RX gate instance :rtype: Gate .. rubric:: Examples >>> import math >>> gate = RX(0, math.pi/2) # π/2 rotation around X-axis >>> gate = RX(1, math.pi, [0]) # Controlled-RX .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.RXGate` class, please downcast it. .. py:function:: RY(target, theta, controls = [], control_values = []) Generate rotation gate around Y-axis. Rotation angle is specified in radians. :param target: Target qubit index :type target: int :param theta: Rotation angle in radians :type theta: float :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: RY gate instance :rtype: Gate .. rubric:: Examples >>> import math >>> gate = RY(0, math.pi/2) # π/2 rotation around Y-axis >>> gate = RY(1, math.pi, [0]) # Controlled-RY .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.RYGate` class, please downcast it. .. py:function:: RZ(target, theta, controls = [], control_values = []) Generate rotation gate around Z-axis. Rotation angle is specified in radians. :param target: Target qubit index :type target: int :param theta: Rotation angle in radians :type theta: float :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: RZ gate instance :rtype: Gate .. rubric:: Examples >>> import math >>> gate = RZ(0, math.pi/2) # π/2 rotation around Z-axis >>> gate = RZ(1, math.pi, [0]) # Controlled-RZ .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.RZGate` class, please downcast it. .. py:function:: U1(target, lambda_, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.U1Gate`. :param target: Target qubit index :type target: int :param lambda_: Rotation angle in radians :type lambda_: float :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: U1 gate instance :rtype: Gate .. rubric:: Examples >>> import math >>> gate = U1(0, math.pi/2) # π/2 rotation around Z-axis >>> gate = U1(1, math.pi, [0]) # Controlled-U1 .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.U1Gate` class, please downcast it. .. py:function:: U2(target, phi, lambda_, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.U2Gate`. :param target: Target qubit index :type target: int :param phi: Rotation angle in radians :type phi: float :param lambda_: Rotation angle in radians :type lambda_: float :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: U2 gate instance :rtype: Gate .. rubric:: 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 .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.U2Gate` class, please downcast it. .. py:function:: U3(target, theta, phi, lambda_, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.U3Gate`. :param target: Target qubit index :type target: int :param theta: Rotation angle in radians :type theta: float :param phi: Rotation angle in radians :type phi: float :param lambda_: Rotation angle in radians :type lambda_: float :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: U3 gate instance :rtype: Gate .. rubric:: 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 .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.U3Gate` class, please downcast it. .. py:function:: Swap(target1, target2, controls = [], control_values = []) Generate SWAP gate. Swaps the states of two qubits. :param target1: First target qubit index :type target1: int :param target2: Second target qubit index :type target2: int :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: SWAP gate instance :rtype: Gate .. rubric:: Examples >>> gate = Swap(0, 1) # Swap qubits 0 and 1 >>> gate = Swap(1, 2, [0]) # Controlled-SWAP .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.SwapGate` class, please downcast it. .. py:function:: Ecr(physical_control, physical_target, controls = [], control_values = []) Generate ECR gate. Echoed cross-resonance gate. :param physical_control: Physical control qubit index :type physical_control: int :param physical_target: Physical target qubit index :type physical_target: int :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: Ecr gate instance :rtype: Gate .. rubric:: Examples >>> gate = Ecr(0, 1) # control : 0 and target : 1 >>> gate = Ecr(1, 2, [0]) #Controlled-ECR .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.EcrGate` class, please downcast it. .. py:function:: CX(control, target) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.XGate` with one control qubit. Performs controlled-X operation. :param control: Control qubit index :type control: int :param target: Target qubit index :type target: int :returns: CX gate instance :rtype: Gate .. rubric:: Examples >>> gate = CX(0, 1) # CX gate with control on qubit 0 >>> gate = CX(1, 2) # CX gate with control on qubit 1 .. rubric:: Notes CX is a specialization of X. If you need to use functions specific to the :class:`~scaluq.f64.XGate` class, please downcast it. .. py:function:: CNot(control, target) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.XGate` with one control qubit. Performs controlled-X operation. :param control: Control qubit index :type control: int :param target: Target qubit index :type target: int :returns: CNot gate instance :rtype: Gate .. rubric:: Examples >>> gate = CNot(0, 1) # CNot gate with control on qubit 0 >>> gate = CNot(1, 2) # CNot gate with control on qubit 1 .. rubric:: Notes CNot is an alias of CX. If you need to use functions specific to the :class:`~scaluq.f64.XGate` class, please downcast it. .. py:function:: CZ(control, target) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.ZGate` with one control qubit. Performs controlled-Z operation. :param control: Control qubit index :type control: int :param target: Target qubit index :type target: int :returns: CZ gate instance :rtype: Gate .. rubric:: Examples >>> gate = CZ(0, 1) # CZ gate with control on qubit 0 >>> gate = CZ(1, 2) # CZ gate with control on qubit 1 .. rubric:: Notes CZ is a specialization of Z. If you need to use functions specific to the :class:`~scaluq.f64.ZGate` class, please downcast it. .. py:function:: CCX(control1, control2, target) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.XGate` with two control qubits. Performs controlled-controlled-X operation. :param control1: First control qubit index :type control1: int :param control2: Second control qubit index :type control2: int :param target: Target qubit index :type target: int :returns: CCX gate instance :rtype: Gate .. rubric:: 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 .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.XGate` class, please downcast it. .. py:function:: CCNot(control1, control2, target) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.XGate` with two control qubits. Performs controlled-controlled-X operation. :param control1: First control qubit index :type control1: int :param control2: Second control qubit index :type control2: int :param target: Target qubit index :type target: int :returns: CCNot gate instance :rtype: Gate .. rubric:: 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 .. rubric:: Notes CCNot is an alias of CCX. If you need to use functions specific to the :class:`~scaluq.f64.XGate` class, please downcast it. .. py:function:: Toffoli(control1, control2, target) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.XGate` with two control qubits. Performs controlled-controlled-X operation. :param control1: First control qubit index :type control1: int :param control2: Second control qubit index :type control2: int :param target: Target qubit index :type target: int :returns: Toffoli gate instance :rtype: Gate .. rubric:: 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 .. rubric:: Notes Toffoli is an alias of CCX. If you need to use functions specific to the :class:`~scaluq.f64.XGate` class, please downcast it. .. py:function:: Pauli(pauli, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.PauliGate`. Performs Pauli operation. :param pauli: Pauli operator :type pauli: PauliOperator :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: Pauli gate instance :rtype: Gate .. rubric:: Examples >>> pauli = PauliOperator('X 0') >>> gate = Pauli(pauli) >>> gate = Pauli(pauli, [1]) # Controlled-Pauli .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.PauliGate` class, please downcast it. .. py:function:: PauliRotation(pauli, theta, controls = [], control_values = []) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.PauliRotationGate`. Performs Pauli rotation operation. :param pauli: Pauli operator :type pauli: PauliOperator :param theta: Rotation angle in radians :type theta: float :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: PauliRotation gate instance :rtype: Gate .. rubric:: Examples >>> pauli = PauliOperator('X 0') >>> import math >>> gate = PauliRotation(pauli, math.pi/2) >>> gate = PauliRotation(pauli, math.pi/2, [1]) # Controlled-Pauli .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.PauliRotationGate` class, please downcast it. .. py:function:: Probabilistic(distribution, gate_list) Generate general :class:`~scaluq.f64.Gate` class instance of :class:`~scaluq.f64.ProbabilisticGate`. Performs probabilistic operation. :param distribution: Probabilistic distribution :type distribution: list[float] :param gate_list: List of gates :type gate_list: list[Gate] :returns: Probabilistic gate instance :rtype: Gate .. rubric:: 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) .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.ProbabilisticGate` class, please downcast it. .. py:function:: 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. .. py:function:: 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. .. py:function:: 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. .. py:function:: 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. .. py:function:: ParamRX(target, coef = 1.0, controls = [], control_values = []) Generate general :class:`~scaluq.f64.ParamGate` class instance of :class:`~scaluq.f64.ParamRXGate`. :param target: Target qubit index :type target: int :param coef: Parameter coefficient :type coef: float, optional :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: ParamRX gate instance :rtype: ParamGate .. rubric:: Examples >>> gate = ParamRX(0) # ParamRX gate on qubit 0 >>> gate = ParamRX(1, controls=[0]) # Controlled-ParamRX .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.ParamRXGate` class, please downcast it. .. py:function:: ParamRY(target, coef = 1.0, controls = [], control_values = []) Generate general :class:`~scaluq.f64.ParamGate` class instance of :class:`~scaluq.f64.ParamRYGate`. :param target: Target qubit index :type target: int :param coef: Parameter coefficient :type coef: float, optional :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: ParamRY gate instance :rtype: ParamGate .. rubric:: Examples >>> gate = ParamRY(0) # ParamRY gate on qubit 0 >>> gate = ParamRY(1, controls=[0]) # Controlled-ParamRY .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.ParamRYGate` class, please downcast it. .. py:function:: ParamRZ(target, coef = 1.0, controls = [], control_values = []) Generate general :class:`~scaluq.f64.ParamGate` class instance of :class:`~scaluq.f64.ParamRZGate`. :param target: Target qubit index :type target: int :param coef: Parameter coefficient :type coef: float, optional :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: ParamRZ gate instance :rtype: ParamGate .. rubric:: Examples >>> gate = ParamRZ(0) # ParamRZ gate on qubit 0 >>> gate = ParamRZ(1, controls=[0]) # Controlled-ParamRZ .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.ParamRZGate` class, please downcast it. .. py:function:: ParamPauliRotation(pauli, coef = 1.0, controls = [], control_values = []) Generate general :class:`~scaluq.f64.ParamGate` class instance of :class:`~scaluq.f64.ParamPauliRotationGate`. :param pauli: Pauli operator :type pauli: PauliOperator :param coef: Parameter coefficient :type coef: float, optional :param controls: Control qubit indices :type controls: list[int], optional :param control_values: Control qubit values :type control_values: list[int], optional :returns: ParamPauliRotation gate instance :rtype: ParamGate .. rubric:: Examples >>> gate = ParamPauliRotation(PauliOperator(), 0.5) # Pauli rotation gate with PauliOperator and coefficient 0.5 >>> gate = ParamPauliRotation(PauliOperator(), 0.5, [0]) # Controlled-ParamPauliRotation .. rubric:: Notes If you need to use functions specific to the :class:`~scaluq.f64.ParamPauliRotationGate` class, please downcast it. .. py:function:: ParamProbabilistic(distribution, gate_list) Generate general :class:`~scaluq.f64.ParamGate` class instance of :class:`~scaluq.f64.ParamProbabilisticGate`. :param distribution: List of probability :type distribution: list[float] :param gate_list: List of gates :type gate_list: list[Union[Gate, ParamGate]] :returns: ParamProbabilistic gate instance :rtype: ParamGate .. rubric:: Examples >>> gate = ParamProbabilistic([0.1, 0.9], [X(0), ParamRX(0, 0.5)]) # probabilistic gate with X and ParamRX .. py:function:: ParamProbabilistic(prob_gate_list) Generate general :class:`~scaluq.f64.ParamGate` class instance of :class:`~scaluq.f64.ParamProbabilisticGate`. :param prob_gate_list: List of tuple of probability and gate :type prob_gate_list: list[tuple[float, Union[Gate, ParamGate]]] :returns: ParamProbabilistic gate instance :rtype: ParamGate .. rubric:: Examples >>> gate = ParamProbabilistic([(0.1, X(0)), (0.9, I())]) # probabilistic gate with X and I