Init with complex magnitudes of each qubit

Suppose that one needs to have an initial state

$\displaystyle \vert\psi_{ini}\rangle=\bigotimes_{i=1}^n(\alpha_i\vert_i\rangle+\beta_i\vert 1_i\rangle)$ (1)

( $ \alpha_i,\beta_i\in\mathbf{C}$, $ \vert\alpha_i\vert^2+\vert\beta_i\vert^2=1$). This can be done by the command
init ($ \alpha_1$)($ \beta_1$) ($ \alpha_2$)($ \beta_2$) ... ($ \alpha_n$)($ \beta_n$);
where each $ \alpha_i$ or $ \beta_i$ is written in the style of ``a+bi'' or ``r ej $ \theta$'', e.g.,
init (i)(0) (0)(1ej0.25pi) (0.7071)(0.7071);
set the initial state to

$\displaystyle \begin{pmatrix}i\\ 0\end{pmatrix}\otimes \begin{pmatrix}0\\ e^{i 0.25\pi}\end{pmatrix}\otimes \begin{pmatrix}0.7071\\ 0.7071\end{pmatrix}.$ (2)

Note that ``pi'' (this means $ \pi$) or ``deg'' (this means degree) may be used only in the argument $ \theta$ of an ascii string in the style of ``r ej $ \theta$''.

root
2004-11-07