# Tag Info

9

You can build your gate with Operator and unitary function e.g: from qiskit import QuantumCircuit, QuantumRegister from qiskit.quantum_info.operators import Operator controls = QuantumRegister(2) circuit = QuantumCircuit(controls) cx = Operator([ [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0], [0, 1, 0, 0] ]) circuit.unitary(cx, [0, 1], label='...

9

I don't think you need to know quantum physics to understand quantum computing - similarly to how you don't think about the hardware implementation of the classical computers when you write high-level code for them. The field of quantum computing has grown to the point where one cannot really teach all of it in one course, so different approaches to ...

6

Qiskit's QuantumCircuit has mct method to build multiple-control Toffoli gate with several modes: basic, basic-dirty-ancilla, advanced, noancilla. For instance Toffoli gate with 3 control qubits: from qiskit import QuantumCircuit, QuantumRegister controls = QuantumRegister(3, "c_qb") target = QuantumRegister(1, "t_qb") circuit = QuantumCircuit(controls, ...

6

I don't think I agree - you really do need a grasp of quantum computing mechanics (including the math) in order to do any programming TLDR: Quantum computers are so specialized and the software is so close to the physical realization that you need an understanding of the math of quantum algorithms. Here's my logic With classical computers, we have a large ...

6

Let us look at each observation and question in perspective. Before delving deep into the questions, please let me share a few reference architecture diagrams on the components of a quantum computer. We need to review the mentioned observations and understandings from a practical implementation vantage point. When we consider the quantum realm in its ...

5

Qiskit currently supports measurements in the computational basis from Qiskit Terra and Aer, that is, returning 1 if the qubit is in state $|1\rangle$, and 0 if the qubit is measured to be in state $|0\rangle$. However, it is relatively easy to perform a change of basis unitary to our quantum circuit just prior to measurement, in order to instead measure in ...

5

Qiskit implements a transpiler which optimizes the circuits that you provide. This means it modifies the circuit so that it can be run on the backend and also optimizes it so that anything that can possibly be run in parallel is done so. To run with the maximum level of optimization you can run execute(circuit, optimization_level=3). There is more ...

5

There is no specific paper for this, though information on the model can be found in the Qiskit Aer API documentation and is based on the research of IBMQ quantum computing group. As examples you can read some of the following papers for more information about errors in IBMQ devices: arXiv:1410.6419 -- The Methods section at the end has a summary of gate ...

5

Your circuit does not measure $q_2$ qubit after teleportation; I guess that is why teleportation of $|1\rangle$ qubit is shown incorrectly.

5

This is possible by using Composite Gates in Qiskit. With composite gates, you can create a circuit of gates, turn that circuit into an Instruction, and attach it to a new circuit which will perform the gates that were within your old circuit. Here is an example: from qiskit import QuantumCircuit qc = QuantumCircuit(2, name='bell') qc.h(0) qc.cx(0, 1) ...

5

Prepare a qubit in state $|\psi\rangle=\mathrm{cos}\frac{\theta}{2}|0\rangle+\mathrm{e}^{i\phi}\mathrm{sin}\frac{\theta}{2}|1\rangle$, given the angles $\psi$ and $\theta$. Let's start with a qubit in the $|0\rangle$ state, as is customary for Q#. You can use one of the general library operations to prepare the state, such as PrepareArbitraryState. Or you ...

5

Your circuit looks fine, but it has 16 qubits, and the largest IBM public backend currently has 15 qubits (note that Melbourne has 16 but one of the qubits is off right now). So in order to run it, you need a larger backend. The 20+ qubit hardware is currently accessible by IBMQ Network institution members. But if you just want to play around you can ...

5

By clicking on Downloand you get two .json files as you mentioned. The results are saved in the file with suffix results. When you open the file in Notepad or any other text editor, you can find results in this form: "results":[{"data":{"counts":{"0x0":28,"0x1":39,"0x10":35,"0x11":28,"0x12":25,"0x13":32,"0x14":22,"0x15":36,"0x16":42,"0x17":33,"0x18":35,"...

5

First it is instructive to ask oneself: "how does classical data get into my computer?" In a classical computer, your data is always stored in bits. Because calculations in base 2 are not very straightforward for most people there are abstractions like int types for integers and float types for rational numbers with the associated math operations readily ...

5

Optimization level 0 does not perform 1 qubit gate optimization and it will send 2 X gates (well 2 U3 gates after it unrolls to the basis set). You can see the passes optimization level 0 runs here: https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/transpiler/preset_passmanagers/level0.py It will only map the circuit to the device and unroll the ...

5

Why bother with an approximate solution when you can get an exact solution? The reason to have an 'approximate' simulation rather than an exact simulation (and result) is that it more closely resembles our understanding and interaction with a real quantum computer. In a real quantum computer, the state of the qubits before measurement is indeed the exact ...

4

Qiskit uses little-endian for both classical bit ordering and qubit ordering. For classical bits: A 3-bit classical register creg with value abc has creg=c, creg=b, creg=a. For qubits: The ordering is with respect to the tensor-product structure of the state space. So a 3-qubit quantum register qreg with wave-function $|\psi\rangle = |A\otimes B\... 4 Probably the first big reference I would highlight is qsharp.community. Its a community org where we work on projects and collecting learning materials for Q#. Contributions are always welcome, so just make a PR on a repo or hop on the gitter and say hi! I'll also add that I am working on a textbook that is currently in Early Access called Learn Quantum ... 4 Have a look at these for quantum machine learning: Supervised learning with quantum computers by Schuld and Petruccione (2018) An introduction to quantum machine learning by the same authors of the textbook above Quantum machine learning published in Nature 2017 by some experts in the field: Wittek, Rebentrost, Lloyd, et al Video presentations by Dr. Schuld ... 4 You can draw the circuit using construct_circuit().draw(). In the tutorial you are talking about, if you scroll down to the 4x4 randomly generated section that uses params5 you can run print(hhl.construct_circuit()), after the line hhl = HHL.init_params(params5, algo_input). This may take a little while to complete but it should eventually print out ASCII ... 4 IBMQ.load_accounts() was deprecated and removed in Qiskit 0.14. Please use IBMQ.load_account(). 4 This is very similar to an function in terra random_circuit: https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/circuit/random/utils.py#L30-L113 It randomly picks gates from the list of all the standard gates in terra. For example, you can run something like: from qiskit.circuit.random import random_circuit qr = random_circuit(10, 10, max_operands=3,... 4 These aren't error messages, they are just outputs. The first message simply means it will be using your credentials for the session. This has probably popped up because you have run IBMQ.load_accounts() more than once. The second message appears to just be the output of the creation of the circuits variable. 4 Building off of Ryan's answer (https://quantumcomputing.stackexchange.com/a/12271/12224), it's important to recognize that the Qubit type should not only live just in the Q# code but also have its scope bounded by either a using statement or a borrowing statement. See Working with Qubits for more guidance on how to allocate qubits for use in an operation. ... 3 It's likely that this algorithm hasn't yet been implemented in QISKit / Q# / pyquil etc. It's also important to note that you would not be discovering new Mersenne primes with a quantum computer - the paper referenced says: We propose a quantum circuit that creates a pure state corresponding to the quantum superposition of all prime numbers less than$2^n$... 3 This can actually be easily done using the Qiskit Terra qiskit.quantum.info.analysis.average.average_data function that takes the counts data returned by a backend and the desired observable defined by a dict, list, or ndarray. The doc-string for that function actually has the ZZ your looking for as an example. 3 To form a RNOT gate , the basic gate operations HAD and PHASE() can be used. ┌───┐┌───────────┐┌───┐ ─┤ H ├┤ RZ(-pi/2) ├┤ H ├─ └───┘└───────────┘└───┘ Qiskit code qc.h(reg) qc.rz(math.radians(-90), reg) qc.h(reg) 3 To get started with quantum computing in general, you need to start by learning some of the theory behind it - unlike classical programming, you don't have any intuition about what is going on from your previous experiences, so jumping right into programming might be a bit too steep. There are a lot of resources out there to help you with this, you might ... 3 I was recently looking for a similar solution. Hope this helps. job = execute(qc, backend=backend, shots=1024) results = job.result() print(results.time_taken) You can also check all the values stored in result as it is a dictionary by printing it: print(results) Here you can check for all the information that is available within the dictionary and you ... 3 One problem is that you are resetting the$\left|z\right\rangle$register after applying the Controlled X(z, y) operation. Right before you reset, your$\left|z\right\rangle$register is entangled with the other two registers, such that resetting in that way collapses any superposition on the$\left|x\right\rangle \left|y\right\rangle\$ registers. While that'...

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