# cirq.SwapGate¶

class cirq.SwapGate(*, half_turns: Union[cirq.value.symbol.Symbol, float] = 1.0)[source]

Swaps two qubits.

__init__(*, half_turns: Union[cirq.value.symbol.Symbol, float] = 1.0) → None[source]

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

Methods

 default_decompose(qubits) See base class. extrapolate_effect(factor) inverse() is_parameterized() Whether the effect is parameterized. known_qasm_output(qubits, …], args) Returns lines of QASM output representing the gate on the given qubits or None if a simple conversion is not possible. matrix() on(*qubits) Returns an application of this gate to the given qubits. qubit_index_to_equivalence_group_key(index) Returns a key that differs between non-interchangeable qubits. text_diagram_info(args) Describes how to draw something in a text diagram. trace_distance_bound() A maximum on the trace distance between this effect’s input/output. try_cast_to(desired_type, ext) Turns this value into the desired type, if possible. validate_args(qubits) Checks if this gate can be applied to the given qubits. with_parameters_resolved_by(param_resolver) Resolve the parameters in the effect.

Attributes