Metadata-Version: 2.4
Name: bilinear-quantum
Version: 2.0.0rc1
Summary: TensorFlow and Cirq toolkit for exact and deep Bilinear Quantum Learning
Author-email: Nguyen Minh Tuan <minhtuan@ptit.edu.vn>, Bui Phi Hung <n23dcat028@student.ptithcm.edu.vn>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/Thien-y1502/bilinear-quantum
Project-URL: Documentation, https://github.com/Thien-y1502/bilinear-quantum/tree/main/docs
Project-URL: Repository, https://github.com/Thien-y1502/bilinear-quantum
Project-URL: Issues, https://github.com/Thien-y1502/bilinear-quantum/issues
Project-URL: Changelog, https://github.com/Thien-y1502/bilinear-quantum/blob/main/CHANGELOG.md
Project-URL: PyPI, https://pypi.org/project/bilinear-quantum/
Keywords: bilinear learning,Hirota bilinear operator,quantum machine learning,TensorFlow Quantum
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: <3.14,>=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy<2.6,>=2
Requires-Dist: scipy<1.19,>=1.15
Requires-Dist: sympy<2,>=1.14
Requires-Dist: pandas<3.1,>=2.3
Requires-Dist: scikit-learn<2,>=1.8
Requires-Dist: packaging<27,>=25
Requires-Dist: PyYAML<7,>=6
Requires-Dist: psutil<8,>=7
Provides-Extra: tensorflow
Requires-Dist: tensorflow==2.21.0; extra == "tensorflow"
Requires-Dist: keras==3.15.1; extra == "tensorflow"
Provides-Extra: cirq
Requires-Dist: cirq-core==1.7.0; extra == "cirq"
Requires-Dist: cirq-google==1.7.0; extra == "cirq"
Provides-Extra: experiments
Requires-Dist: matplotlib<4,>=3.11; extra == "experiments"
Requires-Dist: seaborn<1,>=0.13; extra == "experiments"
Requires-Dist: statsmodels<1,>=0.15; extra == "experiments"
Provides-Extra: full
Requires-Dist: tensorflow==2.21.0; extra == "full"
Requires-Dist: keras==3.15.1; extra == "full"
Requires-Dist: cirq-core==1.7.0; extra == "full"
Requires-Dist: cirq-google==1.7.0; extra == "full"
Requires-Dist: matplotlib<4,>=3.11; extra == "full"
Requires-Dist: seaborn<1,>=0.13; extra == "full"
Requires-Dist: statsmodels<1,>=0.15; extra == "full"
Provides-Extra: tfq-legacy
Requires-Dist: numpy==2.0.2; python_version < "3.13" and extra == "tfq-legacy"
Requires-Dist: scipy==1.15.3; python_version < "3.13" and extra == "tfq-legacy"
Requires-Dist: sympy==1.14.0; python_version < "3.13" and extra == "tfq-legacy"
Requires-Dist: tensorflow==2.18.1; python_version < "3.13" and extra == "tfq-legacy"
Requires-Dist: tf-keras==2.18.0; python_version < "3.13" and extra == "tfq-legacy"
Requires-Dist: tensorflow-quantum==0.7.6; python_version < "3.13" and extra == "tfq-legacy"
Requires-Dist: cirq-core==1.5.0; python_version < "3.13" and extra == "tfq-legacy"
Requires-Dist: cirq-google==1.5.0; python_version < "3.13" and extra == "tfq-legacy"
Requires-Dist: jax==0.5.3; python_version < "3.13" and extra == "tfq-legacy"
Requires-Dist: contourpy==1.3.2; python_version < "3.13" and extra == "tfq-legacy"
Provides-Extra: dev
Requires-Dist: build<2,>=1.2; extra == "dev"
Requires-Dist: pytest<9,>=8.4; extra == "dev"
Requires-Dist: pytest-cov<7,>=6; extra == "dev"
Requires-Dist: ruff<1,>=0.12; extra == "dev"
Requires-Dist: twine<7,>=6; extra == "dev"
Dynamic: license-file

# Bilinear Quantum Learning

