Classical Computing | Quantum Computing |
---|---|
Classical Computers are used for classical computing. | Quantum Computers make use of the quantum computing approach. |
Data is stored in bits. | Data is stored in Qubits. |
It performs calculations in the form of binary digits. | It performs calculations on the basis of the object's probability. |
It can only process a limited amount of data. | It can process exponentially more data. |
Logical operations are carried out using the physical state, i.e., usually binary. | Logical operations are performed using the quantum state, i.e., qubits. |
Fails to solve too complex and massive problems. | Quantum Computers deals with complex and massive problems. |
It has standardized programming languages such as Java, C, C++. | It does not rely on any specific programming language. |
Classical systems are used for daily purposes. | These systems cannot be used for daily purposes as it is complex in nature, and scientists or engineers can use it. |
It is built with CPU and other processors. | It has a simple architecture and runs on the set of qubits. |
It provides security to data but limited. | It provides highly secured data and data encryption. |
Low speed and more time taking systems. | Improved speed and saves much time. |
TensorFlow
, which is TensorFlow Quantum (TFQ). TFQ is an open-source library. It is used to prototype quantum machine learning models. When it will be developed, it will enable developers to easily create hybrid AI algorithms that will allow the integration of techniques of a quantum computer and a classical computer. TFQ
is to bring quantum computing and machine learning techniques together to evenly build and control natural as well as artificial quantum computers
. Scientists are still facing some new and known challenges with quantum computing, but it will surely lead to software development in the coming years. CO2 (carbon dioxide)
for a better climate, etc. Quantum computing will be the most prominent in the field of computational chemistry.Q#
is Microsoft’s open-source programming language for developing and running quantum algorithms. It’s part of the Quantum Development Kit (QDK), an SDK which offers a set of tools that will assist you in the quantum software development process. Q#
programming language and librariesIQ#
kernel for running Q#
on Jupyter NotebooksCLI
extension to manage the Azure Quantum service and submit Q#
applications.NET
languages (C#, F#, and VB.NET
) with Q#
Q#
, Qiskit
, and Cirq
for quantum computing, so if you are already working in other development languages you can also run your circuits on Azure Quantum.Q#
is a standalone language offering a high level of abstraction. There is no notion of a quantum state or a circuit; instead, Q#
implements programs in terms of statements and expressions, much like classical programming languages. Distinct quantum capabilities (such as support for functors and control-flow constructs) facilitate expressing, for example, phase estimation and quantum chemistry algorithms.Q#
program constructs a Hamiltonian describing the Hydrogen molecule, and obtains estimates of its energy levels by simulating the quantum phase estimation algorithm.namespace Microsoft.Quantum.Chemistry.Samples.Hydrogen {
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Chemistry.JordanWigner;
open Microsoft.Quantum.Simulation;
open Microsoft.Quantum.Characterization;
open Microsoft.Quantum.Convert;
open Microsoft.Quantum.Math;
operation GetEnergyByTrotterization (qSharpData : JordanWignerEncodingData, nBitsPrecision : Int, trotterStepSize : Double, trotterOrder : Int) : (Double, Double) {
// The data describing the Hamiltonian for all these steps is contained in
// `qSharpData`
let (nSpinOrbitals, fermionTermData, statePrepData, energyOffset) = qSharpData!;
// Using a Product formula, also known as `Trotterization` to
// simulate the Hamiltonian.
let (nQubits, (rescaleFactor, oracle)) = TrotterStepOracle(qSharpData, trotterStepSize, trotterOrder);
// The operation that creates the trial state is defined below.
// By default, greedy filling of spin-orbitals is used.
let statePrep = PrepareTrialState(statePrepData, _);
// Using the Robust Phase Estimation algorithm of Kimmel, Low and Yoder.
let phaseEstAlgorithm = RobustPhaseEstimation(nBitsPrecision, _, _);
// This runs the quantum algorithm and returns a phase estimate.
let estPhase = EstimateEnergy(nQubits, statePrep, oracle, phaseEstAlgorithm);
// Obtaining the energy estimate by rescaling the phase estimate with the trotterStepSize. We also add the constant energy offset
// to the estimated energy.
let estEnergy = estPhase * rescaleFactor + energyOffset;
// This returns both the estimated phase, and the estimated energy.
return (estPhase, estEnergy);
}
}
Q#
is hardware agnostic, meaning that it provides the means to express and leverage powerful quantum computing concepts independently of how hardware evolves in the future. To be useable across a wide range of applications, Q#
allows you to build reusable components and layers of abstractions. To achieve performance with growing quantum hardware size, the Q#
quantum programming language ensures the scalability of both applications and development effort. Even though the full complexity of such computations requires further hardware development, Q#
programs can be targeted to run on various quantum hardware backends in Azure Quantum. Q#
that you can use with common tools and languages to develop quantum applications that you can run in various environments. A Q#
program can compile into a standalone application, or be called by a host program that is written either in Python or a .NET language.Q#
code to it. The simulator uses the Q#
code to create qubits (simulations of quantum particles) and apply transformations to modify their state. The results of the quantum operations in the simulator are then returned to the program. Isolating the Q#
code in the simulator ensures that the algorithms follow the laws of quantum physics and can run correctly on quantum computers.QDK
for each stage. Q#
that leverages the nature of quantum mechanics to produce a random number. Q#
project.Q#
. Q#
programs are structured.Q#
standalone (Set up a Q# standalone environment)Q#
and Python (Set up a Q# and Python environment)Q#
and C#
(Set up a Q# and .NET environment)Q#(Q Sharp)
project. This tutorial uses the environment based on Q#
applications with VS Code, but you can use your preferred IDE.Qrng.csproj
, and a Q#
application template, Program.qs
, that you will use to write your application.Program.qs
file with the following code :namespace Qrng {
open Microsoft.Quantum.Convert;
open Microsoft.Quantum.Math;
open Microsoft.Quantum.Measurement;
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Intrinsic;
operation SampleQuantumRandomNumberGenerator() : Result {
// Allocate a qubit
use q = Qubit();
// Put the qubit to superposition
// It now has a 50% chance of being measured 0 or 1
H(q);
// Measure the qubit value
return M(q);
}
}
open
the necessary namespaces from the Q# libraries for the functions and operations needed.SampleQuantumRandomNumberGenerator
operation, which takes no input and produces a value of type Result
. The Result type represents the result of a measurement and can have two possible values: Zero
or One
.qubit
with the use
keyword.H (Hadamard)
operation to place the qubit in an equal superposition
.M
operation to measure the qubit and return the measured value (Zero or One).To build multi-qubit states out of single-qubit states and discusses the gate operations needed to include in a gate set to form a universal many-qubit quantum computer. These tools are absolutely necessary to understand the gate sets that are commonly used in Q#
code, and also to gain intuition about why quantum effects such as entanglement or interference render quantum computing more powerful than classical computing.
As you work with Q#
, Pauli measurements are a common kind of measurement, which generalize computational basis measurements to include measurements in other bases and of parity between different qubits. In such cases, it is common to discuss measuring a Pauli operator, in general an operator such as X,Y,Z
or Z⊗Z,X⊗X,X⊗Y
, and so forth.
Discussing measurement in terms of Pauli operators is especially common in the subfield of quantum error correction.
Q#
guide follows a similar convention; this article explains this alternative view of measurements.
Some quantum algorithms are easier to understand in a circuit diagram than in the equivalent written matrix representation once you understand the visual conventions.
With Azure Quantum, you can use the azure-quantum
Python package to submit quantum circuits with Qiskit, Cirq, and also provider-specific formatted circuits.
Quantum circuit diagram conventions : In a circuit diagram, each solid line depicts a qubit, or more generally, a qubit register. By convention, the top line is qubit register and the remainder are labeled sequentially.
Operations are represented by quantum gates. The term quantum gate is analogous to classical logic gates. Gates acting on one or more qubit registers are denoted as a box. For example, the symbol
is a Hadamard operation acting on a single-qubit register.
In a quantum circuit, time flows from left to right. Quantum gates are ordered in chronological order with the left-most gate as the gate first applied to the qubits. In other words, if you picture the wires as holding the quantum state, the wires bring the quantum state through each of the gates in the diagram from left to right. That is to say
is the unitary matrix .
The previous examples have had precisely the same number of wires (qubits) input to a quantum gate as the number of wires out from the quantum gate. It may at first seem reasonable that quantum circuits could have more, or fewer, outputs than inputs in general. This is impossible, however, because all quantum operations, save measurement, are unitary and hence reversible. If they did not have the same number of outputs as inputs they would not be reversible and hence not unitary, which is a contradiction. For this reason any box drawn in a circuit diagram must have precisely the same number of wires entering it as exiting it.
Multi-qubit circuit diagrams follow similar conventions to single-qubit ones. As a clarifying example, a two-qubit unitary operation can be defined to be , so the equivalent quantum circuit is:
You can also view as having an action on a single two-qubit register rather than two one-qubit registers depending on the context in which the circuit is used.
Perhaps the most useful property of such abstract circuit diagrams is that they allow complicated quantum algorithms to be described at a high level without having to compile them down to fundamental gates. This means that you can get an intuition about the data flow for a large quantum algorithm without needing to understand all the details of how each of the subroutines within the algorithm work.
The action of a quantum singly controlled gate, denoted Λ(G)">, where a single qubit's value controls the application of G">, can be understood by looking at the following example of a product state input:
That is to say, the controlled gate applies G"> to the register containing ψ"> if and only if the control qubit takes the value 1">. In general, such controlled operations are described in circuit diagrams as
Here the black circle denotes the quantum bit on which the gate is controlled and a vertical wire denotes the unitary that is applied when the control qubit takes the value . For the special cases where G=X
and G=Z
, the following notation is used to describe the controlled version of the gates (note that the controlled-X gate
is the CNOT gate):
Q#
code. As such, you need to keep some restrictions in mind when developing programs for different targets. Currently, Azure Quantum and the QDK
manage three different profiles for QPUs:Q#
program within the limits of memory for simulators or the number of qubits for physical quantum computers.Q#
program that doesn't require the use of the results from qubit measurements to control the program flow. Within a Q#
program targeted for this kind of QPU
, values of type Result don't support equality comparison.Q#
program targeted for this kind of QPU
, you can only compare values of type Result as part of conditions within if statements in operations. The corresponding conditional blocks might not contain return or set statements.