Skip to main content

swap

Method of Qbit.

swap(integer site_1, integer site_2) -> Qbit

This methods swaps the qubits of the product state at the specified sites in place.

Parameters

  • site_1: Site of the first qubit to swap.
  • site_2: Site of the second qubit to swap.

Example

Qbit("101").swap(0,1) // Returns (1 + 0i)|011>