Programming Science Technology

An Introduction to Quantum Computing with Open Source Cirq Framework

An Introduction to Quantum Computing with Open Source Cirq Framework

Because the title suggests what we’re about to start discussing, this text is an effort to perceive how far we’ve got are available Quantum Computing and the place we’re headed within the subject so as to speed up scientific and technological analysis, via an Open Source perspective with Cirq.

First, we’ll introduce you to the world of Quantum Computing. We’ll attempt our greatest to clarify the essential concept behind the identical earlier than we glance into how Cirq can be enjoying a big position in the way forward for Quantum Computing. Cirq, as you may need heard of lately, has been breaking information within the subject and on this Open Science article, we’ll attempt to discover out why.

Earlier than we begin with what Quantum Computing is, it’s important to get to know concerning the time period Quantum, that’s, a subatomic particle referring to the smallest recognized entity. The phrase Quantum is predicated on the Latin phrase Quantus, which means, “how little”, as described on this brief video:

Will probably be simpler for us to perceive Quantum Computing by evaluating it first to Classical Computing. Classical Computing refers to how right now’s typical computer systems are designed to work. The gadget with which you’re studying this text proper now, may also be referred to as a Classical Computing System.

Classical Computing

Classical Computing is simply one other means to describe how a standard pc works. They work by way of a binary system, i.e, info is saved utilizing both 1 or zero. Our Classical computer systems can’t perceive some other type.

In literal phrases inside the pc, a transistor may be both on (1) or off (zero). No matter info we offer enter to, is translated into 0s and 1s, in order that the pc can perceive and retailer that info. Every thing is represented solely with the assistance of a mixture of 0s and 1s.

Quantum Computing

Quantum Computing, however, doesn’t comply with an “on or off” mannequin like Classical Computing. As an alternative, it will possibly concurrently deal with a number of states of data with assist of two phenomena referred to as superimposition and entanglement, thus accelerating computing at a a lot quicker fee and in addition facilitating higher productiveness in info storage.

Please word that superposition and entanglement usually are not the identical phenomena.

So, if we’ve got bits in Classical Computing, then within the case of Quantum Computing, we might have qubits (or Quantum bits) as an alternative. To know extra concerning the huge distinction between the 2, examine this web page from the place the above pic was obtained for rationalization.

Quantum Computer systems aren’t going to substitute our Classical Computer systems. However, there are specific humongous duties that our Classical Computer systems won’t ever find a way to accomplish and that’s when Quantum Computer systems would show extraordinarily resourceful. The next video describes the identical intimately whereas additionally describing how Quantum Computer systems work:

A complete video on the progress in Quantum Computing up to now:

Noisy Intermediate Scale Quantum

In accordance to the very just lately up to date analysis paper (31st July 2018), the time period “Noisy” refers to inaccuracy due to producing an incorrect worth brought on by imperfect management over qubits. This inaccuracy is why there might be critical limitations on what Quantum units can obtain within the close to time period.

Instructed learn

Tar Vs Zip Vs Gz : Distinction And Effectivity

“Intermediate Scale” refers to the dimensions of Quantum Computer systems which can be obtainable within the subsequent few years, the place the variety of qubits can vary from 50 to a number of hundred. 50 qubits is a big milestone as a result of that’s past what might be simulated by brute pressure utilizing probably the most highly effective present digital supercomputers. Learn extra within the paper right here.

With the arrival of Cirq, so much is about to change.

What’s Cirq?

Cirq is a python framework for creating, modifying, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits that we simply talked about. In different phrases, Cirq can tackle challenges to enhance accuracy and scale back noise in Quantum Computing.

Cirq doesn’t essentially require an precise Quantum Pc for execution. Cirq also can use a simulator-like interface to carry out Quantum circuit simulations.

Cirq is progressively grabbing a whole lot of tempo, with considered one of its first customers being Zapata, shaped final yr by a gaggle of scientists from Harvard College targeted on Quantum Computing.

Getting began with Cirq on Linux

The builders of the Open Source Cirq library advocate the set up in a digital python setting like virtualenv. The builders’ set up information for Linux might be discovered right here.

we efficiently put in and examined Cirq instantly for Python3 on an
Ubuntu 16.04 system by way of the next steps:

Putting in Cirq on Ubuntu

Cirq Framework for Quantum Computing in Linux

First, we might require pip or pip3 to set up Cirq. Pip is a software beneficial for putting in and managing Python packages.

Python three.x variations, Pip might be put in with:

sudo apt-get set up python3-pip

Python3 packages may be put in by way of:

pip3 set up <package-name>

