Skip to main content

permuted

Method of Qbit.

permuted(const List<integer> permutation) -> Qbit

Returns a copy of the product state with its qubits permuted according to the specified permutation vector.

The permutation vector specifies the new ordering of the qubits. For example, given a Qbit object with 5 sites, the permutation vector [2,1,4,3,0] will move the qubit at site 2 to site 0, the qubit at site 1 to site 1, the qubit at site 4 to site 2, the qubit at site 3 to site 3 and the qubit at site 0 to site 4.

Parameters

  • permutation: A vector of integers representing the permutation to be applied.

Example

Qbit("10110").permuted([2,1,4,3,0]) // Returns (1 + 0i)|00111>