6

The IBM circuit composer used to be also known as IBM Quantum Experience, or IQX for short. For those historical reasons, the name of the style is iqx: from qiskit import * circuit = QuantumCircuit(2) circuit.h(0) circuit.cx(0, 1) circuit.t(1) circuit.draw('mpl', style='iqx') Compare with the composer look:


6

That’s possible, just do circuit.draw('mpl', style='iqx')


6

The answer seems to be "no" for all three. From what I can find, Cirq and PyQuil default to QuTiP for Bloch sphere visualization, and ProjectQ does not have any examples to go off of, nor can I find the functionality in their GitHub. TensorFlow Quantum, which primarily uses Cirq (since they are both owned by Google), used qutip.Bloch in this ...


5

If you have an ideal quantum circuit, you can easily get its superoperator representation using qiskit.quantum_info.SuperOp as follows, qc = QuantumCircuit(1) qc.x(0) super_op = SuperOp(qc) array_to_latex(super_op) The output will be $$ \left[\begin{matrix} 0 & 0 & 0 & 1\\ 0 & 0 & 1 & 0\\ 0 & 1 & 0 & 0\\ 1 & 0 ...


4

You can definitely run this on a real quantum computer! In your snippet above you mixed circuits and operators. A circuit is only used for the ansatz of your ground state, not for representing the operators. The website you provided talks about the Hamiltonian in terms of the Pauli X and Z matrices; $\hat\sigma^x$ and $\hat\sigma^z$. If you want to compute ...


4

You can do this as follow: Specify your circuit then transpile it to the backend of interst. transpile_circuit = transpile(circuit, backend) Convert this to DAG (Directed Acylic Graph) dag_circuit = circuit_to_dag(transpile_circuit) count all the operation in the longest path: dag_circuit.count_ops_longest_path() Explicit example: Says you have the ...


4

The number of qubits is part of the backend configuration: FakeManhattan().configuration().n_qubits 65 If you need to filter the list of mocked backends based on the amount of qubits: from qiskit.test.mock import FakeProvider provider = FakeProvider() [ b.name() for b in provider.backends() if b.configuration().n_qubits > 20] ['fake_cambridge', '...


4

All the jobs are sent in a non-blocking way. You can send all your jobs with job = backend.run and recover their results in a fully different session. In order to fully recover your Job object from a backend, you need the job id (given you are running Qiskit 0.24 or later. See @jyu00's comment) You can save your job ids like this: jobs = [] for circuit in ...


3

This post contains a few questions, so let's first recap the steps the circuit sampler goes through (you can also check out the source code here), before answering your questions. How the Circuit Sampler works Provided with a backend/quantum instance and an operator expression, the job of the circuit sampler is to execute all circuits in the operator ...


3

This is just a quirk of how complex numbers are implemented in Python/Numpy, etc. At the end of the day, these are represented as floating-point numbers within the target simulator. These are then transformed via various mathematical operations to implement the simulation and this eventually leads to an accumulation of round off error. For all intents and ...


3

Well, originally the idea was that we didn't want to exclude things like continuous quantum systems, and ancillary systems being used as control surfaces, and concepts like "a place where an ion might be" as opposed to the ion itself. So we went with a very generic "identifier for quantum-associated thing" name (qid). At some point Qid ...


3

As it is written in the error message, it is here because the CH gate is not in the basis gates of UnitarySimulator, therefore the backend doesn't understand it and can't do anything with it ; check this line of code : 'ch' in UnitarySimulator().configuration().basis_gates It returns False. Now I believe it has the error with the run method and not the ...


2

The reason for your second result is because unitary synthesis is not part of the SolovayKitaevDecomposition pass. Actually, you can combine your attempts to get the desired result. This is the first stage (you first snippet), it will synthesise your circuit in terms of u* and cx: from qiskit import QuantumCircuit from qiskit.quantum_info import Operator ...


2

No symbolic computation software with quantum circuits built in The asker has clarified in this comment that they want a symbolic computation software in which the user does not "have to manually define circuits in terms of matrix multiplications", and the question says that the software cannot "force you to encode the matrix of each gate ...


2

The reason for your error is that you are running on a backend that does not support CH. The function execute works because it runs transpile before, adapting the basis. However, if I understand the spirit of your question, you can quickly get the unitary of any circuit using kaleidoscope, a very nice 3rd-party Qiskit extension. It can be installed with pip ...


2

Number of states marked isn't a strict correspondence with number of CZ gates: your new oracle still marks two states, but, rather than $\left|101\right>$ and $\left|110\right>$, it marks $\left|101\right>$ and $\left|111\right>$. To see this, remember a $Z$ gate flips the sign of a $\left|1\right>$: if the $Z$ gate is applied to a 1 and the ...


2

If you want, everything is detailed here about the system configuration, it will explain everything you can find in the configuration. Just a quick resume about how to see the info : personally, I sometimes use backend.configuration().to_dict(), with this all of the information will be printed in a dict, and it's pretty easy to use. Now, you can also do a &...


2

I think you underestimated how long your circuit really is.... When running your circuit on the hardware, it has to be transpile into the set of gates that is known to the hardware. For IBM machines, these are $\{ CX, ID, RZ, SX, X \}$ . Furthermore, there is a constraint on the qubit layout of the hardware as well. Not all qubits are connected. Thus there ...


2

You can just use the constructor of the Statevector class. sv1 = Statevector.from_label('1010') # construct Statevector from string label sv2 = Statevector(sv1.data) # construct Statevector from numpy array sv1 == sv2 returns True


2

Grover's algorithm has two components, which alternate and repeat $O(\sqrt{N})$ times: a diffusion operator and an oracle operator. The diffusion operator will cause problems with your idea. As I understand, what you want to do is start from a uniform superposition $$\vert \psi_0\rangle =\frac{1}{\sqrt{2^n}}\sum_{b_1,\dots,b_n\in\{0,1\}} \vert b_1\rangle \...


2

How about something like this: from qiskit.circuit import QuantumCircuit def my_circuit(initial_gate_params, params): circuit = QuantumCircuit(1) circuit.u3(initial_gate_params[0],initial_gate_params[1],initial_gate_params[2],0) circuit.u3(params[0], params[1], params[2], 0) return circuit initial_gate_params = [ [0,0,0], [2,3,2], [...


1

If $P_x = P_y = P_z$ then DEPOLARIZE1 is what you need. Otherwise you can use CORRELATED_ERROR and ELSE_CORRELATED_ERROR. For example, suppose $P_x = 0.1$, $P_y = 0.2$, $P_z = 0.3$ and your target is qubit $5$. You can do this: CORRELATED_ERROR(0.1) X5 ELSE_CORRELATED_ERROR(0.22222222222) Y5 # note: P(Y|not X) = 20%/(100% - 10%) ELSE_CORRELATED_ERROR(0....


1

Problem solving in Ocean framework goes by modeling the problem into a BinaryQuadraticModel. The pure quantum samplers natively only understand this model. For the hybrid samplers (Leap) one can model the problem into DiscreteQuadraticModel. The bias are the linear terms in those models objective functions. They are derived with respect to the problem after ...


1

Your circuit is looking like this: Thus, your unitary matrix is: $$ U = CNOT \cdot \big( H \otimes X \big) $$ where \begin{align} H \otimes X &= \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix} \otimes \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \cdot \begin{pmatrix} 0 & 1 \...


1

You can use fake pulse backend to do this. from qiskit.circuit import QuantumCircuit import matplotlib.pyplot as plt from qiskit.test.mock import FakeOpenPulse2Q backend = FakeOpenPulse2Q() from qiskit import transpile, schedule bell = QuantumCircuit(2, 2) bell.h(0) bell.cx(0,1) qc = transpile(bell,backend) pulse_schedule = schedule(qc, backend) fig, ax = ...


1

On the Qiskit slack there have been others who have the same issue connecting to Quantum Lab. A 503 Service Unavailable Error may be due to service maintenance or being overloaded. You may have to just wait for the server to return.


1

I think the widget is supposed to only show you the initialization and Oracle part of the circuit and not actually implement the measurement process into it. Thus, that is why you don't see the measurement step. However, it is quite simple to write a function for perform the Bernstein-Vazirani algorithm. You can just use the script below: import numpy as np ...


1

According to the docs of scipy and qiskit, the first uses primitive root $\omega = e^{-\frac{2\pi i}{n}}$ and the second uses $\omega = e^{\frac{2\pi i}{n}}$. This implies that one matrix is complex conjugate of the other (which is the same as inverse).


1

I found the answer on my own. In case someone has a similar problem: You can use the standard measure() function in the quantum circuit. When you assemble you can specify meas_level=1 which returns the raw measured data without running it through a classifier. Then you can build your own classifier.


1

This is normal! If you look at the molecular Hamiltonian ozone_molecule.get_molecular_hamiltonian(), you will notice that it is a Hamiltonian that acts on 30 spin orbitals, and so ozone_qubit_hamiltonian is a 30 qubit Hamiltonian. This means it has $2^{30} \times 2^{30} = 2^{60} \approx 1.15 \times 10^{18}$ matrix elements, which will surely consume all your ...


Only top voted, non community-wiki answers of a minimum length are eligible