We went forward and put in the Cirq library with Pip3 for Python3:

pip3 set up cirq

Enabling Plot and PDF era (elective)

Optionally available system dependencies not install-able with pip may be put in with:

sudo apt-get set up python3-tk texlive-latex-base latexmk

  • python3-tk is Python’s personal graphic library which allows plotting performance.
  • texlive-latex-base and latexmk allow PDF writing performance.

Later, we efficiently examined Cirq with the next command and code:

python3 -c ‘import cirq; print(’

We received the ensuing output as:

Configuring Pycharm IDE for Cirq

We additionally configured a Python IDE PyCharm on Ubuntu to check the identical outcomes:

Since we put in Cirq for Python3 on our Linux system, we set the trail to the undertaking interpreter within the IDE settings to be:


Within the output above, you’ll be able to observe that the trail to the undertaking interpreter that we simply set, is proven alongside with the trail to the check program file ( An exit code of zero exhibits that this system has completed executing efficiently with out errors.

So, that’s a ready-to-use IDE surroundings the place you’ll be able to import the Cirq library to begin programming with Python and simulate Quantum circuits.

Get began with Cirq

An excellent place to begin are the examples which were made out there on Cirq’s Github web page.

The builders have included this tutorial on GitHub to get began with studying Cirq. In case you are critical about studying Quantum Computing, they advocate a superb guide referred to as “Quantum Computation and Quantum Information” by Nielsen and Chuang.


OpenFermion is an open supply library for acquiring and manipulating representations of fermionic methods (together with Quantum Chemistry) for simulation on Quantum Computer systems. Fermionic methods are associated to the era of fermions, which in accordance to particle physics, comply with Fermi-Dirac statistics.

Steered learn

How Netflix Deploys Open Source AI to Reveal Your Favorites

OpenFermion has been hailed as an incredible apply device for chemists and researchers concerned with Quantum Chemistry. The primary focus of Quantum Chemistry is the appliance of Quantum Mechanics in bodily fashions and experiments of chemical techniques. Quantum Chemistry can also be referred to as Molecular Quantum Mechanics.

The arrival of Cirq has now made it attainable for OpenFermion to prolong its performance by offering routines and instruments for utilizing Cirq to compile and compose circuits for Quantum simulation algorithms.

Google Bristlecone

On March 5, 2018, Google introduced Bristlecone, their new Quantum processor, on the annual American Bodily Society assembly in Los Angeles. The gate-based superconducting system offers a check platform for analysis into system error charges and scalability of Google’s qubit know-how, along-with purposes in Quantum simulation, optimization, and machine studying.

Within the close to future, Google needs to make its 72 qubit Bristlecone Quantum processor cloud accessible. Bristlecone will regularly turn into fairly succesful to carry out a process that a Classical Supercomputer wouldn’t have the ability to full in an inexpensive period of time.

Cirq would make it simpler for researchers to instantly write packages for Bristlecone on the cloud, serving as a really handy interface for real-time Quantum programming and testing.

Cirq will permit us to:

  • Wonderful tune management over Quantum circuits,
  • Specify gate conduct utilizing native gates,
  • Place gates appropriately on the system &
  • Schedule the timing of those gates.

The Open Science Perspective on Cirq

As everyone knows Cirq is Open Source on GitHub, its addition to the Open Source Scientific Communities, particularly these that are targeted on Quantum Analysis, can now effectively collaborate to clear up the present challenges in Quantum Computing at the moment by creating new methods to scale back error charges and enhance accuracy within the present Quantum fashions.

Had Cirq not adopted an Open Source mannequin, issues would have undoubtedly been much more difficult. A terrific initiative would have been missed out and we might not have been one step nearer within the area of Quantum Computing.


To summarize in the long run, we first launched you to the idea of Quantum Computing by evaluating it to present Classical Computing methods adopted by an important video on current developmental updates in Quantum Computing since final yr. We then briefly mentioned Noisy Intermediate Scale Quantum, which is what Cirq is particularly constructed for.

We noticed how we will set up and check Cirq on an Ubuntu system. We additionally examined the set up for usability on an IDE surroundings with some assets to get began to study the idea.

Lastly, we additionally noticed two examples of how Cirq can be a vital benefit within the improvement of analysis in Quantum Computing, specifically OpenFermion and Bristlecone. We concluded the dialogue by highlighting some ideas on Cirq with an Open Science Perspective.

We hope we have been in a position to introduce you to Quantum Computing with Cirq in a simple to perceive method. When you have any suggestions associated to the identical, please tell us within the feedback part. Thanks for studying and we glance ahead to see you in our subsequent Open Science article.