Metadata-Version: 2.4
Name: rqm-core
Version: 0.2.1
Summary: Core quaternion, spinor, SU(2), and Bloch mathematics for the RQM Python ecosystem
Author: RQM Technologies
License:                                  Apache License
                                   Version 2.0, January 2004
                                http://www.apache.org/licenses/
        
           TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
        
           1. Definitions.
        
              "License" shall mean the terms and conditions for use, reproduction,
              and distribution as defined by Sections 1 through 9 of this document.
        
              "Licensor" shall mean the copyright owner or entity authorized by
              the copyright owner that is granting the License.
        
              "Legal Entity" shall mean the union of the acting entity and all
              other entities that control, are controlled by, or are under common
              control with that entity. For the purposes of this definition,
              "control" means (i) the power, direct or indirect, to cause the
              direction or management of such entity, whether by contract or
              otherwise, or (ii) ownership of fifty percent (50%) or more of the
              outstanding shares, or (iii) beneficial ownership of such entity.
        
              "You" (or "Your") shall mean an individual or Legal Entity
              exercising permissions granted by this License.
        
              "Source" form shall mean the preferred form for making modifications,
              including but not limited to software source code, documentation
              source, and configuration files.
        
              "Object" form shall mean any form resulting from mechanical
              transformation or translation of a Source form, including but
              not limited to compiled object code, generated documentation,
              and conversions to other media types.
        
              "Work" shall mean the work of authorship, whether in Source or
              Object form, made available under the License, as indicated by a
              copyright notice that is included in or attached to the work
              (an example is provided in the Appendix below).
        
              "Derivative Works" shall mean any work, whether in Source or Object
              form, that is based on (or derived from) the Work and for which the
              editorial revisions, annotations, elaborations, or other modifications
              represent, as a whole, an original work of authorship. For the purposes
              of this License, Derivative Works shall not include works that remain
              separable from, or merely link (or bind by name) to the interfaces of,
              the Work and Derivative Works thereof.
        
              "Contribution" shall mean any work of authorship, including
              the original version of the Work and any modifications or additions
              to that Work or Derivative Works thereof, that is intentionally
              submitted to Licensor for inclusion in the Work by the copyright owner
              or by an individual or Legal Entity authorized to submit on behalf of
              the copyright owner. For the purposes of this definition, "submitted"
              means any form of electronic, verbal, or written communication sent
              to the Licensor or its representatives, including but not limited to
              communication on electronic mailing lists, source code control systems,
              and issue tracking systems that are managed by, or on behalf of, the
              Licensor for the purpose of discussing and improving the Work, but
              excluding communication that is conspicuously marked or otherwise
              designated in writing by the copyright owner as "Not a Contribution."
        
              "Contributor" shall mean Licensor and any individual or Legal Entity
              on behalf of whom a Contribution has been received by Licensor and
              subsequently incorporated within the Work.
        
           2. Grant of Copyright License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              copyright license to reproduce, prepare Derivative Works of,
              publicly display, publicly perform, sublicense, and distribute the
              Work and such Derivative Works in Source or Object form.
        
           3. Grant of Patent License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              (except as stated in this section) patent license to make, have made,
              use, offer to sell, sell, import, and otherwise transfer the Work,
              where such license applies only to those patent claims licensable
              by such Contributor that are necessarily infringed by their
              Contribution(s) alone or by combination of their Contribution(s)
              with the Work to which such Contribution(s) was submitted. If You
              institute patent litigation against any entity (including a
              cross-claim or counterclaim in a lawsuit) alleging that the Work
              or a Contribution incorporated within the Work constitutes direct
              or contributory patent infringement, then any patent licenses
              granted to You under this License for that Work shall terminate
              as of the date such litigation is filed.
        
           4. Redistribution. You may reproduce and distribute copies of the
              Work or Derivative Works thereof in any medium, with or without
              modifications, and in Source or Object form, provided that You
              meet the following conditions:
        
              (a) You must give any other recipients of the Work or
                  Derivative Works a copy of this License; and
        
              (b) You must cause any modified files to carry prominent notices
                  stating that You changed the files; and
        
              (c) You must retain, in the Source form of any Derivative Works
                  that You distribute, all copyright, patent, trademark, and
                  attribution notices from the Source form of the Work,
                  excluding those notices that do not pertain to any part of
                  the Derivative Works; and
        
              (d) If the Work includes a "NOTICE" text file as part of its
                  distribution, then any Derivative Works that You distribute must
                  include a readable copy of the attribution notices contained
                  within such NOTICE file, excluding those notices that do not
                  pertain to any part of the Derivative Works, in at least one
                  of the following places: within a NOTICE text file distributed
                  as part of the Derivative Works; within the Source form or
                  documentation, if provided along with the Derivative Works; or,
                  within a display generated by the Derivative Works, if and
                  wherever such third-party notices normally appear. The contents
                  of the NOTICE file are for informational purposes only and
                  do not modify the License. You may add Your own attribution
                  notices within Derivative Works that You distribute, alongside
                  or as an addendum to the NOTICE text from the Work, provided
                  that such additional attribution notices cannot be construed
                  as modifying the License.
        
              You may add Your own copyright statement to Your modifications and
              may provide additional or different license terms and conditions
              for use, reproduction, or distribution of Your modifications, or
              for any such Derivative Works as a whole, provided Your use,
              reproduction, and distribution of the Work otherwise complies with
              the conditions stated in this License.
        
           5. Submission of Contributions. Unless You explicitly state otherwise,
              any Contribution intentionally submitted for inclusion in the Work
              by You to the Licensor shall be under the terms and conditions of
              this License, without any additional terms or conditions.
              Notwithstanding the above, nothing herein shall supersede or modify
              the terms of any separate license agreement you may have executed
              with Licensor regarding such Contributions.
        
           6. Trademarks. This License does not grant permission to use the trade
              names, trademarks, service marks, or product names of the Licensor,
              except as required for reasonable and customary use in describing the
              origin of the Work and reproducing the content of the NOTICE file.
        
           7. Disclaimer of Warranty. Unless required by applicable law or
              agreed to in writing, Licensor provides the Work (and each
              Contributor provides its Contributions) on an "AS IS" BASIS,
              WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
              implied, including, without limitation, any warranties or conditions
              of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
              PARTICULAR PURPOSE. You are solely responsible for determining the
              appropriateness of using or redistributing the Work and assume any
              risks associated with Your exercise of permissions under this License.
        
           8. Limitation of Liability. In no event and under no legal theory,
              whether in tort (including negligence), contract, or otherwise,
              unless required by applicable law (such as deliberate and grossly
              negligent acts) or agreed to in writing, shall any Contributor be
              liable to You for damages, including any direct, indirect, special,
              incidental, or consequential damages of any character arising as a
              result of this License or out of the use or inability to use the
              Work (including but not limited to damages for loss of goodwill,
              work stoppage, computer failure or malfunction, or any and all
              other commercial damages or losses), even if such Contributor
              has been advised of the possibility of such damages.
        
           9. Accepting Warranty or Additional Liability. While redistributing
              the Work or Derivative Works thereof, You may choose to offer,
              and charge a fee for, acceptance of support, warranty, indemnity,
              or other liability obligations and/or rights consistent with this
              License. However, in accepting such obligations, You may act only
              on Your own behalf and on Your sole responsibility, not on behalf
              of any other Contributor, and only if You agree to indemnify,
              defend, and hold each Contributor harmless for any liability
              incurred by, or claims asserted against, such Contributor by reason
              of your accepting any such warranty or additional liability.
        
           END OF TERMS AND CONDITIONS
        
           APPENDIX: How to apply the Apache License to your work.
        
              To apply the Apache License to your work, attach the following
              boilerplate notice, with the fields enclosed by brackets "[]"
              replaced with your own identifying information. (Don't include
              the brackets!)  The text should be enclosed in the appropriate
              comment syntax for the file format. We also recommend that a
              file or class name and description of purpose be included on the
              same "printed page" as the copyright notice for easier
              identification within third-party archives.
        
           Copyright [yyyy] [name of copyright owner]
        
           Licensed under the Apache License, Version 2.0 (the "License");
           you may not use this file except in compliance with the License.
           You may obtain a copy of the License at
        
               http://www.apache.org/licenses/LICENSE-2.0
        
           Unless required by applicable law or agreed to in writing, software
           distributed under the License is distributed on an "AS IS" BASIS,
           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
           See the License for the specific language governing permissions and
           limitations under the License.
        
