Giter Club home page Giter Club logo

quantum-computing-library's Introduction

Quantum-Computing-Libs

To start working with the Quantum Computing Library Toolkit, first copy the 'QCLibs' folder to the project folder and then just type the following line in your C/C++ program:-

#include "QCLibs/QCLibs.h"

This should include all the functionalities for defining Qubits and doing various Operations on them!

Also see the 'Examples' folder to know more about the functionality. The 'Examples' folder contains various examples like:-

  1. CNOT Gate
  2. Hadamard Gate
  3. Rotation of qubits about X, Y, Z - Axes of Bloch Sphere
  4. Quantum NOT Gate
  5. Quantum Registers
  6. Quantum Rotation about imaginary axis
  7. Quantum swapping of two Qubits

Quantum Registers

This feature allows the use to make registers consisting of multiple qubits at a time.

To make the coding of these gates easier, a functionality of short-hand gates is provided. The gates can be applied to the register as follows:-

quReg *qr = newQuReg(2);

char gate_string[] = "(T: quReg2 = ), \
						(Pa), \
						{\
							[X, X], [Z, Y], [H, H], [X, Z], [Y, X] \
						},\
						(Pnz)";

qr = applyGates_reg(gate_string, qr);

OUTPUT:

./q.out

quReg2 = 
[0]:	{1.000000 + 0.000000 i} |00>	100.00 %
[1]:	{0.000000 + 0.000000 i} |01>	0.00 %
[2]:	{0.000000 + 0.000000 i} |10>	0.00 %
[3]:	{0.000000 + 0.000000 i} |11>	0.00 %

quReg2 = 
[0]:	{-0.000000 - 0.500000 i} |00>	25.00 %
[1]:	{-0.000000 + 0.500000 i} |01>	25.00 %
[2]:	{-0.000000 - 0.500000 i} |10>	25.00 %
[3]:	{-0.000000 + 0.500000 i} |11>	25.00 %

The above code segment has the following meaning:-

  • Initialize a new quRegister.
  • Display text for the quRegister is "quReg2 = ".
  • (Pa) -> Print all possible combinations of 'n' qubits in the quRegister.
  • Pauli gate 'X' is applied to [qubit[0], qubit[1]] respectively.
  • Pauli gate 'Z' is applied to qubit[0] and 'Y' to qubit[1] respectively, and so on.
  • (Pnz) -> Print only non-zero magnitude values.

List of short-hand gates

  • Pauli-X gate: X
  • Pauli-Y gate: Y
  • Pauli-Z gate: Z
  • Hadamard gate: H
  • Phase gate: S
  • Rotation gate: R_xx.xx (x = 0, 1,..., 9; AngleMode = degrees)
  • CNOT gate: (atleast one 'Co' and one 'Cx' should be there in same [.])
    • Control gate: Co
    • NOT gate: Cx
  • Swap gate: Sx (atleast two should be there in same [.])
  • Quantum Fourier Transform (QFT): Q (coming soon...)
  • Inverse QFT: Qi (coming soon...)

For more info, see the examples: https://github.com/AbeerVaishnav13/Quantum-Computing-Library/tree/master/Examples

*Currently, the library supports registers upto 28-qubits with 8GB of memory.

and more on the way!

Enjoy! :)

Regards Abeer Vaishnav

quantum-computing-library's People

Contributors

abeervaishnav13 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.