2
$\begingroup$

If I have an arbitrary non-unitary matrix of say $$ U = \begin{pmatrix} 1.5 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1.6 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ \end{pmatrix}, $$

is it possible to decompose it into gates implementable in qiskit?

If so, how? If not, why not?

Is is possible to have any arbitrary non-unitary matrix as an input and get the corresponding gates that implement this arbitrary matrix?

$\endgroup$
8
  • 1
    $\begingroup$ Welcome to quantum computing SC. In what way do you want to decompose the matrix? Do you mean to basic quantum gates? What does the matrix represent as it seems it is not unitary (columns are not unit vectors). $\endgroup$ Feb 15, 2020 at 9:05
  • $\begingroup$ I want to decompose any kind of matrix rather than a unitary matrix into elementary gates in Qiskit. Is this possible? Decomposition using KAK decomposition in Qiskit. $\endgroup$
    – Monica
    Feb 16, 2020 at 18:53
  • $\begingroup$ See answer to the original in: quantumcomputing.stackexchange.com/questions/4975/… $\endgroup$ Feb 16, 2020 at 23:46
  • $\begingroup$ The long discussion about this is in response to question 4975 (link added as comment above) $\endgroup$ Feb 16, 2020 at 23:49
  • 1
    $\begingroup$ You should probably edit your question to add more information about what you want to achieve. You cannot decompose non-unitary gates as a sequence of quantum gates (a product of unitary matrices is always unitary). It is possible to "implement" non-unitary gates (and this becomes probabilistic and involved) but you asked for a decomposition, which is different. $\endgroup$ Feb 17, 2020 at 10:33

1 Answer 1

1
$\begingroup$

As far as I know there is no way to implement non-unitary gates in Qiskit. The only non-unitary operations that Qiskit accepts are instructions. Have a look in the section "Non unitary operations" at the end of this tutorial.

However, if you do have an arbitrary unitary matrix, you can apply it to your quantum circuit directly with the qc.unitary() attribute. Have a look at the following code snippet, which I took from this this page.

from qiskit import QuantumCircuit
matrix = [[0, 0, 0, 1],
          [0, 0, 1, 0],
          [1, 0, 0, 0],
          [0, 1, 0, 0]]
circuit = QuantumCircuit(2)
circuit.unitary(matrix, [0, 1])
$\endgroup$

Your Answer

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

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