• edit

    Thread title has been changed from When to use ``transpile()`, assemble(), execute() and run() in qiskit?.

  • Members 1 post
    Oct. 21, 2022, 5:09 a.m.

    Yeah, this is very simple to understand. First let me get through the difference between run() vs execute() - unlike execute() , run() require the circuit to be transpiled first. The compile() refers to conversion of high level language to low level language where as transpile() is all about conversion of a high level language to another high level language. Assemble() assembles the circuit into a Qobj that can be run. Most generally, assemble() is used when working with Aer, where as transpile() used when working with IBMQ Provider.

    qobj = assemble(qc)  # Assemble circuit into a Qobj that can be run
    counts = sim.run(qobj).result().get_counts()  # Do the simulation, returning the state vector
    plot_histogram(counts)  # Display the output on measurement of state vector