15

Suppose that you have a quantum algorithm with $2^{60}$ possible inputs. Suppose also that it would take 1 nanosecond to run this on a supercomputer (which is unrealistically optimistic!). The total time required to run through all possible inputs would be 36.5 years. Clearly it would be much better to just run the instance that you care about, and get the ...


9

Yes, it is possible to obtain this information, but only for troubleshooting purposes, not for using it in the code. Dump functions dump the status of the target machine into a file or to the console output. If the program is executed on the full-state simulator, this status will include the wave function of the whole system (for DumpMachine) or of the ...


9

Apart from the formal result about #P-hardness, there's something worth touching on, about the nature of strong simulation itself. I'll comment first on strong simulation, and then specifically on the quantum case. 1. Strong simulation even of classical randomised computation is hard Strong simulation is a very powerful concept — not only in the fact ...


7

There are two questions here. The first asks how you might actually implement this in code, and the second asks what's the point if you know which oracle you're passing in. Implementation Probably the best way is to create a function IsBlackBoxConstant which takes the oracle as input, then runs the Deutsch Oracle program to determine whether it is constant....


7

It depends on the Hamiltonian. There are three particular questions whose answers might influence your choice of strategy: Does the Hamiltonian have any particular structure or symmetry? How quickly does the Hamiltonian change in time? What do you know about the initial state in relation to the initial Hamiltonian? Obviously, if the Hamiltonian has any ...


7

A conventional Hamiltonian is Hermitian. Hence, if it contains a non-Hermitian term, it must either also contain its Hermitian conjuagte as another term, or have 0 weight. In this particular case, since $Z\otimes X\otimes Y$ is Hermitian itself, the coefficient would have to be 0. So, if you're talking about conventional Hamiltonians, you've probably made a ...


7

There is a distinction between what you use to write a program (the SDK), and what you use to run it (the backend). The SDK can be either a graphical interface, like the IBM Q Experience or the CAS-Alibaba Quantum Computing Laboratory. It could also be a way of writing programs, like Q#, QISKit, Forest, Circ, ProjectQ, etc. The backend can either be a ...


7

Quantum simulators don't rely on quantum-mechanical effects in the physical chips; instead they simulate certain aspects of quantum state and operations on it using only classical compute. Universal simulators simulate full quantum state of the system, performing linear algebra transformations on it. They support universal set of quantum operations, but the ...


6

A separate note on using simulators for this (as opposed to using an actual quantum computer). Simulators, like the one that ships with Q#, are built to simulate quantum mechanical theories as we understand them now. This means that any experiment you run on a simulator will behave exactly as the theory says (well, unless the simulator has a bug in the code)...


6

There isn't much of a difference. If you read the labels, the values are roughly the same but for some reason are presented in a different order. Any differences for a given value are due to noise and decoherence.


5

Cirq uses numpy's pseudo random number generator to pick measurement results, e.g. here is code from XmonStepper.simulate_measurement: def simulate_measurement(self, index: int) -> bool: [...] prob_one = np.sum(self._pool.map(_one_prob_per_shard, args)) result = bool(np.random.random() <= prob_one) [...] Cirq ...


5

You're getting the same output as Quirk, just with a different bit ordering convention for the kets. Quirk considers the top qubit to be the "least significant" qubit (i.e. if you count 000, 001, 010, ... then it refers to the rightmost bit). So if you apply a Hadamard gate to the top qubit of a three-qubit circuit in Quirk you get the state |000> + |001>. ...


4

What do you mean by "Quantum Mechanical Simulations" ? One of the primary motivations in the early history of quantum computing was a statement from Richard Feynman that a quantum computer would be able to effectively simulate quantum systems. To that end, a lot of the nearest term quantum programs people are trying to run (and have run) are simulations of ...


4

This answer doesn't directly answer the question (I have little experience of real simulators with practical overheads etc.), but here's a theoretical upper bound. Let's assume that you need to store the whole state vector of $k$ qubits in memory. There are $2^n$ elements that are complex numbers. A complex number requires 2 real numbers, and a real number ...


