I want to check the expressibility of my ansatz and calculate the resultant statevector on paper seems difficult. Is there a way I can do this in qiskit? I have the circuit for the ansatz which has parameterized controlled $Y$-axis rotations. Is there a way I can get the resultant statevector in terms of my parameters $\theta$?

I am also working with efficient $SU(2)$ ansatz. Is there any resource on this? Anything that covers the expressibility and efficiency of this kind of ansatz?


1 Answer 1


Is there a way I can get the resultant statevector in temrs of my parameter $\theta$s?

I don't think Qiskit itself has this functionality. May be this is because symbolic expressions become nasty very quickly when circuit size increases.

There is, however, a package developed by @SimoneGasperini named qiskit-symb which can be used to achieve this.

To demonstrate how to use this package, let's create a sample parameterized circuit:

from qiskit.circuit.library import ZZFeatureMap
circ = ZZFeatureMap(feature_dimension=4, reps=1)
circ = circ.decompose()

We get the Statevector as follows:

from qiskit_symb.quantum_info import Statevector
state_vec = Statevector(circ)

And to assign the parameters:

sv_func = state_vec.to_lambda()

params = [0.12, 0.34, 0.56, 0.78]
psi = sv_func(*params)

  • $\begingroup$ It's a shame that it's not doable in plain Qiskit. Do you know if there's been a discussion about it on Qiskit's GitHub? Otherwise, it would be worth a try to submit the idea there $\endgroup$
    – Tristan Nemoz
    Commented Jul 24, 2023 at 7:43
  • 2
    $\begingroup$ @Tristan Nemoz, here: github.com/Qiskit/qiskit-terra/issues/4751 $\endgroup$ Commented Jul 24, 2023 at 8:18
  • $\begingroup$ Thanks! I'll try using this package and update here later $\endgroup$ Commented Jul 24, 2023 at 9:52
  • $\begingroup$ @CheshtaJoshi feel free to contact me if you need any support to use my qiskit-symb package $\endgroup$ Commented Jul 24, 2023 at 13:35
  • 1
    $\begingroup$ This is amazing @SimoneGasperini . It works perfectly well! $\endgroup$ Commented Jul 24, 2023 at 14:24

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.