quimb.gen.states¶
Functions for generating quantum states.
Attributes¶
Functions¶
|
Constructs a unit vector ket: |
|
Returns up-state, aka. |
|
Returns down-state, aka. |
|
Returns plus-state, aka. |
|
Returns minus-state, aka. |
|
Returns yplus-state, aka. |
|
Returns yplus-state, aka. |
|
Construct qubit density operator from bloch vector: |
|
One of the four bell-states. |
|
Alias for the 'psi-' bell-state. |
|
Generate a thermal state of a Hamiltonian. |
|
Generate the qubit computational state with |
|
Construct Neel state for n spins, i.e. alternating up/down. |
|
Construct fully dimerised spin chain. |
|
Construct Werner State, i.e. fractional mix of identity with singlet. |
|
Construct GHZ state of n spins, i.e. equal superposition of all up |
|
Construct W-state: equal superposition of all single spin up states. |
|
Compute the generalised levi-civita coefficient for a permutation. |
|
Construct the anti-symmetric state which is the +- sum of all |
|
Graph State on a line. |
Module Contents¶
- quimb.gen.states.basis_vec(i, dim, ownership=None, **kwargs)[source]¶
Constructs a unit vector ket:
\[\begin{split}|i\rangle = \begin{pmatrix} 0 \\ \vdots \\ 1 \\ \vdots \\ 0 \end{pmatrix}\end{split}\]
- quimb.gen.states.up(**kwargs)[source]¶
Returns up-state, aka.
|0>
, +Z eigenstate:\[\begin{split}|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}\end{split}\]
- quimb.gen.states.down(**kwargs)[source]¶
Returns down-state, aka.
|1>
, -Z eigenstate:\[\begin{split}|1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}\end{split}\]
- quimb.gen.states.plus(**kwargs)[source]¶
Returns plus-state, aka.
|+>
, +X eigenstate:\[\begin{split}|+\rangle = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix}\end{split}\]
- quimb.gen.states.minus(**kwargs)[source]¶
Returns minus-state, aka.
|->
, -X eigenstate:\[\begin{split}|-\rangle = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ -1 \end{pmatrix}\end{split}\]
- quimb.gen.states.yplus(**kwargs)[source]¶
Returns yplus-state, aka.
|y+>
, +Y eigenstate:\[\begin{split}|y+\rangle = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ i \end{pmatrix}\end{split}\]
- quimb.gen.states.yminus(**kwargs)[source]¶
Returns yplus-state, aka.
|y->
, -Y eigenstate:\[\begin{split}|y-\rangle = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ -i \end{pmatrix}\end{split}\]
- quimb.gen.states.bloch_state(ax, ay, az, purified=False, **kwargs)[source]¶
Construct qubit density operator from bloch vector:
\[\rho = \frac{1}{2} \left( I + a_x X + a_y Y + a_z Z \right)\]
- quimb.gen.states.bell_state(s, **kwargs)[source]¶
One of the four bell-states.
If n = 2**-0.5, they are:
'psi-'
:n * ( |01> - |10> )
'psi+'
:n * ( |01> + |10> )
'phi-'
:n * ( |00> - |11> )
'phi+'
:n * ( |00> + |11> )
They can be enumerated in this order.
- quimb.gen.states.thermal_state(ham, beta, precomp_func=False)[source]¶
Generate a thermal state of a Hamiltonian.
- Parameters:
- Returns:
Density operator of thermal state, or function to generate such given a temperature.
- Return type:
operator or callable
- quimb.gen.states.computational_state(binary, **kwargs)[source]¶
Generate the qubit computational state with
binary
.- Parameters:
binary (sequence of 0s and 1s) – The binary of the computation state.
Examples
>>> computational_state('101'): qarray([[0.+0.j], [0.+0.j], [0.+0.j], [0.+0.j], [0.+0.j], [1.+0.j], [0.+0.j], [0.+0.j]])
>>> qu.computational_state([0, 1], qtype='dop') qarray([[0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], [0.+0.j, 1.+0.j, 0.+0.j, 0.+0.j], [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j]])
See also
MPS_computational_state
,basic_vec
- quimb.gen.states.neel_state(n, down_first=False, **kwargs)[source]¶
Construct Neel state for n spins, i.e. alternating up/down.
- Parameters:
See also
computational_state
,MPS_neel_state
- quimb.gen.states.singlet_pairs(n, **kwargs)[source]¶
Construct fully dimerised spin chain.
I.e.
bell_state('psi-') & bell_state('psi-') & ...
- Parameters:
n (int) – Number of spins.
kwargs – Supplied to
qu
called on state.
- Return type:
vector
- quimb.gen.states.werner_state(p, **kwargs)[source]¶
Construct Werner State, i.e. fractional mix of identity with singlet.
- quimb.gen.states.ghz_state(n, **kwargs)[source]¶
Construct GHZ state of n spins, i.e. equal superposition of all up and down.
- Parameters:
n (int) – Number of spins.
kwargs – Supplied to
qu
called on state.
- Return type:
vector
- quimb.gen.states.w_state(n, **kwargs)[source]¶
Construct W-state: equal superposition of all single spin up states.
- Parameters:
n (int) – Number of spins.
kwargs – Supplied to
qu
called on state.
- Return type:
vector
- quimb.gen.states.levi_civita(perm)[source]¶
Compute the generalised levi-civita coefficient for a permutation.
- quimb.gen.states.perm_state(ps)[source]¶
Construct the anti-symmetric state which is the +- sum of all tensored permutations of states
ps
.- Parameters:
ps (sequence of states) – The states to combine.
- Returns:
The permutation state, dimension same as
kron(*ps)
.- Return type:
vector or operator
Examples
A singlet is the
perm_state
of up and down.>>> states = [up(), down()] >>> pstate = perm_state(states) >>> expec(pstate, singlet()) 1.0