How do you implement any $d$-dimensional qudit circuit in qiskit using qubits to simulate on an actual quantum computer?

  • $\begingroup$ You can get qutrits using qiskit pulse to access the $|2\rangle$ state. But I have no idea about higher $d$s. $\endgroup$
    – epelaez
    Jun 10, 2021 at 13:43

1 Answer 1


It seems this is available via the classes Statevector and DensityMatrix. For StateVector, the example from the documentation :

import numpy as np
from qiskit.quantum_info import Statevector

vec = np.zeros(2 * 10)
vec[0] = 1 / np.sqrt(2)
vec[-1] = 1 / np.sqrt(2)
psi = Statevector(vec, dims=(2, 10))

And for DensityMatrix :

import numpy as np
from qiskit.quantum_info import DensityMatrix

mat = np.zeros((2 * 10, 2 * 10))
mat[0, 0] = 0.5
mat[-1, -1] = 0.5
rho = DensityMatrix(mat, dims=(2, 10))
  • $\begingroup$ Hi Lena! These codes are for simulating on classical computer using Qiskit. I wanted to know how we should program to simulate on actual quantum computer. $\endgroup$
    – Ironman
    May 28, 2021 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.