Generate the initial state of the quantum walk.
Parameters: | initState (array) – an \(n\times 3\) array, containing the initial state of the quantum walker in the format [[x1,y1,amp1],[x2,y2,amp2],...]. |
---|---|
Returns: | : this creates a PETSc vector containing the initial state, accessed via the attribute Line2P.psi0. |
Return type: | petsc4py.PETSc.Vec() |
Example
For a CTQW initially located in state \(\left|\psi(0)\right\rangle = \frac{1}{\sqrt{2}}\left|0\right\rangle \otimes \left|0\right\rangle - \frac{i}{\sqrt{2}} \left|2\right\rangle\otimes \left|2\right\rangle\), the initial state would be created like so:
>>> import numpy as np
>>> init_state = [[0,0,1./np.sqrt(2.)], [2,2,-1j./np.sqrt(2.)]]
>>> walk.createInitState(init_state)
Fortran interface
This function calls the Fortran function p2_init().