1
$\begingroup$

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?

$\endgroup$
1
$\begingroup$

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.

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ Could you please send an example of what you are saying? thanks $\endgroup$ – Moein sarvaghad Oct 28 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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