# Simulating density matrices in quantum simulators

I would like to load random quantum states sampled from a given density matrix based on its classical probabilities ie based on the definition of the given density matrix: $$\rho = \sum_i p_i |\psi _i \rangle \langle\psi _i|$$. An example I am currently trying out is $$\rho = 2^{-n}(I_n + \alpha P_n)$$ where $$I_n$$ is the identity matrix, $$\alpha$$ is a real number say $$\in (-1,1)$$ and $$P_n = \otimes_{i=1}^n P_i$$, is a Pauli string. (reference paper)

In qiskit, given such a density matrix how can we obtain the quantum circuit for producing the pure quantum states and the corresponding probabilities for selecting those circuits? Can I give the form of $$\rho$$ to qiskit and obtain all the $$\psi$$s ? I could not find anything similar to this in the qiskit documentation on my first try.

PS I understand that $$\rho$$ is not unique, and one can obtain all the $$\psi_i$$'s and $$p_i$$'s trivially by performing a spectral decomposition of $$\rho$$. But is it possible to generate the quantum circuits that produce such $$\psi_i$$'s directly?

• @Nikita, I am unsure how this can relate to StatePreparation from qiskit. Given the form of $rho$, I would like to obtain circuits (or indirectly prepare the states) that can produce $\psi$s. Is there any documentation available on this at qiskit? Jul 29 at 5:50
• I meant that if you are fine with doing the spectral decomposition of $\rho$ yourself, then the question reduces to the state preparation problem for each of the eigenstates, right? What are you looking for, exactly? A function that takes a density matrix and outputs a list of circuits preparing its eigenstates? Jul 29 at 8:03