[![PyPI](https://img.shields.io/pypi/v/bilinear-quantum.svg)](https://pypi.org/project/bilinear-quantum/)
[![Python 3.12–3.13](https://img.shields.io/badge/python-3.12%E2%80%933.13-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/license-Apache--2.0-green.svg)](LICENSE)
[![CI](https://github.com/Thien-y1502/bilinear-quantum/actions/workflows/ci.yml/badge.svg)](https://github.com/Thien-y1502/bilinear-quantum/actions/workflows/ci.yml)
[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Thien-y1502/bilinear-quantum/blob/main/notebooks/Bilinear_Quantum_Colab_Quickstart.ipynb)

`bilinear-quantum` is a TensorFlow/Keras and Cirq research toolkit for exact
Bilinear Quantum Learning (BQL), Hirota Quantum Bilinear Learning (HQBL), and
the experimental Deep-BQL circuit residual. It separates exact identities,
trainable layers, optional circuit backends, statistical comparisons, and
reproducible experiment runners.

The project follows a falsification-first policy: exact backend checks must
pass before learning experiments run; classical and quantum comparators use
matched data splits; and negative results remain part of the evidence. The
package does **not** assume or claim generic computational quantum advantage.

## Start in Google Colab

Open the maintained notebook:

[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Thien-y1502/bilinear-quantum/blob/main/notebooks/Bilinear_Quantum_Colab_Quickstart.ipynb)

The notebook installs the public PyPI release, verifies the exact BQL identity,
runs a packaged benchmark, and demonstrates a quantum-circuit dataset against
classical baselines. It is an educational smoke test, not paper evidence.

## Install

The unreleased 2.0 release candidate has a lightweight mathematical core. From
a source checkout, install its modern Python 3.13 TensorFlow/Cirq lane with:

```bash
python -m pip install ".[full]"
```

```python
from bilinear_quantum.layers import (
    BilinearQuantumLayer,
    DeepBilinearQuantumLayer,
    HirotaBilinearLayer,
)
from bilinear_quantum.models import (
    BilinearRidge,
    DeepBQLModelConfig,
    LowRankBilinearRidge,
    build_deep_bql_model,
)
```

TensorFlow Quantum 0.7.6 has no Python 3.13 wheel. Its independent verification
lane remains Python 3.12 and uses `requirements-tfq-legacy.txt`; TFQ support is
never silently emulated.

## Minimal exact check

```python
import numpy as np
from bilinear_quantum import (
    Calibration,
    bql_exact_numpy,
    classical_bilinear,
    factorize_bilinear_matrix,
    projection_radii,
)

W = np.array([[1.0, -0.2], [0.3, 0.7]])
f_train = np.array([[0.2, 0.1], [-0.4, 0.3]])
g_train = np.array([[0.1, -0.2], [0.2, 0.4]])
factorization = factorize_bilinear_matrix(W)
r_f, r_g = projection_radii(factorization, f_train, g_train)

quantum = bql_exact_numpy(
    f_train[0],
    g_train[0],
    factorization,
    r_f,
    r_g,
    calibration=Calibration.READOUT,
)
classical = classical_bilinear(f_train[0], W, g_train[0])
np.testing.assert_allclose(quantum, classical, atol=1e-12)
```

## Packaged experiments

Run a quick public smoke benchmark without cloning the repository:

```bash
bq-run-experiment E1 --profile smoke --output-root reproduced/smoke
```

Registered experiments cover controlled bilinear rank, true Hirota Fourier
tasks, KdV operator residuals, subject-disjoint human activity recognition,
order/resource/shot/noise/trainability sweeps, and a dequantization challenge.
Experiments E4 and E4Q require the separately prepared UCI HAR dataset.

For a custom quantum dataset, first convert circuits, statevectors, density
matrices, or hardware measurements into two bounded numerical branches
`f` and `g`, then evaluate BQL/HQBL and every baseline on the same immutable
split. See [the Colab guide](docs/COLAB.md) for the data contract.

## Public project resources

- [PyPI package](https://pypi.org/project/bilinear-quantum/)
- [Source repository](https://github.com/Thien-y1502/bilinear-quantum)
- [Colab quickstart](https://colab.research.google.com/github/Thien-y1502/bilinear-quantum/blob/main/notebooks/Bilinear_Quantum_Colab_Quickstart.ipynb)
- [API guide](docs/API.md)
- [Deep-BQL mathematical contract](docs/DEEP_BQL_THEORY.md)
- [Reproducibility protocol](docs/REPRODUCIBILITY.md)
- [Dataset provenance](docs/DATASETS.md)
- [Release history](CHANGELOG.md)
- [Issue tracker](https://github.com/Thien-y1502/bilinear-quantum/issues)

## Scientific scope

The exact BQL/HQBL core is deliberately auditable and classically
dequantizable. Circuit, finite-shot, noise, trainability, and learned-feature
experiments are reported separately from exact algebraic identities. Simulator
accuracy, a quantum implementation, or fewer trainable parameters alone is not
evidence of computational quantum advantage.

Full-profile evidence is accepted only through machine-readable gate reports.
Each completed run records the source commit, registry checksum, dependency
versions, command, runtime, outputs, and SHA-256 manifest. See
[the master specification](docs/MASTER_SPECIFICATION.md) and
[traceability matrix](docs/TRACEABILITY.md).

## Citation

Citation metadata is provided in [`CITATION.cff`](CITATION.cff). Until an
archival DOI is assigned, cite the exact software version and both canonical
links:

```text
Nguyen Minh Tuan and Bui Phi Hung. Bilinear Quantum Learning and Hirota
Quantum Bilinear Learning, software version 1.0.1, 2026.
https://pypi.org/project/bilinear-quantum/
https://github.com/Thien-y1502/bilinear-quantum
```

The unreleased `2.0.0rc1` identifier is for compatibility testing and must not
be cited as a stable PyPI release until its release gates pass.

## License and third-party software

Original project code is released under the [Apache License 2.0](LICENSE).
Dependencies are installed separately and retain their own licenses. The public
repository and Python distributions do not contain the Elsevier template,
private reference packages, restricted datasets, or unpublished manuscript
files.

Security reports should follow [SECURITY.md](SECURITY.md). Contributions are
governed by [CONTRIBUTING.md](CONTRIBUTING.md) and
[CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
