hiperwalk.Coined.state#

Coined.state(entries)[source]#

Generates a valid state.

The state corresponds to the walker being in a superposition of the entries. The final state is normalized in order to be a unit vector.

Parameters:
entrieslist of entry

Each entry is a tuple (or array). An entry can be specified in two different ways: (amplitude, (tail, head)), and (amplitude, arc_number).

amplitude

The amplitude of the given entry.

tail

The vertex corresponding to the position of the walker in the superposition. In other words, the tail of the arc. The tuple (tail, head) must be a valid arc.

head

The vertex to which the coin is pointing. The tuple (tail, head) must be a valid arc.

arc_number

The numerical arc label with respect to the arc ordering given by the computational basis.

Notes

If there are repeated arcs, the amplitude of the last entry is used.

Examples

The following commands generate the same state on a (dim, dim)-dimensional grid.

>>> psi = qw.state([(1, (0, 1)), [1, 1], (1, 2)])
>>> psi1 = qw.state([(1, ([0, 0], [0, 1])),
...                  [1, [(0, 0), (dim - 1, 0)]],
...                  (1, (0, 1))])
>>> psi2 = qw.state([(1, [[0, 0], [0, 1]]),
...                  [1, ((0, 0), (dim - 1, 0))],
...                  (1, [0, 1])])
>>> np.all(psi == psi1)
True
>>> np.all(psi1 == psi2)
True