2
$\begingroup$

How to represent two gates addition on Qiskit composer we can do it in python code by using qiskit library but I would like to visually see how addition of two operators look like in composer.

I am currently working on VQLS Algorithm and we have to decompose given matrix into linear combination of unitary matrices. I want to see that in Qiskit composer.

Thanks

$\endgroup$
4
  • 1
    $\begingroup$ Would you consider writing it in code and using decomposition there before printing the circuit? $\endgroup$
    – 3yakuya
    Commented Mar 24, 2023 at 15:09
  • $\begingroup$ Can you give some sample code for addition operator. $\endgroup$ Commented Mar 26, 2023 at 1:52
  • $\begingroup$ Not sure I understand, but I assume you mean how to combine two operators into one? You can use compose for that: qiskit.org/documentation/stubs/… What is more, you can decompose any operator (as long as it's an actual quantum operator) into a series of basic operators using either decompose qiskit.org/documentation/stubs/… or transpiler qiskit.org/documentation/apidoc/transpiler.html $\endgroup$
    – 3yakuya
    Commented Mar 30, 2023 at 13:47
  • $\begingroup$ I mean when I decompose a non unitary matrix into series pauli base matrices like ( A = aX + bY + cZ ) where X,Y,Z are pauli basis and I want to visually show my matrices decomposition on composer and if I keep my operators side by side it will do multiplication..My question is How to show it on composer? should i create a custom gate or How ? and one more question is how to show my coefficient values along with my operator ? any QISKIT Composer snip will help.. Thanks in Advance $\endgroup$ Commented Apr 3, 2023 at 13:48

1 Answer 1

1
$\begingroup$

Assuming you mean IBM Quantum composer, it allows OpenQASM 2.0 as input. You could synthesises your circuit and them exported as OpenQASM 2.0:

from qiskit import QuantumCircuit, transpile
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])
circuit.decompose().qasm(filename='my_circuit.qasm')

Then, take my_circuit.qasm and import it in IBM Quantum Composer: screenshot of IBM Quantum Composer

$\endgroup$

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.