Metadata-Version: 2.1
Name: qemlib
Version: 0.1.0
Summary: A modular quantum error mitigation library (ZNE, PT, DD, REM)
Author: Hamza Benkadour
License: MIT License
        
        Copyright (c) 2026 Hamza Benkadour
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Classifier: Programming Language :: Python :: 3
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: scipy
Requires-Dist: matplotlib
Requires-Dist: qiskit>=1.0
Requires-Dist: qiskit-aer
Requires-Dist: qiskit-ibm-runtime

# qemlib

A modular **Quantum Error Mitigation (QEM)** library built on Qiskit.

> `qemlib` provides research-oriented implementations of major quantum error mitigation techniques, designed for experimentation, benchmarking, and research workflows in noisy quantum computation.

---

## 🚀 Features
- **Dynamical Decoupling (DD)**
- **Zero Noise Extrapolation (ZNE)**
- **Pauli Twirling (PT)**
- **Readout Error Mitigation (REM)**
- Modular, researcher-focused API
- Full compatibility with Qiskit circuits


## 📦 Installation
Install directly from GitHub:

```bash
pip install git+https://github.com/hmzbn/qemlib.git
```

## ⚡ Quick Start
See the [`examples/`](examples) directory for complete usage demonstrations of all implemented mitigation techniques.


## 📁 Examples
- `dd_exp.ipynb` — Dynamical decoupling workflows
- `zne_exp.ipynb`, `zne_exp2.ipynb` — Zero noise extrapolation experiments
- `pt_exp.ipynb`, `pt_exp2.ipynb` — Pauli twirling tests
- `rem_exp.ipynb` — Readout error mitigation demo


## 🧠 Implemented Techniques

### Dynamical Decoupling (DD)
- **Location:** `qemlib/dd/`
- **Modules:**
  - `dd.py` — DD execution wrapper
  - `insertion.py` — Circuit-level DD insertion
  - `seq.py` — Sequence definitions (`xx`, `xp_xm`, `xy4`)

### Zero Noise Extrapolation (ZNE)
- **Location:** `qemlib/zne/`
- **Modules:**
  - `zne.py` — Core logic
  - `folding.py` — Circuit folding methods
  - `functional.py` — Workflow helpers
  - `models.py` — Extrapolation functions
  - `executor.py` — Execution abstraction
  - `plotting.py` — Visualization utilities

### Pauli Twirling (PT)
- **Location:** `qemlib/pt/`
- **Modules:**
  - `pt.py` — Twirling logic
  - `pauli.py` — Operator utilities
  - `twirl.py` — Transformation routines

### Readout Error Mitigation (REM)
- **Location:** `qemlib/rem/`
- **Modules:**
  - `rem.py` — Calibration and mitigation tools


## 🏗️ Architecture & Design Principles
- **Modular architecture** with clear separation of concerns:
  1. Circuit transformation
  2. Noise scaling
  3. Execution
  4. Post‑processing
- Minimal abstraction overhead
- Research‑oriented flexibility and transparency
- Built on top of Qiskit for compatibility and extensibility


## 🤝 Contributing
Contributions are welcome! Please:
1. Fork the repository
2. Create a feature branch
3. Submit a pull request


## 📜 License
This project is released under the [MIT License](LICENSE).


## 📖 Citation
If you use **qemlib** in academic work, please cite:

```bibtex
@software{qemlib,
  author = {Hamza Benkadour},
  title = {qemlib: A Modular Quantum Error Mitigation Library},
  year = {2026},
  url = {https://github.com/hmzbn/qemlib}
}
```

---

Happy mitigating! 😊