4

This can be done using the 'Aer' component of Qiskit. The properties information can be turned into a noise model using from qiskit.providers.aer import noise properties = device.properties() noise_model = noise.device.basic_device_noise_model(properties) basis_gates = noise_model.basis_gates This can then be supplied to the execute() method, as is ...


4

I made those GIFs using the screen recorder ScreenToGif. ScreenToGif is not very good at compressing while maintaing quality, so I found it worked better to disable all optimizations while recording, try to preserve all detail, then post-process using GIMP's "Optimize (for GIF)" filter. GIMP is also handy for e.g. adding the text labels you see in the ...


4

When using a simulator, it doesn't really matter what kind of qubit you refer to. You can even mix-and-match the types. The type of qubit only becomes relevant when you intend to run on a device, because devices have qubits at specific locations. For example, if you wanted to run on Bristlecone, you would limit yourself to GridQubit instances that actually ...


3

There is no way to build the oracle in a way which would not defeat the point of Deutsch's algorithm - that's why it is an oracle-based algorithm. The only way would be if you would come up with an incredibly hard to compute function (this is, an incredibly long circuit) which would take one input bit $x$ and give one output bit $f(x)$ (but on the way could ...


3

For a specific quantum algorithm that uses 40 qubits, your friend makes a good point. One can just calculate the truth table (one might find this hard, but assume that one can) and use it as reference. Of course this starts to get ridiculous as you increase the number of qubits, not just because of the number of inputs but because computing the outcome of a ...


3

The output you've stated there appears to be correct. The Hadamard produces $$ |000\rangle\mapsto\frac{1}{\sqrt{2}}(|000\rangle+|100\rangle). $$ Then, the two controlled-nots give $$ \mapsto\frac{1}{\sqrt{2}}(|000\rangle+|111\rangle). $$ The final Hadamard then yields $$ \mapsto\frac{1}{2}((|0\rangle+|1\rangle)|00\rangle+(|0\rangle-1|\rangle)|11\rangle). $$ ...


3

This follows almost exclusively from noise and decoherence. In simulations, the qubits are perfect and will not decohere. Furthermore, noise has no influence on the qubits. In the actual hardware, the qubits are not perfect and hence are subject to decoherence and influences from the outside world. Therefore, measurement results might differ from what ...


3

The Run command on the IBMQ interface is for the actual run on the quantum architecture. The command Simulate implements the quantum circuit on a normal classical architecture but randomizes it to make it look like the actual quantum runs. Note that this could be a perfect measurement if it were to report, but IBM uses the statistics based on its own ...


3

Thanks for pointing this out. This is a bug that occurs when only a subset of the qubits are measured. It's being fixed. Until then, workarounds are: Use Aer instead of BasicAer (always the best thing to do when possible). Use LegacySimulators instead of BasicAer (this will give a deprecation warning). Install Qiskit from the master branch, where the issue ...


3

Could someone please provide me with some reference to what he is saying? Here is a reference to a discussion of this and related questions: Quant. Inf. Comp. 10, 3-4 pp. pp0258-0271 (2010), or https://arxiv.org/abs/0811.0898


3

I used this last time I needed to look up something about Bloch sphere. It's not perfect, since it doesn't allow entering the exact values of angles, let alone 2x2 matrices, but it has the benefit of being available online. This one looks promising in that it allows to enter matrices (and is also online), but I haven't tried it.


3

This doesn't really answer the question as it's not an online simulator. It might still be relevant though as it is a way to produce this sort of gifs if one has access to the software. It is relatively easy to do this sort of things using Wolfram Mathematica. As a quick and dirty example, if we just define a couple of relevant helper functions: pauliX = ...


3

If you are looking for a more complete implementation of a quantum variational algorithm in the context of Cirq, I would recommend looking at the second example in the OpenFermion-Cirq notebook found here. It uses a custom ansatz for hydrogen in a minimal basis, but makes a bit more explicit all the required pieces. Another good example, perhaps without ...


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