delete

Contattaci

back to resources

Introduction to Quantum Computing and Qiskit

data
15/1/2021
data progetto
autore
Carla Melia, Monica Mura
cliente
partnership
url
No items found.

Traditional VS quantum computers

Since the 1960's, the power of our computers has kept growing exponentially, allowing them to get smaller and more powerful. 

A computer is made up of very simple components: computer chips contain modules, that contain logic gates, that contain transistors.

A transistor is the simplest form of a data processor in computers, and it basically consists of an electric switch that can either block or open the way for information flow. This information is made up of bits that can be set to either 0 or 1 and that are the smallest unit of information.

These switches are approaching smaller and smaller sizes as technology improves. Today, a typical scale for transistors is 14 nm, about 500 times smaller than a red blood cell, but they can be also smaller.

In the quantum world, physics works quite differently from the predictable ways we are used to, and traditional computers just stop making sense. We are approaching a real physical barrier for our technological progress. Now, scientists are trying to use these unusual quantum properties to their advantage by building quantum computers.

Quantum computers do not use bits but qubits that can be created using electrons, atoms, photons, or even molecules. These qubits can be in any proportions of both 1 and 0 states at once and this property is called superposition.

However, as soon as a qubits value is tested, for example by sending the photon through a filter, it must decide to be either vertically or horizontally polarized. So, as long as it's unobserved, the qubit is in a superposition of probabilities for 0 and 1, and you can't predict which it'll be. But the instant you measure it, it collapses into one of the definite states.


Curiosity
In 1935, Erwin Schrödinger devised a well-known thought experiment, now known as Schrödinger's cat, which highlighted this dissonance between quantum mechanics and classical physics. For more info about quantum superposition visit the following link (https://www.youtube.com/watch?v=lZ3bPUKo5zc)

Another property qubits can have is entanglement, a close connection that makes each of the qubits react to a change in the other's state instantaneously, no matter how far they are apart. This means when measuring just one entangled qubit, you can directly deduce properties of its partners without having to look.

