# Tag Info

7

As Davit Khachatryan's answer points out, the task is impossible / ill-defined, since the desired target state is generally not normalized and it depends on the relative global phases of the two initial states. However, it is possible to rephrase the question so that is meaningful and has an interesting answer. The two problems -- sensitivity to the global ...

5

A counterexample that shows that this is not possible in the general case (here I am neglecting post-selection possibility discussed in the comments of the question and in the accepted answer): $$C_1 = X \qquad C_2 = -X$$ Or one can take $C_2 = R_y(- \pi)$ and all mentioned below equations will reamin true. So: $$C_1 |0\rangle = |1\rangle = |\psi \rangle \... 4 \frac{\sqrt{2}}{2}(1+i)  = \frac{1}{\sqrt{2}}(1+i). To see how this is the case, multiply the numerator and denominator of \frac{1}{\sqrt{2}} by \frac{\sqrt{2}}{\sqrt{2}} = 1. \frac {\sqrt{2}}{\sqrt{2}} \frac{1}{\sqrt{2}} = \frac{\sqrt{2}}{{2}} . The result doesn't differ; only how it's displayed in comparison to your manual calculation does. 4 If you look carefully, the circuit just flips the least significant qubit if the parity of the two most significant qubits is one. So, using qiskit: from qiskit import QuantumCircuit from qiskit.quantum_info import Operator qc = QuantumCircuit(4) qc.cx(2, 0) qc.cx(3, 0) print(qc) U = Operator(qc).data print(U.real) --- Output: ┌───┐┌───┐ q_0: ┤ X ├┤ ... 3 Try to replace backend = BasicAer.get_backend('ibmq_santiago') with backend = provider.get_backend('ibmq_santiago') Alternativetly, you can also use this code: backend = provider.backends(name = 'ibmq_santiago')[0] You have to use backends available under you account. There are only simulators in BasicAer while the real quantum machines are under the ... 3 Good question. I tried to figure this out as well since I saw your question without much success. However, I just wanted to point out that you can use Pennylane since it offers many external plugins so it allows you to run on many external hardware. See here: https://pennylane.ai/plugins.html You can use Qiskit and aim at multiple external devices outside of ... 3 Interesting question! An ansatz circuit is a parameterized circuit, say V(\theta) where \theta are a set of parameters, used to prepare a trial state for your problem:$$ |\Psi(\theta)\rangle = V(\theta)|0\rangle $$In a variational algorithm, such as VQE, the trial state encodes your solution and is iteratively updated until some termination criterion ... 3 If you decomposed your Hamiltonian into Pauli strings, and it has 100 different terms, then yes you can use one machine to do the quantum subroutine to evaluate the expectation for each of the term.$$ \langle H \rangle = \sum_{i} h_i \langle P_i \rangle $$So you can evaluate \langle P_1 \rangle on one machine and \langle P_2 \rangle on another machine..... 3 In qiskit, you can get the unitary transformation matrix from a quantum circuit by running the following: from qiskit import * #circuit already defined backend = Aer.get_backend('unitary_simulator') job = execute(circuit, backend) result = job.result() print(result.get_unitary(circ, decimals=3)) and the matrix will output. As you increase the number of ... 3 While you can get the unitary matrix representation of a circuit using the unitary simulator as shown in the other answers, there is a much easier way using the Operator class in the qiskit.quantum_info library. import qiskit.quantum_info as qi op = qi.Operator(circ) If you want the numpy array of the operator, this can be obtained via the data attribute (... 2 Well, first off you can check the properties of the statevector simulator and the qasm simulator by doing the following: from qiskit.providers.aer import StatevectorSimulator, QasmSimulator StatevectorSimulator.DEFAULT_CONFIGURATION QasmSimulator.DEFAULT_CONFIGURATION From the outputs of these calls, you can see that both simulator backends have the same ... 2 Based on tsgeorgios information about Qiskit manual and the manual content, I created the code below which works as expected. #BASED ON: https://qiskit.org/textbook/ch-applications/hhl_tutorial.html#4.-Qiskit-Implementation %matplotlib inline # Importing standard Qiskit libraries and configuring account from qiskit import Aer from qiskit.circuit.library ... 2 The following also work for me if it is interest to you: from qiskit import * %matplotlib inline circuit = QuantumCircuit(2,2) circuit.h(0) circuit.draw() 2 There is probably a change on the default arguments of draw() function. To reproduce the same visualization as on the youtube video, try: circuit.draw(initial_state=True, cregbundle=False) and add a Hadamard gate like: circuit.h(qr[0]) 2 The number of bits in the counts dictionary equals the number of qubits in the circuit. So in your first example, you have a 1-qubit circuit, therefore you're dictionary looks something like counts = {'0': 400, '1': 600} # for for 1000 shots counts = {'0': 1} # for 1 shot In the second example, the Jupyter notebook screenshot, you have three qubits. ... 2 You can use .get() and return zero as the default value. res.get('011', 0) 2 Applying X gate to the |0\rangle state gives you |1\rangle, and applying Y gate to the |0\rangle state gives you i|1\rangle. These states differ only by a global phase (the i scalar multiplier in the second case), so they are not physically distinguishable (you cannot set up an experiment to observe the difference between them). Bloch sphere ... 2 QETLAB usually deals with channels as Choi operators. You can convert your Kraus operators to the Choi matrix by providing the Kraus operators as a cell array. Example with the amplitude damping channel below. >> damp = 0.3; >> K = { diag([1,sqrt(1-damp)]); [0,sqrt(damp);0,0] }; >> ChoiMatrix(K) ans = 1.0000 0 0 0.... 2 This can be done by calling cirq.unitary. >>> import cirq >>> cirq.unitary(cirq.X) array([[0.+0.j, 1.+0.j], [1.+0.j, 0.+0.j]]) 2 This task can be accomplished via cirq.QasmOutput. I've attached an example of how to use the aforementioned functionality to run Cirq circuits on Qiskit's backends. import cirq from typing import Tuple from qiskit import QuantumCircuit, execute, Aer def main(): q0 = cirq.LineQubit(1) cirq_circuit = cirq.Circuit( cirq.H(q0), ... 2 Here's one way to do it. Let's start with some assumptions: here, I'm assuming your circuits C_1 and C_2 use the same number of qubits. In the drawing, I have used four qubits to illustrate the concept, but that doesn't matter. The answer below does not care about the number of qubits (which I call n), just that the two circuits have the same number of ... 2 Qiskit's NoiseModel class processes warnings through a logger from the logging package, not through the warnings package, so suppressing warnings as in other answers won't help. However, each method in NoiseModel provides a warnings parameter; it defaults to True but you can set it to False to prevent the warnings from being logged. Example: myNoiseModel.... 2 The warning messages just inform you of interface change and has no impact to your code. You're submitting one job for each bit. The system uses a fair-share algorithm to determine who gets to run next (more details here: https://quantum-computing.ibm.com/docs/manage/backends/queue/). So running hundreds of jobs consecutively would kill your priority very ... 2 The other answer is great. But here is a link that walk you through the process step-by-step: https://medium.com/mdr-inc/checking-the-unitary-matrix-of-the-quantum-circuit-on-qiskit-5968c6019a45 2 Let me consider this example: if we have |01\rangle then the circuit should give us at the output |11\rangle. Here I will try to show why I think this is impossible (by assuming that we don't do any measurements). Let's assume that we have the desired gate and we want to apply it to this state \frac{1}{\sqrt{3}}(|00\rangle +|01\rangle - |11\rangle):$$...

2

Currently, I do not know of any quantum processor allowing to condition a quantum operation on results in a classical register. On IBM Q, it is possible to do so in simulator only. However, if you are dealing with quantum circuits like quantum teleportation or superdense coding, where you use such conditioning, you can simply use controlled quantum gates ...

2

Consider the maximal entangled state $$|\psi \rangle = \dfrac{1}{\sqrt{2}} \big( |00\rangle + |11\rangle \big)$$ If I make a measurement on the first qubit and a zero is returned then this implies my state has collapsed into the eigenvector $|00\rangle$ and so the second qubit measurement will definitely returned a $|0\rangle$ as that the only possibility. ...

2

crx and crz are classical register. The gates CRX or CRZ mean that you apply the X gate on qubit 2 if the measurement on the classical register crx is a 1, that is if qubit 1 (q1) is in the $|1\rangle$ state; and you will apply the Z gate on qubit 2 if the classical register crz is 1. This can be done in qiskit with c_if operation. You can see example of the ...

2

You are missing the () at the end of job.result().get_counts().

1

It is in the method documentation, overwrite: Overwrite existing credentials.: IBMQ.save_account('api_token', overwrite=True)

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