# Tag Info

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

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 (...

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

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

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

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.....

2

You can use .get() and return zero as the default value. res.get('011', 0)

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

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

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

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

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

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

As many things in life, the answer is "it depends". If you backend have support of Toffoli gates (that is, in Qiskit language, they are part of their basis gate set), then option 1 is better. If, like in most of the IBM backends at the moment, you only have CXs, then option 2 seems better. Let alone topology considerations like the coupling map. If ...

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

Could you be looking for this: Quantum Wavelet Transforms: Fast Algorithms and Complete Circuits? (this links to arxiv.) In particular, this paper presents efficient circuits for the Haar and Daubechies wavelet transforms.

1

It is a bit strange that they decided to include "depth" as a parameter for UCCSD circuit. As you noted, the depth just means the repetition of the circuit/var_form here. So in fact, we do not need it as we can increase the number of time slices. Also note that in the new Qiskit release, "depth" is not called "reps" which, ...

1

It is possible from looing at here: https://github.com/quantumlib/Cirq/tree/master/cirq/devices and https://cirq.readthedocs.io/en/stable/generated/cirq.NoiseModel.html Also look at these answers on how to implement noise: How to add noise to existing gates in Cirq? https://github.com/quantumlib/Cirq/issues/1704

1

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

1

I don't think it really matter how you index your $t_{ij}$. As you mentioned you can use FermionicOperator all you need to do is define the one body integral. This of course can be done in many ways. Here is a convenient way. def ssh_ham(gamma, lamda, n): sigmax = np.array([[0,1],[1,0]], dtype=np.complex_) sigmay = np.array([[0,-1j],[1j,0]], dtype=...

1

By default, Qiskit visualization bundles together classical bits of the same register. If you would like to draw them separately, do qr = QuantumRegister(2) cr = ClassicalRegister(2) circ = QuantumCircuit(qr, cr) circ.draw('mpl', cregbundle=False)

1

I don't think Qiskit have what you are asking for. They have this community tutorial page that can be useful if you don't know about it already: https://github.com/qiskit-community/qiskit-community-tutorials On the side note about QFT: Although Quantum Fourier Transform, which is exactly identical to Discrete Fourier Transform, can be implemented ...

1

It is an issue. Adding control() to the gate introduces a phase difference. You can verify that: from qiskit.quantum_info import Operator, Pauli gate = QuantumCircuit(1) gate.append(Operator(Pauli(label='X')), [0]) gate = gate.control() print(Operator(gate).data) ---- Output: [[ 1 0 0 0] [ 0 0 0 1j] [ 0 0 1 0] [ 0 1j 0 0]] So ...

1

Look at the start of the multiqubit section in [1], in particular the section on basis vector ordering. I found the ordering of qubits to be very strange in qiskit possibly this is your error as well? For example the state |10> corresponds to qubit 0 being in state |0> and qubit 1 in state |1>, contrary to what you might expect [1]https://qiskit.org/...

1

I don't think there is a programmatically way to know the backend_options supported by each backend. I always check the documentation on each backend to see what are the options. For example for UnitarySimulator, these are the backend options https://qiskit.org/documentation/stubs/qiskit.providers.aer.UnitarySimulator.html?highlight=backend_options

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