2

I need to draw a quantum circuit in Clifford+T library and obtain automatically its transformation matrix. (I received a response to this part of my question before in the link: How can I obtain transformation matrix of a quantum circuit in the Qiskit?) and now I want to do this work as a parametric. For example, I want to define gate T as $$ \begin{pmatrix} 1 & 0 \\ 0 & w \end{pmatrix} $$ where $w=\frac{(1+i)}{\sqrt{2}}$, and I want to obtain the transformation matrix of the circuit with parameter $w$ and not as numeric. How can I do this?

glS
  • 24,708
  • 5
  • 34
  • 108
Moein sarvaghad
  • 179
  • 1
  • 8

1 Answers1

1

As of Qiskit 0.23.0 that's not yet supported.

The reason is mainly that such a simulator would be very slow as we would have to use SymPy's matrix multiplication for symbolic expressions. This is not really feasible for more than 5 or 6 qubits -- depending on your machine specs. Also, the output can become a gigantic symbolic expression pretty quickly and therefore likely only of limited use.

That being said, you can of course write your own script for a symbolic simulator: all you have to do is replace matrix multiplications with SymPy multiplications. A good starting point could be the quantum_info.Operator that uses straightforward NumPy multiplications and could probably be generalized easily.

Cryoris
  • 2,893
  • 6
  • 14