Giter VIP home page Giter VIP logo

indian-institute-of-science-qc / qiskit-aakash Goto Github PK

View Code? Open in Web Editor NEW
29.0 9.0 22.0 84.54 MB

This repository contains a new backend which can simulate noisy quantum logic circuits using the density matrix formalism.

Home Page: https://doi.org/10.1142/S0129183122501030

License: Apache License 2.0

Batchfile 0.06% Makefile 0.07% Shell 0.17% Python 97.19% Pascal 0.09% Jupyter Notebook 1.55% OpenQASM 0.31% Cython 0.56%
python qiskit quantum-computing density-matrix quantum-noise

qiskit-aakash's People

Contributors

1ucian0 avatar abbycross avatar abdonrd avatar ajavadia avatar atilag avatar awcross1 avatar biplab37 avatar chriseclectic avatar dcmckayibm avatar delapuente avatar diego-plan9 avatar ewinston avatar githimanshuc avatar ismaelfaro avatar itoko avatar jaygambetta avatar jesusprubio avatar kdk avatar levbishop avatar maddy-tod avatar max-reuter-2 avatar mtreinish avatar namanroshan avatar nkanazawa1989 avatar nonhermitian avatar obliviateandsurrender avatar pacomf avatar rraymondhp avatar taalexander avatar yaelbh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qiskit-aakash's Issues

Testing of Terra Upgrade Branch

Hi all. At this point, the terra_upgrade branch is functional and runs all examples with the expected output and passes all tests. I would like to know if you have any other tests that you would like to perform before we can merge this into the main repository.

Regarding decoherence_and_amp_decay

Information

  • Qiskit Terra version:
  • Python version:
  • Operating system:

What is the current behavior?

In dm_simulator.py
The amplitude decay ,thermalization and decoherence is applied at end of every clock cycle to all the qubits.
In the main code at line 1173 a for loop is applied for adding errors to all the qubits by calling _add_decoherence_and_amp_decay function .
Inside the function _add_decoherence_and_amp_decay again a for loop is applied for all the qubits at line 411.
I think one of the loop is redundant but not sure .
Request your comments on the same

Steps to reproduce the problem

What is the expected behavior?

Suggested solutions

Regarding Bell basis measurement

Currently for Bell basis measurement dm_simulator uses measure method like qc.measure(0,0,basis='Bell',add_param='23')
Where 'add_param' tells the pair of qubit's on which measurement is being made.
First two arguments are not consider at all and are considered as dummy.
First two args of measure method are only used in case of single qubit measurement.

so if we go with qc.draw(), visually the circuit shows that measurement is being made on 0th qubit and result is stored on 0th classical bit. But in actual the measurement is made on qubit pair '23' in Bell basis

Is it possible to have measure method which will consider the first two parameters (two qubits & classical bits)
and perform bell basis measurement on those, instead of qubits in 'add_params' argument.
e.g qc.measure([2,3], [0,0] , basis='Bell' )
and qc.draw() gives correct visualization with respect to measurement.

Request you to share your thoughts whether it is advisable/rational to do it or not.
If its possible, request you to please guide us on how it can be achieved.

Installation method not working

Information

  • Qiskit Terra version:
  • Python version:
  • Operating system:

What is the current behavior?

Installation is via python3 -m pip install .
This leads to an uneditable install, and causes cython based modules to not work

Steps to reproduce the problem

Install with python3 -m pip install .
Run the example code

What is the expected behavior?

Cython based packages work

Suggested solutions

Replace installation command with python3 -m pip install -e .
This solves the issue

dm_simulator ported to Qiskit-terra 0.20.1 with additional features

Information

  • Qiskit Terra version: 0.20.1

I have ported the dm_simulator to Qiskit-terra 0.20.1

The ported version can be found in this link: dmsim0.20.1

After porting, I tested out all the qiskit-textbook algorithms in the dm_simulator.