Project-URL: Homepage, https://rqmtechnologies.com
Project-URL: Documentation, https://www.rqmtechnologies.com/docs/getting-started
Project-URL: Source, https://github.com/RQM-Technologies-dev/rqm-core
Project-URL: Issues, https://github.com/RQM-Technologies-dev/rqm-core/issues
Keywords: quaternion,su2,bloch sphere,spinor,quantum,linear algebra,rotation,mathematics
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Dynamic: license-file

# RQM Core

> Core quaternion, spinor, SU(2), and Bloch mathematics for the RQM Python ecosystem.

[![PyPI version](https://img.shields.io/pypi/v/rqm-core.svg)](https://pypi.org/project/rqm-core/)
[![Python versions](https://img.shields.io/pypi/pyversions/rqm-core.svg)](https://pypi.org/project/rqm-core/)
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
[![Documentation](https://img.shields.io/badge/docs-rqmtechnologies.com-blue.svg)](https://www.rqmtechnologies.com/docs)
[![Website](https://img.shields.io/badge/website-rqmtechnologies.com-blue.svg)](https://rqmtechnologies.com)

---

## 🌐 RQM Platform

This repository is part of the RQM Technologies ecosystem.

→ Website: https://rqmtechnologies.com  
→ Documentation: https://www.rqmtechnologies.com/docs

---

## RQM Technical Canon v2

`rqm-core` is the standard-compatible quaternion algebra and `SU(2)` geometry
authority for the RQM software stack. Unit quaternions and complete `SU(2)`
matrices encode the same single-rotation information. This package does not
claim additional quantum information or alternative mechanics.

RQM uses quaternion-native coordinates when their structured representation can
improve software, diagnostics, integration, or measured execution. Those
advantages must be established against strong equivalent baselines. See
[RQM_TECHNICAL_CANON_V2.md](RQM_TECHNICAL_CANON_V2.md).

---

## Install

```bash
pip install rqm-core
```

`rqm-core` is the mathematical foundation layer. It has no RQM-level dependencies — only `numpy` at runtime.

---

## Where This Fits

```
rqm-core  →  rqm-circuits  →  rqm-compiler  →  rqm-qiskit / rqm-braket
                                                        ↓ (optional)
                                                   rqm-optimize
```

`rqm-core` provides the canonical mathematical layer of the RQM ecosystem —
quaternion, spinor, Bloch, and SU(2) foundations.  It owns no circuit schema,
no compiler passes, and no backend execution logic.

**Layer responsibilities:**

| Package | Role |
|---|---|
| **rqm-core** | Mathematical spine — quaternion, spinor, SU(2), Bloch |
| **rqm-circuits** | Canonical external circuit IR / wire format (API, Studio, interchange) |
| **rqm-compiler** | Optimization and rewriting engine — consumes rqm-circuits programs |
| **rqm-entanglement** | Canonical nonlocal layer — two-qubit tensor structure, coupling analysis, entanglement metrics |
| **rqm-qiskit** | IBM / Qiskit lowering and execution bridge |
| **rqm-braket** | AWS / Braket lowering and execution bridge |
| **rqm-optimize** | Optional backend-adjacent optimization / compression layer |

`rqm-circuits 0.2` is the canonical external circuit format for all API and Studio workflows.
`rqm-compiler` consumes and optimizes circuit programs but is not the primary public wire format.
Backend packages (`rqm-qiskit`, `rqm-braket`) translate optimized circuits into vendor-native objects.
`rqm-optimize` is optional and sits later in the execution flow, above the backend bridges.

---

## Next Steps

- Documentation: https://www.rqmtechnologies.com/docs
- Website: https://rqmtechnologies.com
- Next package in the stack: [`rqm-circuits`](https://github.com/RQM-Technologies-dev/rqm-circuits) — the canonical external circuit IR for API and Studio workflows (rqm-circuits 0.2+)
- After circuits: [`rqm-compiler`](https://github.com/RQM-Technologies-dev/rqm-compiler) — optimization and rewriting engine

---

## Why This Package Exists

Higher-level RQM libraries (simulators, compilers, hardware adapters) all require a
common, reliable layer of linear algebra and quantum geometry.  `rqm-core` is that layer.

It provides a single, versioned source of truth for the mathematical primitives shared
across the whole ecosystem: no duplication, no conflicting conventions, and no framework lock-in.

---

## Design Principles

| Principle | What it means in practice |
|---|---|
| **Tiny** | Only implement primitives that are needed by ≥2 packages |
| **Stable** | Slow to change; breaking changes require a major version bump |
| **Dependency-light** | Only `numpy` at runtime |
| **Canonical** | One correct convention, clearly documented, used everywhere |
| **Well-tested** | Strong test coverage from the first commit |

---

## What Is Included

- **Quaternion primitives** – Hamilton product, conjugate, inverse, axis-angle construction, SO(3) and SU(2) conversions
- **Spinor helpers** – normalization, norm, fidelity, spinor↔quaternion/SU(2) mappings
- **SU(2) conversions** – construction from quaternions and axis-angle, validation, round-trips
- **Bloch sphere mappings** – state↔Bloch, Bloch↔state, quaternion rotation to Bloch vector
- **Matrix helpers** – trace, determinant, conjugate transpose (dagger), norm, closeness checks
- **Validation utilities** – axis, complex pair, matrix shape, real number, tolerance checks
- **Compatibility coupling analysis** – legacy qualitative/measured helpers retained for existing imports; canonical nonlocal analysis now lives in `rqm-entanglement`

---

## Mathematical Conventions

The full reference lives in [`CONVENTIONS.md`](CONVENTIONS.md).
The five items every downstream package needs to know:

### 1 · SU(2) Convention

A unit quaternion `q = w + xi + yj + zk` maps to SU(2) as:

```
U(q) = [[ w − iz ,  −y − ix ],
         [ y − ix ,   w + iz ]]
```

Implemented in `Quaternion.to_su2_matrix()`; inverted by `su2_to_quaternion()`.

### 2 · Spinor Convention

States are written `|ψ⟩ = α|0⟩ + β|1⟩` with `|0⟩` as the north-pole
computational-basis ground state.  Amplitudes are always passed as the ordered
pair `(alpha, beta)`.  Functions that require unit norm normalize internally.

### 3 · Bloch Sphere Parameterization

```
|ψ⟩ = cos(θ/2)|0⟩ + e^{iφ} sin(θ/2)|1⟩
```

`theta` ∈ `[0, π]` (polar/colatitude), `phi` ∈ `[0, 2π)` (azimuthal).
`|0⟩` → north pole `(0, 0, +1)`;  `|1⟩` → south pole `(0, 0, −1)`.

### 4 · Global Phase

`q` and `−q` represent the same SO(3)/Bloch rotation, while their SU(2)
matrices differ by a global phase of `−1`.  `spinor_to_quaternion` encodes the
rotation up to global phase — never rely on the sign of the scalar part.

### 5 · Default Tolerance and Axis Labels

All closeness checks default to `atol = 1e-9` (absolute, no relative
component).  Axis labels are `"x"`, `"y"`, `"z"` (case-insensitive);
all angles are in **radians**.

---

## Coupling / Entanglement Analysis

`rqm_core` retains a compatibility analysis layer for existing imports, but it is no longer the canonical owner of coupling and entanglement analysis.  New API and Studio integrations should call `rqm-entanglement`.

### Architecture

The two layers are mathematically complementary and do not compete:

| Layer | Scope | Technology |
|---|---|---|
| **Single-qubit local structure** | Individual qubit rotations | Quaternionic / SU(2) (quaternion optimizer) |
| **Multi-qubit entanglement** | Cross-qubit coupling / correlation | `rqm-entanglement` state analysis, concurrence, entropy |

The quaternionic single-qubit optimizer is the correct route for local SU(2) operations.  The coupling analysis layer adds truthful multi-qubit analysis *beside* it.

### Quickstart

```python
from rqm_core import Circuit, GateOp, analyze_circuit_coupling

# Bell state: H q0, CNOT q0→q1
circuit = Circuit(
    num_qubits=2,
    operations=[
        GateOp(name="H",    qubits=[0]),
        GateOp(name="CNOT", qubits=[0, 1]),
    ],
)

result = analyze_circuit_coupling(circuit)
print(result.mode)          # "measured"
print(result.is_entangled)  # True
print(result.pair_metrics[0].value)  # 1.0  (concurrence)
```

### Measured Analysis Scope (first implementation)

| Criterion | Scope |
|---|---|
| Qubits | Exactly 2 |
| Initial state | \|00⟩ |
| Single-qubit gates | I, X, Y, Z, H, S, T, Rx(θ), Ry(θ), Rz(θ), U(θ,φ,λ) / U3 |
| Two-qubit gates | CNOT / CX, CZ, SWAP |
| Metrics | Concurrence, von Neumann entropy |

Circuits outside this scope receive an honest **qualitative fallback** (gate detection only) with explicit `limitations` in the result — no fabricated measured values.

### Result Contract

```python
@dataclass
class CouplingAnalysisResult:
    mode: str                          # "measured" | "qualitative"
    provenance: str                    # "rqm-core" | "parser"
    qubit_count: int
    analyzed_pairs: list[tuple[int, int]]
    has_entangling_gates: bool
    entangling_gate_count: int
    entangling_gates_seen: list[str]
    last_entangling_gate: str | None
    is_entangled: bool | None          # None in qualitative mode
    pair_metrics: list[PairMetric]     # empty in qualitative mode
    fidelity_preserved: float | None
    notes: list[str]
    limitations: list[str]
```

### Compiler Verification

```python
from rqm_core import analyze_optimization_preservation

result = analyze_optimization_preservation(original_circuit, optimized_circuit)
print(result.fidelity_preserved)              # e.g. 1.0
print(result.preserved_entanglement_structure) # True / False / None
```

---

## What Is Not Included

`rqm-core` intentionally does **not** own:

- Qiskit / PennyLane / Cirq adapters
- Backend execution or hardware drivers
- Circuit transpilation or compilation
- Plotting or visualisation
- Cloud workflow integration
- Notebook tooling
- Algorithm frameworks or optimisation workflows

Those belong in higher-level packages.

---

## Installation

```bash
pip install rqm-core
```

Development install (includes `pytest` and `pytest-cov`):

```bash
pip install "rqm-core[dev]"
```

---

## Ecosystem Role

`rqm-core` is the **mathematical spine** of the RQM Python ecosystem.  It provides the
single canonical implementation of all shared mathematical primitives so that
downstream packages never need to re-implement or copy them.

**What rqm-core owns:**
- Quaternion primitives (Hamilton product, conjugate, inverse, axis-angle, SO(3)/SU(2) conversions)
- SU(2) / Bloch / spinor mathematics
- Shared linear algebra helpers
- Coupling / entanglement analysis primitives

**What rqm-core does NOT own:**
- Circuit IR or schema — that is `rqm-circuits`
- Compiler rewrites or optimization passes — that is `rqm-compiler`
- Backend execution or vendor-native objects — that is `rqm-qiskit` / `rqm-braket`
- API service boundaries or Studio wire formats — those live above `rqm-circuits`

**How downstream packages declare the dependency** (example `pyproject.toml` excerpt):

```toml
[project]
dependencies = [
    "rqm-core>=0.1.0",
]
```

**How downstream packages import:**

```python
# rqm-qiskit, rqm-circuits, rqm-compiler, etc.
from rqm_core import Quaternion, axis_angle_to_su2, state_to_bloch
```

**Contract for downstream maintainers:**

- All conventions are defined in [`CONVENTIONS.md`](CONVENTIONS.md) and must
  not be re-defined or overridden locally.
- Breaking changes to `rqm-core` require a **major version bump** (`1.0.0`, …).
- Any primitive needed by two or more packages belongs here, not in the
  individual packages.

---

## Quickstart

```python
from rqm_core import Quaternion, state_to_bloch, axis_angle_to_su2
import math

# 90° rotation around Y
q = Quaternion.from_axis_angle("y", math.pi / 2)
print(q)
# Quaternion(0.7071..., 0.0, 0.7071..., 0.0)

# SU(2) matrix directly from axis-angle
print(axis_angle_to_su2("y", math.pi / 2))

# |+⟩ state on the Bloch sphere → equator at (1, 0, 0)
c = 1 / math.sqrt(2)
x, y, z = state_to_bloch(c, c)
print(x, y, z)  # 1.0  0.0  0.0
```

---

## Package Structure

```
rqm-core/
  CONVENTIONS.md            – canonical mathematical conventions reference
  pyproject.toml            – package metadata and build config
  src/rqm_core/
    __init__.py      – canonical public API (import everything from here)
    py.typed         – PEP 561 marker (enables type checking in downstream packages)
    quaternion.py    – Quaternion class (Hamilton algebra, SO(3)/SU(2) conversions)
    spinor.py        – spinor normalization, fidelity, spinor↔quaternion/SU(2)
    su2.py           – SU(2) construction, validation, quaternion round-trips
    bloch.py         – Bloch sphere mappings and validation
    linalg.py        – matrix helpers (dagger, trace, determinant, closeness)
    validation.py    – shared validation helpers (axis, matrix shape, tolerances)
    types.py         – shared type aliases (ComplexVector2, BlochVector, SU2Matrix, …)
    utils.py         – small math utilities (angle_wrap, safe_norm, is_finite_*)
    analysis/
      coupling/
        types.py                          – Circuit IR + result contract dataclasses
        detect_entangling_structure.py    – qualitative gate-based detection
        simulate_two_qubit_state.py       – ideal 2-qubit pure-state simulator
        metrics.py                        – concurrence, entropy, fidelity helpers
        analyze_circuit_coupling.py       – main public entry point
        analyze_optimization_preservation.py – before/after compiler verification

  tests/
    test_quaternion.py
    test_spinor.py
    test_su2.py
    test_bloch.py
    test_linalg.py
    test_utils.py
    test_validation.py
    test_public_api.py
    analysis/
      coupling/
        test_detect_entangling_structure.py
        test_simulate_two_qubit_state.py
        test_metrics.py
        test_analyze_circuit_coupling.py
        test_analyze_optimization_preservation.py

  examples/
    quaternion_basics.py    – quaternion construction, composition, conversion
    spinor_basics.py        – spinor normalization, Bloch mapping, fidelity
    su2_bloch_demo.py       – axis-angle → SU(2) → Bloch pipeline
    bloch_mapping_demo.py   – canonical Bloch vectors and round-trip checks
    su2_rotation_demo.py    – SU(2) construction and quaternion round-trip
```

---

## Testing

```bash
# Install the package in editable mode with test dependencies
pip install -e ".[dev]"

# Run the full test suite
pytest

# Run with coverage report
pytest --cov=rqm_core --cov-report=term-missing

# Run a single test file
pytest tests/test_quaternion.py -v

# Run only the public-API contract tests
pytest tests/test_public_api.py -v
```

---

## Architectural Notes

- **`su2.is_unitary` is a thin domain-scoped shim** over `linalg.is_unitary`.
  Both exist intentionally: `linalg.is_unitary` is the general-purpose helper;
  `su2.is_unitary` is the public entry point for SU(2)-context callers and is
  what `rqm_core.is_unitary` resolves to in the top-level API.

- **`q` and `−q` represent the same SO(3)/Bloch rotation, not the same SU(2)
  matrix.**  Round-trip conversions `q → SU(2) → q` are tested against both
  `q` and `−q` because the sign is a global phase.  Downstream code must never
  compare quaternion scalar parts for sign equality.

- **The `src/` layout** means `rqm_core` is only importable after installation
  (`pip install -e .`).  Running tests directly without installing first will
  produce `ModuleNotFoundError`.

- **`py.typed`** is included in the installed wheel (via `[tool.setuptools.package-data]`),
  enabling `mypy` and `pyright` in any package that depends on `rqm-core`.

---

## Roadmap

`rqm-core` is intended to remain **small and stable** while higher-level packages evolve around it.

Planned additions for future minor versions:

- [ ] Quaternion SLERP (spherical linear interpolation)
- [ ] SO(3) rotation-matrix ↔ quaternion round-trip helpers
- [ ] Mixed-state density matrix utilities
- [ ] SU(2) Lie-algebra generators and exponential map
- [ ] Type stub files (`.pyi`) for IDE completions
- [ ] Coupling analysis for >2 qubits (partial trace for n-qubit systems, mutual information)
- [ ] Support for additional gate sets in the 2-qubit simulator

No Qiskit or framework dependencies will ever be added to this package.
