Metadata-Version: 2.4
Name: mimiq-tensorweaver
Version: 0.20.1
Requires-Dist: mimiqcircuits>=0.30.0,<0.31
Requires-Dist: numpy>=1.26
Requires-Dist: qiskit>=2.0 ; extra == 'qiskit'
Requires-Dist: mimiq-qiskit>=0.3.2,<0.4.0 ; extra == 'qiskit'
Requires-Dist: mimiqcircuits[visualization]>=0.30.0,<0.31 ; extra == 'visualization'
Provides-Extra: qiskit
Provides-Extra: visualization
License-File: LICENSE.md
License-File: NOTICE.md
Summary: Unlicensed mock of the TensorWeaver MPS simulator: the MIMIQ data models with no simulation behind them
Author-email: Guido Masella <guido.masella@qperfect.io>
Requires-Python: >=3.11
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# MIMIQ TensorWeaver: unlicensed mock

This distribution on PyPI is **not the TensorWeaver simulator**. It is
`MockTensorWeaver`: the same interface, the same arguments, the same MIMIQ data
models, and no simulation behind them. Results come back well-formed and empty:
all-zero samples, zero amplitudes, fidelity 1.0.

It exists so that code which drives a MIMIQ backend can be tested on a machine
with no licence: a CI job can check that its circuits build, that its options
are accepted, that its results parse and round-trip, without paying for a
simulation it does not care about.

```bash
pip install mimiq-tensorweaver
```

```python
import mimiqcircuits as mc
from tensorweaver import MockTensorWeaver

sim = MockTensorWeaver(bonddim=64)

c = mc.Circuit()
c.push(mc.GateH(), 0)
c.push(mc.GateCX(), 0, 1)
c.push(mc.Measure(), [0, 1], [0, 1])

res = sim.execute(c, nsamples=1000, seed=42)
res.histogram()        # {bs"00": 1000}: a real QCSResults, carrying nothing
```

`MockTensorWeaver` takes the same constructor and `execute` arguments as the
licensed `TwSimulator` and refuses exactly what it refuses, so a configuration
that fails here fails there. Swapping between them is an import change.

## What this build can and cannot do

It is compiled without the compute kernels. Gate application on the MPS and the
MPO, MPO application, compression, the quantum channels and sampling are not in
the binary.

What is here is the Matrix Product State itself, and it is the real one:

```python
import tensorweaver as tw

tw.has_kernels()                 # False in this build

mps = tw.MPS.zero_state(8, 32)
mps.recanonicalize(0)            # canonical form, exact QR/LQ sweeps
mps.all_bond_dims()
mps.amplitude([0] * 8)
mps.von_neumann_entropy(2)       # entanglement of a cut, in nats
tw.MPS.deserialize(mps.serialize())
```

So a state produced by a licensed run can be saved, opened here, inspected, and
have its entanglement structure read, without being able to evolve it further.
`tensorweaver.examples_dir()` holds runnable examples; `00_mps_structure` and
`00_mock_backend` work in this build, and the rest show what the licensed one
does.

`TwSimulator` raises on construction here and says so.

## The licensed simulator

TensorWeaver is a Matrix Product State quantum circuit simulator for MIMIQ,
distributed by QPerfect to licence holders from its own package registry rather
than from PyPI.

For access, documentation and support: <https://qperfect.io>