Issues identified during testing

  • Plot option does not return to default value when not stated in backend options.
  • Single measurements do not output partial probability
  • Once the backend noise is applied, it does not go back to default once the backend options are removed.(The issue was that rotation_error was a dictionary and was shallow copied from DEFAULT_OPTIONS and the DEFAULT_OPTIONS changed once we updated rotation_error. Hence it had to be deep copied.)
  • Result is a dictionary. Many qiskit algorithms expect the result to be an object similar to that in qasm_simulator, and they check for attributes which throws an error

Changes made

  • Plot and show_partition options returns to default option(False).
  • Rotation_error returns to default values
  • Single measurements now output partial probability
  • Result is changed to an object instead of dictionary, as in qasm simulator. This also improves user convenience as the usage is similar to that of qasm_simulator.
  • Made necessary changes to bell measurements to remove add_params requirement. This change is made in reference to issue #7.
     qc2 = QuantumCircuit(3,3)
     qc2.measure(1,2,basis='Bell')           #Measures bell_probabilities on the pair of qubits [1,2]
     options2 = {
         'plot': True
     }
     backend = BasicAer.get_backend('dm_simulator')
     run2 = execute(qc2,backend,**options2,shots=1)
     result2 = run2.result()
     result2.get_probability()

Features added

  • Added plot option for partial_probability
  • Added new methods to result:
    • get_densitymatrix() outputs the densitymatrix
    • get_probability() outputs the partial_probability, ensemble_probability, etc depending on the basis of measurement
    • get_expectation() outputs the expectation when the basis is ‘Expect’

I have also added the qiskit algorithms jupyter notebooks taken directly from qiskit-textbook, with changes made for the dm_simulator. These algorithms can be found in the algorithm folder inside dm_simulator_user_guide.

Observations

  • In a quantum circuit, if you measure some qubits using ensemble basis, and others using ‘X’, ’Y’, or ‘Z’ (default) basis, the partial_probabilities dictionary will contain partial probabilities of latter qubits. The get_probability() function will prioritize and output partial probabilities. Since I have also added plot option for partial probabilities, both partial probabilities and ensemble probabilities will be plotted.
  • The partial probabilities outputs the probabilities similar to the format of qasm_simulator(little endian). i.e. they output the last qubit as the most significant qubit. This is opposite to that of ensemble probabilities dictionary.
  • If we are taking an ensemble measurement in a circuit, we only need to take one such measurement. If we take multiple such ensemble measurements, multiple plots will be plotted(given plot=True).
  • For removing add_params for bell measurement, the first argument(qubit) and the second argument(cbit) are added together to form add_param. Since the function is still measure function, a classical bit should be present in the quantum circuit that is equal to the second argument. Otherwise, it throws a 'CircuitError'.

Final Note

Let me know any issues/suggestions/comments you have regarding the update. You can add the branch to the repository as you wish.

aakash dm simulator separated out from qiskit

What is the expected behavior?

I have separated the dm simulator code from qiskit and built it into a python library - qc-dm-backend

Testing done

How is this useful?

  • The code can be compiled independent of Qiskit code updates or changes
  • It is smaller and easier to port to newer versions of Qiskit that is incompatible with the dm simulator library

Note

  • Please feel free to copy / use this library as deemed fit by the qiskit-aakash team
  • Any suggestions or queries are welcome (e.g. further testing / missed out features while porting )

Partial probability keys in reverse order, single measurement does not output partial probability.

Information

  • Qiskit Terra version: 0.9.0
  • Python version:
  • Operating system:

What is the current behavior?

  1. The partial probability keys are in reverse order of the keys of ensemble probabilities. This inconsistency results in confusions for the user when using the respective dictionaries.
  2. Single measurements do not output partial_probability in the result. Currently there is no direct way to get probabilities of a single measurement on specific qubit.

I wanted to know whether these are intended behaviours.

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.