Git Product home page Git Product logo

andrewmessecar / pennylane_bell_states_circuit Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 5 KB

A simple Python 3 script for introducing new users to quantum programming in the PennyLane environment. This code was developed as an introductory exercise during the "2023-11-28 Using PennyLane on Pawsey’s Setonix supercomputer" webinar tutorial.

Home Page: https://pennylane.ai/

Python 100.00%
introduction pennylane python3 quantum quantum-computing tutorial

pennylane_bell_states_circuit's Introduction

Andrew S. Messecar, 2023

This Python 3 script was developed as a simple introductory exercise during the 28 November 2023 "Using PennyLane on Pawsey's Setonix supercomputer" webinar. In addition to the Python3 open-source programming language, it requires the "pennylane", "pennylane-lightning", and "pennylane-lightning[kokkos]" libraries, all of which are freely available to be installed via pip3.

The program serves as a "Hello World"-esque quantum computing 101 exercise in the PennyLane programming environment. The script initializes a 2-qubit circuit on a specified quantum computing device or simulator. More information about available devices is provided at https://pennylane.ai/plugins/

A quantum node or "QNode" is then created by decorating using the initialized 2-qubit circuit.

Following this, a user-defined function is declared which applies a Hadamard gate to the first of the two qubits in the circuit; this places the first qubit in a state of superposition. The function proceeds to entangle the two qubits together via a Controlled NOT (CNOT) gate before returning the probability values of both qubits occupying each of the computational basis states to the user in lexicographic order.

The program concludes by calling this user-defined function, printing the returned probability values to the user, and then printing a diagram of the simulated circuit to the user.

Additional capabilities of the PennyLane environment that were discussed in the webinar but are non-essential to the basic functionality of the script have been commented out. These include: importing NumPy through PennyLane using a separate alias, changing between plugins to run the simulated circuit on different quantum computing simulators or devices, and a separate function for drawing the simulated quantum computing circuit when programming with PennyLane in Jupyter notebooks.

pennylane_bell_states_circuit's People

Contributors

andrewmessecar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.