hiperwalk.ContinuousTime.state#

ContinuousTime.state(entries)#

Generates a state in the Hilbert space.

The state corresponds to the walker being in a superposition of the given labels with the given amplitudes. The state is normalized in order to have a unitary norm.

Parameters:
entrieslist of entry

Each entry is a 2-tuple or array with format (amplitude, label). That is, an amplitude and the corresponding label of the computational basis.

Returns:
numpy.ndarray

Notes

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

Examples

The following commands generate the same state.

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