# Implementing quDit algorithms in Qiskit using quBit

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

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

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))
print(psi.to_dict())


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))
print(rho.to_dict())

• 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. May 28, 2021 at 14:26