Subsections

4 Creating instances of states

Here are some methods for creating instances of states, from scratch or from other states. Although all operators `create' states in this sense, we omit most of them here, because they are better described as manipulating states.

4.1 ketz, braz,ketx, brax, kety, bray -- multipartite eigenstate kets and bras of $\sigma_x,\sigma_y,\sigma_z$

create normalized $n$-partite product states in the computational basis. In all cases the indices are $0$ or $1$. The pair ketz( ${i_1,\ldots,i_n}$) and braz( ${i_1,\ldots,i_n}$) produce eigenstates of $\sigma_z^{(1)} \otimes \cdots \otimes \sigma_z^{(n)}$, with the index $i=0$ selecting the state with eigenvalue $1$ and $i=1$ selecting the state with eigenvalue $-1$. In other words the ket produced represents ${\lvert i_1,i_2,\ldots,i_n \rangle}.$


\begin{boxedminipage}{2.0\linewidth}
\begin{verbatim}(%i3) ketz(1)
\end{verbat...
...\begin{dmath}[number={\%o3}]
\pmatrix{0\cr 1\cr }\end{dmath}\end{boxedminipage}





\begin{boxedminipage}{2.0\linewidth}
\begin{verbatim}(%i4) braz(1)
\end{verbat...
...th}[number={\%o4}]
\pmatrix{0&\linebreak[0]1\cr }\end{dmath}\end{boxedminipage}





\begin{boxedminipage}{2.0\linewidth}
\begin{verbatim}(%i5) braz(0)
\end{verbat...
...th}[number={\%o5}]
\pmatrix{1&\linebreak[0]0\cr }\end{dmath}\end{boxedminipage}


Here are the states ${\langle 00 \rvert},{\langle 11 \rvert},$ and $\alpha_0{\langle 00 \rvert} + \alpha_1{\langle 11 \rvert}$. (we show bras rather than kets to conserve space)


\begin{boxedminipage}{2.0\linewidth}
\begin{verbatim}(%i6) braz(0,0)
\end{verb...
...ak[0]0&\linebreak[0]0&\linebreak[0]\alpha_{1}\cr }\end{dmath}\end{boxedminipage}


The functions ketx , brax , kety , bray produce eigenstates of $\sigma_x^{(1)} \otimes \cdots \otimes \sigma_x^{(n)}$, or $\sigma_y^{(1)} \otimes \cdots \otimes \sigma_y^{(n)}$, with, as before, the index $i=0$ selecting the state with eigenvalue $1$ and $i=1$ selecting the state with eigenvalue $-1$.


\begin{boxedminipage}{2.0\linewidth}
\begin{verbatim}(%i9) brax(1)
\end{verbat...
...*\sqrt{2}}&\linebreak[0]\frac{i}{2\*\sqrt{2}}\cr }\end{dmath}\end{boxedminipage}


4.2 ket_n, bra_n -- alternate form of ketz, etc$.$

, ket_n( $j,i_1,\ldots,i_m$) and bra_n( $j,i_1,\ldots,i_m$) are an alternate way to call ketx, kety, etc. The index $j\in(1,2,3)$ is mapped to $(x,y,z)$ and the appropriate function, eg. ketx is called with the remaining arguments.

4.3 proj -- Density matrix representation of a pure state (projection operator)$.$

The projection operator (or equivalently, the density matrix) corresponding to a state vector is generated via the outer product, which is represented by the dot operator. A convenience function proj($ket$) is also provided to form a projection operator. The argument ket can be either a bra or a ket (ie column or row vector). ( proj does not check that ket is normalized.) Below, we use the Maxima function ctranspose for the complex transpose. Here is the outer product, or dyad ${\lvert 0 \rangle}{\langle 0 \rvert}$.


\begin{boxedminipage}{2.0\linewidth}
\begin{verbatim}(%i19) ketx(1) . brax(1);...
...}{2}\cr -\frac{1}{2}&\linebreak[0]\frac{1}{2}\cr }\end{dmath}\end{boxedminipage}


Compare this to the inner product


\begin{boxedminipage}{2.0\linewidth}
\begin{verbatim}(%i20) brax(1) . ketx(1);
\end{verbatim}
\begin{dmath}[number={\%o20}]
1\end{dmath}\end{boxedminipage}


Here are different ways to make ${\lvert 000 \rangle}{\langle 000 \rvert}$ and ${\lvert 101 \rangle}{\langle 101 \rvert}$.


\begin{boxedminipage}{2.0\linewidth}
\begin{verbatim}(%i21) is ( ketz(0,0,0) ....
...atim}
\begin{dmath}[number={\%o22}]
\mathbf{true}\end{dmath}\end{boxedminipage}


This example used Maxima's is($expr$)$\dagger$ function which tries to determine whether the predicate expr is true or false.

There is also a function tovect that is the inverse (up to a phase) of proj -- it returns the ket corresponding to a projection operator. If the input matrix is not a projection operator, the result is undefined.


\begin{boxedminipage}{2.0\linewidth}
\begin{verbatim}(%i17) is ( tovect( proj(...
...atim}
\begin{dmath}[number={\%o17}]
\mathbf{true}\end{dmath}\end{boxedminipage}


4.4 otimes, tensor_product, tensor_power -- Creating state vectors with the tensor product$.$

The function tensor_product( $v_1,\ldots,v_n$), returns $v_1\otimes v_2\cdots\otimes v_n$, where $v_i$ are vectors or matrices. The otimes operator is an `infix' operator that is equivalent to the function tensor_product. The function tensor_power($op,n$), returns the $n$th tensor power of the operator op. Once again, we will employ the is$\dagger$ function. Keep in mind that, in this example, the expressions are not analyzed abstractly, but rather vectors with integer elements are generated and compared elementwise.


