# Acting with a superoperator to states in qutip

I can generate a random superoperator in qutip using the command rand_super(N) $$\mathcal{E}$$ where I only need to inser the dimension of the superoperator is acting on, denoted as N. The same superoperator should be able to act on a state, that is a density matrix, NxN $$\rho$$.

Question: How can I do this using Qutip? Literally, given $$\rho$$ I can generate a random $$\mathcal{E}$$, but I couldn't find $$\mathcal{E}(\rho)$$.

I don't know if this is really a qutip question, maybe I could do this using simply numpy? I also tried to look up for this and qutip only teaches to find properties of the matrices and not how to perform this specific kind of operation.

For an operator $$U$$ acting on a state $$\rho$$ as $$U\rho$$, it's superoperator representation $$\mathcal{E}$$ would act on the superket representation of the state $$\rho$$, which is denoted as $$|\rho\rangle\rangle$$. This superket is just a vector made up of the columns of $$\rho$$ stacked on each other: $$\rho = \begin{pmatrix} a & b \\ c & d \end{pmatrix} \rightarrow |\rho\rangle\rangle = \begin{pmatrix} a \\ c \\ b \\ d \end{pmatrix}.$$ To do this in QuTiP, you have

import qutip as qt

N = 3
rho = qt.rand_dm(N) # Random 3x3 density matrix
rho_vec = qt.operator_to_vector(rho)


You can then act on this super ket with the super operator $$\mathcal{E}|\rho\rangle\rangle$$. Note that for the equivalent operator $$U$$ acting on the state $$\rho$$, $$U\rho$$ is not necessarily equal to $$\rho U$$. So you have to keep tabs on whether the superoperator is left- or right-multiplied. A nice explanation is given here. In QuTiP, this is handled by calling spre(rho), spost(rho), and sprepost(rho, rho), detailed here.