Skip to main content

flip

Method of Qbit.

Overloads​

NameDescription
flip(integer site) -> QbitThis method flips the qubit at the specified site in place.
flip(const List<integer> sites) -> QbitThis method modifies the Qbit object in place by flipping the state of the qubits at the specified sites.
flip() -> QbitThis method flips the value of all the qubits of the product state in place.

flip(integer site) -> Qbit​

This method flips the qubit at the specified site in place.

Parameters​

  • site: The site of the qubit being queried in the product state.

Example​

Qbit("00110").flip(2) // Returns (1 + 0i)|00010>

flip(const List<integer> sites) -> Qbit​

This method modifies the Qbit object in place by flipping the state of the qubits at the specified sites.

Parameters​

  • sites: A vector of integers representing the sites of the qubits to be flipped.

Example​

Qbit("00110").flip([0,1,3]) // Returns (1 + 0i)|11100>

flip() -> Qbit​

This method flips the value of all the qubits of the product state in place.

Example​

Qbit("0101").flip() // Returns (1 + 0i)|1010>