Also, Qubit manipulation is very interesting: a normal logic gate gets a simple set of inputs and produces one definite output. A quantum gate manipulates an input of superpositions, rotates probabilities, and produces another superposition as its output. For further details check this link (https://towardsdatascience.com/demystifying-quantum-gates-one-qubit-at-a-time-54404ed80640).

So, in summary, a quantum computer sets up some qubits, applies quantum gates to entangle them and manipulate probabilities, then finally measures the outcome, collapsing superpositions to an actual sequence of 0s and 1s. What this means is that you get the entire lot of calculations that are possible with your setup, all done at the same time.

So, while quantum computers will not probably replace our home computers, in some areas, they are vastly superior: one of them is database searching.

To find something in a database, a normal computer may have to test every single one of its entries. Quantum computers algorithms need only the square root of that time. Moreover, the magnitude in data storing of quantum computing is incredible, in fact, 4 classical bits can be in one of 16 possible combinations at time. Four qubits in superposition, however, can be in all those 16 combinations at once. This number grows exponentially with each extra qubit, so 20 of them can already store a million values in parallel. This is why a 500-bit quantum computer can store more amplitudes than there are atoms in the universe.

Examples of quantum computers

In this last years companies like Google and IBM have invested highly in quantum computing. In 2019, Google built the first machine that achieved quantum supremacy, that is the first to outperform a supercomputer. Then the Jian-Wei Pan’s team at the University of Science and Technology of China has developed the world's most powerful quantum computer, Jiuzhang, that can perform a task 100 trillion times faster than the world's fastest supercomputer. Jiuzhang is reported to be 10 billion times faster than Google's machine and to be able to perform calculations, that a traditional computer would take 600 million years, in just 200 seconds.

However, China has not built a fully functional quantum computer: there are lots of challenges to build a practical quantum computer. For example, the qubits must be created and stored at a temperature close to absolute zero and the computers must be isolated from atmospheric pressure and magnetic field of Earth. 

Qiskit

However, if you are interested in having a first try in quantum programming now you can. Qiskit is an open-source framework that provides tools for implementing and manipulating quantum programs and running them on prototype quantum devices also on simulators on a local computer. 

The primary version of Qiskit uses the Python programming language and here (https://qiskit.org/textbook/preface.html) you can find a textbook for learning how it works. Quantum computing is new and writing quantum algorithms can be very tricky, but Qiskit helps making it simpler and more visual. 

“The best way to learn is by doing. Qiskit allows users to run experiments on state-of-the-art quantum devices from the comfort of their homes. The textbook teaches not only theoretical quantum computing but the experimental quantum physics that realises it.” Qiskit.org

Now, let’s try to use Qiskit by combining it with a machine learning process with the help of the textbook.

Example of quantum machine learning (QML)

Quantum machine learning (QML) is an area of research that aims to exploit the advantages of quantum computing to enhance machine learning algorithms. In this example, we will see how to create a hybrid quantum-classical neural network on Python using PyTorch and Qiskit. To do this, we have to insert a quantum node inside a classical neural network.

The quantum node is a hidden layer of the network between two classical ones. It fits as a parameterized quantum circuit: a quantum circuit where the rotation angles for each gate are specified by the input vector of the previous classical layer. The measurements made by the quantum circuit are then collected and used as inputs for the following layer.

Let's see how we can implement and test our hybrid network. First of all, we need to describe the quantum circuit, the “quantum layer” and the specific functions for the forward-propagation and back-propagation steps.    

The quantum circuit is defined by the class "QuantumCircuit" using QiSkit: it requires to specify how many trainable quantum parameters and shots we want to use. In this case, for simplicity, we will use a 1-qubit circuit with one trainable quantum parameter θ and an RY−rotation by the angle θ to train its output. This last is measured in the z-basis computing the σz expectation.

The functions for forward-propagation and back-propagation are defined by the class “HybridFunction" and the quantum layer of the network is defined by the class "Hybrid".

We want to develop an image classifier using the first two categories of the Fashion-MNIST dataset: T-shirt/top and Trouser. So, now we have to organize our dataset into training and test data and create our hybrid network. 

We create a simple Convolutional Neural Network consisting of two convolutional layers, one dropout layer, two fully-connected layers, and finally the quantum layer. Since our quantum circuit contains one parameter, we must ensure the network condenses neurons down to size 1, as it happens in the second fully-connected layer. The value of its last neuron is used as the parameter θ into the quantum circuit to compute the σz measurement and obtain the final prediction.

Now we have all the elements to train and test our hybrid network.

This is a simple example of what we can do using Qiskit, for the complete and editable version of the code click here (https://qiskit.org/textbook/ch-machine-learning/machine-learning-qiskit-pytorch.html).

Resources

Article by Carla Melia and Monica Mura, data scientists at Orbyta Srl, 11.01.2021

Risultati

resources

Le opportunità dell’AI generativa per chi vende online

Le opportunità dell’AI generativa per chi vende online

Massimizzare l'efficienza: come gestire la profondità delle code con Infrared360®

Massimizzare l'efficienza: come gestire la profondità delle code con Infrared360®

sistemi di messaggistica aziendale

Infrared360

profondità code ambienti IBM MQ

ambienti IBM MQ

Gestione dell'identità e degli accessi negli ambienti MQ

Gestione dell'identità e degli accessi negli ambienti MQ

middleware

accessi ambienti MQ

ambienti MQ

gestione MQ

Ottimizzazione delle configurazioni dei canali IBM MQ

Ottimizzazione delle configurazioni dei canali IBM MQ

canali IBM MQ

Infrared360

monitoraggio IBM MQ

Integrazione efficiente di sistemi bancari e finanziari transazionali nelle fusioni e acquisizioni bancarie

Integrazione efficiente di sistemi bancari e finanziari transazionali nelle fusioni e acquisizioni bancarie

integrazioni IT

sistemi transazionali

sistemi finanziari

Monitoraggio dello stato di salute del middleware: l'importanza di un approccio proattivo

Monitoraggio dello stato di salute del middleware: l'importanza di un approccio proattivo

monitoraggio middleware

Avada Software

middleware

Migliora l’efficienza operativa dell’infrastruttura middleware in tutte le unità aziendali

Migliora l’efficienza operativa dell’infrastruttura middleware in tutte le unità aziendali

Middleware

Efficienza operativa

Introduzione a Godot, game engine free & open source

Introduzione a Godot, game engine free & open source

Game Engine

Open Source

Unreal Engine

Unity

TDA in a nutshell: how can we find multidimensional voids and explore the “black boxes” of deep learning?

TDA in a nutshell: how can we find multidimensional voids and explore the “black boxes” of deep learning?

Multidimensional Voids

Black Boxes

Deep Learning

Topological Data Analysis

AI: bias, esempi nella realtà e nella cinematografia

AI: bias, esempi nella realtà e nella cinematografia

Bias

Cinema

AMRITA (Automatic, Maintenance, Reengineering, Integrated, Technology Application)

AMRITA (Automatic, Maintenance, Reengineering, Integrated, Technology Application)

L'ascesa del Prompt Designer: trasformare il design nell'era dell'AI generativa

L'ascesa del Prompt Designer: trasformare il design nell'era dell'AI generativa

Prompt

Design

AI Generativa

AI Designer

Le nuove linee guida per la sicurezza delle password aziendali

Le nuove linee guida per la sicurezza delle password aziendali

Password aziendali

Linee guida Garante Privacy

Garante Privacy

GDPR

6 motivi per scegliere Flutter nel 2024

6 motivi per scegliere Flutter nel 2024

App Development

Google

React Native

AI, sistemi esperti e rappresentazione della conoscenza

AI, sistemi esperti e rappresentazione della conoscenza

Sistemi esperti

Rappresentazione della conoscenza

Tradurre la Lingua Italiana dei Segni - il Progetto LIS2Speech

Tradurre la Lingua Italiana dei Segni - il Progetto LIS2Speech

LIS2SPEECH

Traduzione LIS

User Experience Design tra accessibilità e inclusività

User Experience Design tra accessibilità e inclusività

User Experience

Accessibilità

Inclusività

Assitech.Net entra nella galassia Orbyta Technologies

Assitech.Net entra nella galassia Orbyta Technologies

Orbyta Technologies

Orbyta Group

Acquisizione

News

Programmazione Funzionale Java

Programmazione Funzionale Java

Functional Programming

Java

Software Development

Reactive Programming: parallelizzare con Project Reactor

Reactive Programming: parallelizzare con Project Reactor

Programmazione Reattiva

Reactive Programming

Project Reactor

Piattaforme E-commerce Wholesale per il settore B2B

Piattaforme E-commerce Wholesale per il settore B2B

Wholesale

B2B

Antipattern nello sviluppo software: altri errori da evitare

Antipattern nello sviluppo software: altri errori da evitare

Software Development

Antipattern nello sviluppo software: definizione, ambiti di applicazione ed esempi

Antipattern nello sviluppo software: definizione, ambiti di applicazione ed esempi

Software Development

App tattiche di supporto alla gestione dei progetti reiterativi

App tattiche di supporto alla gestione dei progetti reiterativi

App Development

Power Platform

Low Code

DevOps

Introduzione a Power Pages, il servizio Microsoft per siti web low-code

Introduzione a Power Pages, il servizio Microsoft per siti web low-code

Microsoft

Low-code

Power Platform

Introduzione a Jupyter e Seaborn per Data Analysis e Visualization

Introduzione a Jupyter e Seaborn per Data Analysis e Visualization

Jupiter

Python

Data Analysis

Data Visualization

Come utilizzare Matplotlib per la Data Visualization in Python

Come utilizzare Matplotlib per la Data Visualization in Python

Python

Data Visualization

Data Science

Data Analysis

Introduzione alla libreria Dash per Python

Introduzione alla libreria Dash per Python

Python

Data Science

Data Visualization

Data Analysis

Prime Video passa al monolite: ma allora serverless è inutile? 

Prime Video passa al monolite: ma allora serverless è inutile? 

Tableau per la Business Intelligence: introduzione, tutorial e confronto

Tableau per la Business Intelligence: introduzione, tutorial e confronto

Introduzione a Qlik Sense, piattaforma di Business Intelligence avanzata

Introduzione a Qlik Sense, piattaforma di Business Intelligence avanzata

Applicazioni Cloud Native: definizione, vantaggi e tecnologie

Applicazioni Cloud Native: definizione, vantaggi e tecnologie

Power Apps Tutorial – Case Study: come costruire una business app da zero

Power Apps Tutorial – Case Study: come costruire una business app da zero

Il futuro del gaming tra F2P, GaaS, Crypto e Play to Earn

Il futuro del gaming tra F2P, GaaS, Crypto e Play to Earn

Power Apps Basics: interfacce, implementazione & vantaggi

Power Apps Basics: interfacce, implementazione & vantaggi

Strumenti di Business Intelligence: QlikSense & Power BI a confronto

Strumenti di Business Intelligence: QlikSense & Power BI a confronto

Introduzione a Serverless: non solo Lambda Function

Introduzione a Serverless: non solo Lambda Function

Metaverso: siamo pronti a cogliere l’opportunità?

Metaverso: siamo pronti a cogliere l’opportunità?

Recap Flutter Forward 2023: le 7 novità più interessanti

Recap Flutter Forward 2023: le 7 novità più interessanti

Let's Redux React to a Game

Let's Redux React to a Game

Introduzione a PowerShell

Introduzione a PowerShell

Pago con carta: i trend dei pagamenti digitali e il futuro delle carte di credito

Pago con carta: i trend dei pagamenti digitali e il futuro delle carte di credito

NFT World: il fenomeno NFT tra metaverso, business e GameFi

NFT World: il fenomeno NFT tra metaverso, business e GameFi

Quick Escape Room

Quick Escape Room

Orbyta Invaders Ignition

Orbyta Invaders Ignition

Il lancio della nuova Identity di Orbyta parte dal Metaverso!

Il lancio della nuova Identity di Orbyta parte dal Metaverso!

development

design

metaverse

brand identity

Database a grafo in SQL Server

Database a grafo in SQL Server

Data Science Job Roles: i 4 ruoli più richiesti nel settore

Data Science Job Roles: i 4 ruoli più richiesti nel settore

Teoria dei giochi: Propagazione delle strategie

Teoria dei giochi: Propagazione delle strategie

The chosen one: .NET 5

The chosen one: .NET 5

Network Science e Social Network Analysis

Network Science e Social Network Analysis

Isolation levels on SSMS

Isolation levels on SSMS

Teoria dei Grafi

Teoria dei Grafi

Creare un podcast in automatico a partire da audio vocali e musica

Creare un podcast in automatico a partire da audio vocali e musica

Teoria dei Giochi

Teoria dei Giochi

Recommender systems: principali metodologie degli algoritmi di suggerimento

Recommender systems: principali metodologie degli algoritmi di suggerimento

Introduction to Quantum Computing and Qiskit

Introduction to Quantum Computing and Qiskit

System Versioned Tables

System Versioned Tables

Vim o non Vim

Vim o non Vim

I vantaggi di un Message Broker

I vantaggi di un Message Broker

PlayStation 5 e l'accesso ai dati: un cambio architetturale?

PlayStation 5 e l'accesso ai dati: un cambio architetturale?

Protezione dei Web Services

Protezione dei Web Services

need more info?

Contattaci