\begin{boxedminipage}{2.0\linewidth}
\begin{verbatim}(%i12) is (ketz(0,1) = ke...
...atim}
\begin{dmath}[number={\%o14}]
\mathbf{true}\end{dmath}\end{boxedminipage}


4.5 schmidt_ket -- bipartite ket in Schmidt basis$.$

schmidt_ket($a$)creates a ket in the schmidt form. This is equivalent to sqrt(a)*ket(0,0)+ sqrt(1-a)*ket(1,1). This only works for qubits ($d=2$). Note that you may need to enter assume(a>0,1-a>0) when manipulating this state The assume$\dagger$function is used to build a database of facts used, for instance, by the is function.

4.6 bell and belln -- Bell state kets in computational basis$.$

create vector bell states. bell[a,b] creates the state
(1) \begin{displaymath}
{\lvert\Psi_{a,b} \rangle} = \frac{1}{\sqrt{2}} {\lvert 0,b \rangle} + (-1)^a {\lvert 1,\bar b \rangle},
\end{displaymath}

where $a,b\in\{0,1\}$. The array belln[i] creates the same states where $i$ is the decimal representation of the binary numeration $(a,b)$. That is, $(0,1,2,3)$ corresponds to $( (0,0), (0,1), (1,0), (1,1) )$. Note that belln[i] is a Maxima array$\dagger$ as indicated by the square brackets.

As an exercise, we will check our definitions of the Bell states by testing for orthonormality. We first define an array function that returns the inner product of two Bell states. An array function f[x,y] is like an ordinary function f(x,y) except that it can be used where an array is expected.


\begin{boxedminipage}{2.0\linewidth}
\begin{verbatim}(%i2) f[x,y] := belln[x] ...
...k[0]y}:=\mathrm{belln}_{x}\cdot \mathrm{belln}_{y}\end{dmath}\end{boxedminipage}


Create a $4 \times 4$ matrix with genmatrix$\dagger$ which maps the two dimension array f over the indices of the matrix with the given range.


\begin{boxedminipage}{2.0\linewidth}
\begin{verbatim}(%i3) genmatrix( f , 3,3,...
...\linebreak[0]0&\linebreak[0]0&\linebreak[0]1\cr
}\end{dmath}\end{boxedminipage}


But instead of the named function f we could have used just a function body with the lambda$\dagger$ function, which returns a function that is not bound to a symbol.


\begin{boxedminipage}{2.0\linewidth}
\begin{verbatim}(%i3) genmatrix( f , 3,3,...
...\linebreak[0]0&\linebreak[0]0&\linebreak[0]1\cr
}\end{dmath}\end{boxedminipage}


It is obviously the $4 \times 4$ identity matrix. The function identitymatrixp($mat$) is a predicate defined in the quantum information package in analogy to the Maxima function zeromatrixp$\dagger$. It returns true only if its argument is an identity matrix. (The symbol % refers to the previous output.


\begin{boxedminipage}{2.0\linewidth}
\begin{verbatim}(%i5) identitymatrixp(%);...
...batim}
\begin{dmath}[number={\%o5}]
\mathbf{true}\end{dmath}\end{boxedminipage}


In the following sections, we often perform these comparisons in a single line. This is how the test appears in the regression test suite.


\begin{boxedminipage}{2.0\linewidth}
\begin{verbatim}(%i6) identitymatrixp(gen...
...batim}
\begin{dmath}[number={\%o6}]
\mathbf{true}\end{dmath}\end{boxedminipage}


We see that these four vectors are orthonormal and thus form a basis in $\mathbb{C}^2\otimes \mathbb{C}^2$. We can also check that

(2) \begin{displaymath}
{\lvert\Psi_{00} \rangle}{\langle\Psi_{00} \rvert} + {\lver...
...ert\Psi_{11} \rangle}{\langle\Psi_{11} \rvert} = \mathbb{1}_4.
\end{displaymath}




\begin{boxedminipage}{2.0\linewidth}
\begin{verbatim}(%i2) identitymatrixp(app...
...batim}
\begin{dmath}[number={\%o2}]
\mathbf{true}\end{dmath}\end{boxedminipage}


4.7 ghz and ghzn -- GHZ state kets$.$

The array ghz[$i,j,k$] contains the GHZ kets defined by
(3) \begin{displaymath}
{\lvert\Psi_{\mbox{GHZ}}(a,b,c) \rangle}
= \frac{1}{\sqrt...
...vert 0,b,c \rangle} + (-1)^a {\lvert 1,\bar b,\bar c \rangle},
\end{displaymath}

where the bar denotes the logical not operation. The array ghzn[$n$] is the same array indexed by a single decimal number equivalent to the binary numeration given by $a,b,c$.

4.8 werner -- Werner state density matrix$.$

The Werner state is defined by

\begin{displaymath}
{\lvert\Psi(\lambda,i,j) \rangle}_{\mbox{Werner}} =
\lambd...
...{\langle\Psi(i,j) \rvert}_{\mbox{Bell}}
+ (1-\lambda) \rho_u,
\end{displaymath}

where $\rho_u=\mathbb{1}_4/4$. The qinf function is werner(a,i,j). The entropy depends on neither $i$ nor $j$ and varies with $\lambda$ between a value of $0$ and $1$ per bit, as the state is tuned from a pure state to the uniform mixed state.


\begin{boxedminipage}{2.0\linewidth}
\begin{verbatim}(%i2) wxplot2d(entropy(we...
...graphics[width=.5\linewidth]{figs/werner_entropy}
\end{dmath}\end{boxedminipage}






John Lapeyre 2008-09-02