Skip to main content

integer

Overloads

NameDescription
integer(const Qbit qbit) -> integerReturns the integer representation of the qubit state.
integer(const Fbit fbit) -> integerReturns the integer representation of the fermionic product state.

integer(const Qbit qbit) -> integer

Returns the integer representation of the qubit state.

Given the product state s0s1...sN1\vert s_0 s_1 ... s_{N-1} \rangle, then the integer method returns s020+s121+...+sN12N1s_02^0 + s_12^1 + ... + s_{N-1}2^{N-1}, where NN is the number of sites.

Example

Qbit("0011").integer() // Returns (2**2 + 2**3) = 12

integer(const Fbit fbit) -> integer

Returns the integer representation of the fermionic product state.

Given the product state \verts0s1...sN1\verts_0 s_1 ... s_{N-1} \rangle, then the get_representation method returns s020+s121+...+sN12N1s_02^0 + s_12^1 + ... + s_{N-1}2^{N-1}, where NN is the number of sites.

Example

integer(Fbit("0011")) // Returns (2**2 + 2**3) = 12