cirq.ops.PhasedFSimGate

General excitation-preserving two-qubit gate.

Inherits From: TwoQubitGate, Gate, InterchangeableQubitsGate

The unitary matrix of PhasedFSimGate(θ, ζ, χ, γ, φ) is:

[[1,                       0,                       0,            0],
 [0,    exp(-iγ - iζ) cos(θ), -i exp(-iγ + iχ) sin(θ),            0],
 [0, -i exp(-iγ - iχ) sin(θ),    exp(-iγ + iζ) cos(θ),            0],
 [0,                       0,                       0, exp(-2iγ-iφ)]].

This parametrization follows eq (18) in https://arxiv.org/abs/2010.07965 See also eq (43) in https://arxiv.org/abs/1910.11333 for an older variant which uses the same θ and φ parameters, but its three phase angles have different names and opposite sign. Specifically, ∆+ angle corresponds to -γ, ∆- corresponds to -ζ and ∆-,off corresponds to -χ.

Another useful parametrization of PhasedFSimGate is based on the fact that the gate is equivalent up to global phase to the following circuit:

0: ───Rz(α0)───FSim(θ, φ)───Rz(β0)───
               │
1: ───Rz(α1)───FSim(θ, φ)───Rz(β1)───

where α0 and α1 are Rz angles to be applied before the core FSimGate, β0 and β1 are Rz angles to be applied after FSimGate and θ and φ specify the core FSimGate. Use the static factory function from_fsim_rz to instantiate the gate using this parametrization.

Note that the θ and φ parameters in the two parametrizations are the same.

The matrix above is block diagonal where the middle block may be any element of U(2) and the bottom right block may be any element of U(1). Consequently, five real parameters are required to specify an instance of PhasedFSimGate. Therefore, the second parametrization is not injective. Indeed, for any angle δ

cirq.PhasedFSimGate.from_fsim_rz(θ, φ, (α0, α1), (β0, β1))

and

cirq.PhasedFSimGate.from_fsim_rz(θ, φ,
                                 (α0 + δ, α1 + δ),
                                 (β0 - δ, β1 - δ))

specify the same gate and therefore the two instances will compare as equal up to numerical error. Another consequence of the non-injective character of the second parametrization is the fact that the properties rz_angles_before and rz_angles_after may return different Rz angles than the ones used in the call to from_fsim_rz.

This gate is generally not symmetric under exchange of qubits. It becomes symmetric if both of the following conditions are satisfied:

  • ζ = kπ or θ = π/2 + lπ for k and l integers,
  • χ = kπ or θ = lπ for k and l integers.

rz_angles_after Returns 2-tuple of phase angles applied to qubits after FSimGate.
rz_angles_before Returns 2-tuple of phase angles applied to qubits before FSimGate.

Methods

controlled

View source

Returns a controlled version of this gate. If no arguments are specified, defaults to a single qubit control.

num_controls: Total number of control qubits. control_values: For which control qubit values to apply the sub gate. A sequence of length num_controls where each entry is an integer (or set of integers) corresponding to the qubit value (or set of possible values) where that control is enabled. When all controls are enabled, the sub gate is applied. If unspecified, control values default to 1. control_qid_shape: The qid shape of the controls. A tuple of the expected dimension of each control qid. Defaults to (2,) * num_controls. Specify this argument when using qudits.

from_fsim_rz

View source

Creates PhasedFSimGate using an alternate parametrization.

Args
theta Swap angle on the |01⟩ |10⟩ subspace, in radians. See class docstring above for details.
phi Controlled phase angle, in radians. See class docstring above for details.
rz_angles_before 2-tuple of phase angles to apply to each qubit before the core FSimGate. See class docstring for details.
rz_angles_after 2-tuple of phase angles to apply to each qubit after the core FSimGate. See class docstring for details.

num_qubits

View source

The number of qubits this gate acts on.

on

View source

Returns an application of this gate to the given qubits.

Args
*qubits The collection of qubits to potentially apply the gate to.

qubit_index_to_equivalence_group_key

View source

Returns a key that differs between non-interchangeable qubits.

validate_args

View source

Checks if this gate can be applied to the given qubits.

By default checks that:

  • inputs are of type Qid
  • len(qubits) == num_qubits()
  • qubit_i.dimension == qid_shape[i] for all qubits

Child classes can override. The child implementation should call super().validate_args(qubits) then do custom checks.

Args
qubits The sequence of qubits to potentially apply the gate to.

Throws:

  • ValueError: The gate can't be applied to the qubits.

with_probability

View source

wrap_in_linear_combination

View source

__add__

View source

__call__

View source

Call self as a function.

__eq__

View source

__mul__

View source

__ne__

View source

__neg__

View source

__pow__

View source

__rmul__

View source

__sub__

View source

__truediv__

View source