{"id":46092712,"url":"https://github.com/matchcake/matchcake","last_synced_at":"2026-03-01T18:02:34.111Z","repository":{"id":236970999,"uuid":"699543422","full_name":"MatchCake/MatchCake","owner":"MatchCake","description":"Fermionic Machine Learning python package built on PennyLane","archived":false,"fork":false,"pushed_at":"2026-02-28T01:41:17.000Z","size":8795,"stargazers_count":16,"open_issues_count":9,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-28T06:15:56.087Z","etag":null,"topics":["quantum-circuit-simulator","quantum-computing","quantum-machine-learning"],"latest_commit_sha":null,"homepage":"https://matchcake.github.io/MatchCake/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MatchCake.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-10-02T20:57:26.000Z","updated_at":"2026-02-20T01:03:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"77ccc031-6fe5-47dc-8331-f58250061460","html_url":"https://github.com/MatchCake/MatchCake","commit_stats":null,"previous_names":["matchcake/matchcake"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/MatchCake/MatchCake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatchCake%2FMatchCake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatchCake%2FMatchCake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatchCake%2FMatchCake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatchCake%2FMatchCake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MatchCake","download_url":"https://codeload.github.com/MatchCake/MatchCake/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MatchCake%2FMatchCake/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29977966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T16:35:47.903Z","status":"ssl_error","status_checked_at":"2026-03-01T16:35:44.899Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["quantum-circuit-simulator","quantum-computing","quantum-machine-learning"],"created_at":"2026-03-01T18:02:33.270Z","updated_at":"2026-03-01T18:02:34.099Z","avatar_url":"https://github.com/MatchCake.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MatchCake\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/MatchCake/MatchCake/blob/main/images/logo/Logo.svg?raw=true\" width=\"60%\" /\u003e\u003c/p\u003e\n\n[![Star on GitHub](https://img.shields.io/github/stars/MatchCake/MatchCake.svg?style=social)](https://github.com/MatchCake/MatchCake/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/MatchCake/MatchCake?style=social)](https://github.com/MatchCake/MatchCake/network/members)\n[![Python 3.6](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org/downloads/release/python-310/)\n[![downloads](https://img.shields.io/pypi/dm/MatchCake)](https://pypi.org/project/MatchCake)\n[![PyPI version](https://img.shields.io/pypi/v/MatchCake)](https://pypi.org/project/MatchCake)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n\n![Tests Workflow](https://github.com/MatchCake/MatchCake/actions/workflows/tests.yml/badge.svg)\n![Dist Workflow](https://github.com/MatchCake/MatchCake/actions/workflows/build_dist.yml/badge.svg)\n![Doc Workflow](https://github.com/MatchCake/MatchCake/actions/workflows/docs.yml/badge.svg)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![codecov](https://codecov.io/github/MatchCake/MatchCake/branch/main/graph/badge.svg?token=Yz44IcMdVx)](https://codecov.io/github/MatchCake/MatchCake)\n\n\n# Description\n\nMatchCake is a Python package that provides a new PennyLane device for simulating a specific class of quantum \ncircuits called Matchgate circuits or matchcircuits. These circuits are made with matchgates, a class of restricted \nquantum unitaries that are parity-preserving and operate on nearest-neighbor qubits. These constraints lead to \nmatchgates being classically simulable in polynomial time.\n\nAdditionally, this package provides quantum kernels made with [scikit-learn](https://scikit-learn.org/stable/) API allowing the \nuse matchcircuits as kernels in quantum machine learning algorithms. One way to use these kernels could be in a Support Vector \nMachine (SVM).\n\nNote that this package is built on PennyLane and PyTorch. This means that only the NumPy and PyTorch backends are compatible.\nOther backends provided by Autoray, such as JAX and TensorFlow, are not supported.\nWe highly recommend using PyTorch as the backend when working with MatchCake.\n\n\n# Installation\n\n| Method     | Commands                                                 |\n|------------|----------------------------------------------------------|\n| **poetry** | `poetry add matchcake`                                   |\n| **uv**     | `uv add matchcake`                                       |\n| **PyPi**   | `pip install MatchCake`                                  |\n| **source** | `pip install git+https://github.com/MatchCake/MatchCake` |\n\n\n### Last unstable version\nTo install the latest unstable version, download the latest version from `https://github.com/MatchCake/MatchCake@dev`.\n\n\n### CUDA installation\nTo use MatchCake with cuda, you can add `--extra cu128` to the installation commands above.\nThis will install pytorch with CUDA 12.8.\n\nExtra options:\n- `--extra cpu`: Install MatchCake with PyTorch CPU only.\n- `--extra cu128`: Install MatchCake with PyTorch CUDA 12.8.\n- `--extra cu130`: Install MatchCake with PyTorch CUDA 13.0.\n\n\n# Quick Usage Preview\n\n## Quantum Circuit Simulation with MatchCake\n```python\nimport matchcake as mc\nimport pennylane as qml\nimport numpy as np\nfrom pennylane.ops.qubit.observables import BasisStateProjector\n\n# Create a Non-Interacting Fermionic Device\nnif_device = mc.NonInteractingFermionicDevice(wires=4)\ninitial_state = np.zeros(len(nif_device.wires), dtype=int)\n\n# Define a quantum circuit\ndef circuit(params, wires, initial_state=None):\n    qml.BasisState(initial_state, wires=wires)\n    for i, even_wire in enumerate(wires[:-1:2]):\n        idx = list(wires).index(even_wire)\n        curr_wires = [wires[idx], wires[idx + 1]]\n        mc.operations.CompRxRx(params, wires=curr_wires)\n        mc.operations.CompRyRy(params, wires=curr_wires)\n        mc.operations.CompRzRz(params, wires=curr_wires)\n    for i, odd_wire in enumerate(wires[1:-1:2]):\n        idx = list(wires).index(odd_wire)\n        mc.operations.fSWAP(wires=[wires[idx], wires[idx + 1]])\n    projector: BasisStateProjector = qml.Projector(initial_state, wires=wires)\n    return qml.expval(projector)\n\n# Create a QNode\nnif_qnode = qml.QNode(circuit, nif_device)\nqml.draw_mpl(nif_qnode)(np.array([0.1, 0.2]), wires=nif_device.wires, initial_state=initial_state)\n\n# Evaluate the QNode\nexpval = nif_qnode(np.random.random(2), wires=nif_device.wires, initial_state=initial_state)\nprint(f\"Expectation value: {expval}\")\n```\n\n## Data Classification with MatchCake\n\n```python\nfrom matchcake.ml.kernels import FermionicPQCKernel\nfrom matchcake.ml.visualisation import ClassificationVisualizer\nfrom sklearn import datasets\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.preprocessing import MinMaxScaler\nfrom sklearn.pipeline import Pipeline\nfrom sklearn.svm import SVC\n\n# Load the iris dataset\nX, y = datasets.load_iris(return_X_y=True)\nx_train, x_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)\n\n# Create and fit the model\npipeline = Pipeline([\n    ('scaler', MinMaxScaler(feature_range=(0, 1))),\n    ('kernel', FermionicPQCKernel(n_qubits=4, rotations=\"X,Z\").freeze()),\n    ('classifier', SVC(kernel='precomputed')),\n])\npipeline.fit(x_train, y_train)\n\n# Evaluate the model\ntest_accuracy = pipeline.score(x_test, y_test)\nprint(f\"Test accuracy: {test_accuracy * 100:.2f}%\")\n\n# Visualize the classification\nviz = ClassificationVisualizer(x=X, n_pts=1_000)\nviz.plot_2d_decision_boundaries(model=pipeline, y=y, show=True)\n\n```\n\n\n# Tutorials\n- [MatchCake Basics](https://github.com/MatchCake/MatchCake/blob/main/tutorials/matchcake_basics.ipynb)\n- [Compute Expectation Values with MatchCake](https://github.com/MatchCake/MatchCake/blob/main/tutorials/expectation_values.ipynb)\n- [Iris Classification with MatchCake](https://github.com/MatchCake/MatchCake/blob/main/tutorials/iris_classification.ipynb)\n- [Nystroem Kernel Approximation](https://github.com/MatchCake/MatchCake/blob/main/tutorials/nystroem_kernel_approximation.ipynb)\n\n\n\n# Notes\n- This package is still in development and some features may not be available yet.\n- The documentation is still in development and may not be complete yet.\n\n\n\n# About\nThis work was supported by the Ministère de l'Économie, de l'Innovation et de l'Énergie du Québec\nthrough its Research Chair in Quantum Computing, an NSERC Discovery grant, and the Canada First Research Excellence \nFund.\n\n\n# Important Links\n- Documentation at [https://MatchCake.github.io/MatchCake/](https://MatchCake.github.io/MatchCake/).\n- Github at [https://github.com/MatchCake/MatchCake/](https://github.com/MatchCake/MatchCake/).\n\n\n\n\n# Found a bug or have a feature request?\n- [Click here to create a new issue.](https://github.com/MatchCake/MatchCake/issues/new/choose)\n\n\n\n# License\n[Apache License 2.0](LICENSE)\n\n\n\n# Citation\n\nRepository:\n```\n@misc{matchcake_Gince2023,\n  title={MatchCake},\n  author={Jérémie Gince},\n  year={2023},\n  publisher={Université de Sherbrooke},\n  url={https://github.com/MatchCake/MatchCake},\n}\n```\n\n## Fermionic Machine Learning Paper\n\n[Fermionic Machine Learning](https://ieeexplore.ieee.org/document/10821385) is a work presented at the 2024 IEEE \nInternational Conference on Quantum Computing and Engineering (QCE). The paper compares unconstrained quantum kernel \nmethods with constraint-based kernels derived from matchgate (free-fermionic) circuits, and benchmarks their \nperformance on supervised classification tasks. All free-fermionic kernels considered in this work were simulated \nusing MatchCake.\n\n[IEEE Xplore paper](https://ieeexplore.ieee.org/document/10821385):\n```\n@INPROCEEDINGS{10821385,\n  author={Gince, Jérémie and Pagé, Jean-Michel and Armenta, Marco and Sarkar, Ayana and Kourtis, Stefanos},\n  booktitle={2024 IEEE International Conference on Quantum Computing and Engineering (QCE)}, \n  title={Fermionic Machine Learning}, \n  year={2024},\n  volume={01},\n  number={},\n  pages={1672-1678},\n  keywords={Runtime;Quantum entanglement;Computational modeling;Benchmark testing;Rendering (computer graphics);Hardware;Kernel;Integrated circuit modeling;Quantum circuit;Standards;Quantum machine learning;quantum kernel methods;matchgate circuits;fermionic quantum computation;data classification},\n  doi={10.1109/QCE60285.2024.00195}\n}\n```\n\n\n[ArXiv paper](https://arxiv.org/abs/2404.19032):\n```\n@misc{gince2024fermionic,\n      title={Fermionic Machine Learning}, \n      author={Jérémie Gince and Jean-Michel Pagé and Marco Armenta and Ayana Sarkar and Stefanos Kourtis},\n      year={2024},\n      eprint={2404.19032},\n      archivePrefix={arXiv},\n      primaryClass={quant-ph}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatchcake%2Fmatchcake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatchcake%2Fmatchcake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatchcake%2Fmatchcake/lists"}