Skip to main content
KetQat

Appearance

Quantum state measures

Entropies, purity, fidelity, trace distance, mutual information, concurrence and negativity for a preset or your own state.

Officially provided by KetQat — method by Nielsen and Chuang (2010), Jozsa (1994) and others. KetQat prepares, verifies and maintains this product; it does not claim to have invented the method. Read the origin statement.

What it does and who it is for

Computes standard quantum-information measures of a density matrix by exact linear algebra: von Neumann and Renyi entropies, purity, the entanglement entropy of a subsystem (via the partial trace over arbitrary subsystem dimensions), quantum mutual information, Wootters concurrence for two qubits, negativity and logarithmic negativity, and the fidelity and trace distance to a reference state.

The state is a preset (Bell, GHZ, two-qubit Werner) or your own state vector or density matrix in a .npy or .json file. Input is validated, never repaired: a matrix that is not Hermitian, not positive semidefinite or not of unit trace (within a tolerance you can set) is rejected with the violated condition.

For students checking textbook values and researchers who need trustworthy, reproducible numbers for small systems (up to dimension 1024).

Use cases

  • Quantify the entanglement of a two-qubit state from an experiment or simulation
  • Compare a noisy state with its ideal target by fidelity and trace distance
  • Trace the Werner-state curves of concurrence and logarithmic negativity
  • Compute subsystem entropies and mutual information of a multi-qubit state

Use it on your computer

This page never runs anything. Copy the commands into your own terminal; the product runs locally with no account and no telemetry.
  1. Install

    Installs the KetQat SDK from commit 2cedabbd814f, the exact version whose product definition this page shows. The SDK is not on PyPI yet, so pip install ketqat alone will not work.

    Terminal
    pip install "ketqat[qinfo] @ git+https://github.com/ketqat/ketqat-sdk@2cedabbd814fd199b1989c8ceb1e9efa1744c2c0#subdirectory=python"
  2. Run the example

    Save it as example.py and run python example.py. Or use the CLI: ketqat catalog run [email protected].

    Python
    import json
    from ketqat_runner import catalog
    
    record = catalog.run("[email protected]", preset="werner", werner_p=0.8)
    measures = record.result["measures"]
    print(json.dumps({
        "status": record.status,
        **{name: round(measures[name], 9) for name in ("concurrence", "log_negativity", "fidelity", "purity")},
    }))
    
    Expected output (fields the example must print)
    {
      "purity": 0.73,
      "status": "succeeded",
      "fidelity": 0.85,
      "concurrence": 0.7,
      "log_negativity": 0.765534746
    }

    Verified with

    SDK
    0.3.0
    Python
    3.12.12
    Platform
    macOS-27.0.1-arm64 Python 3.12.12 (maintainer run) and Ubuntu 26.04 x86_64 Python 3.12.15 (GitHub Actions python-package.yml catalog job, run 40815046070: example executed verbatim in a clean virtualenv)
    Date
    29 Oct 2026
  3. Optional: tell us it ran

    ketqat report RUN_ID sends an opt-in usage report: product, version, succeeded/failed, time and SDK version only. It shows you the exact payload first and needs an API token from Settings. Nothing is sent unless you run it.

Inputs and outputs

Inputs

Inputs of Quantum state measures
NameTypeDefaultAllowed valuesDescription
presetstringnullenum: bell, ghz, wernerA named state: bell (|Phi+>), ghz, or werner (p |Psi-><Psi-| + (1-p) I/4). Give exactly one of preset and matrix_file.
matrix_filepathnullfileExtensions: .npy, .jsonYour state: .npy (1-D state vector or 2-D density matrix, no pickles) or .json ({"statevector" or "density_matrix": {"real": ..., "imag": ...}}). Its sha256 is recorded.
werner_pnumbernullmaximum: 1; minimum: 0Singlet weight p for preset=werner.
ghz_qubitsintegernullmaximum: 10; minimum: 2Qubits in the GHZ preset. null means 3.
dimsinteger[]nullminItems: 1; itemMinimum: 1Subsystem dimensions, Kronecker order. null treats the state as qubits (the dimension must be a power of 2).
subsystem_ainteger[]nullitemMinimum: 0; uniqueItems: trueSubsystem indices forming part A of the bipartition; B is the rest. null means [0].
measuresstring[]nullitemEnum: von_neumann_entropy, renyi_entropy, purity, reduced_entropy, mutual_information, concurrence, negativity, log_negativity, fidelity, trace_distance; minItems: 1; uniqueItems: trueMeasures to compute. null computes every applicable one and lists the rest under not_applicable; an explicitly requested measure that does not apply is an error.
renyi_alphanumber2maximum: 1000; exclusiveMinimum: 0Order alpha of the Renyi entropy (alpha = 1 gives von Neumann).
referencestringnullenum: ideal, maximally-mixed, zeroReference state for fidelity and trace distance. null means ideal for presets (the noiseless pure state; the singlet for werner) and maximally-mixed for files.
reference_filepathnullfileExtensions: .npy, .jsonReference state from a file, same formats as matrix_file. Replaces reference.
tolerancenumber1e-8maximum: 0.001; exclusiveMinimum: 0Tolerance for the Hermitian, positive-semidefinite, unit-trace and normalisation checks.

Outputs

Outputs of Quantum state measures
NameTypeDescription
measuresobjectEach computed measure by name. Entropies and log-negativity in bits; fidelity is the squared Uhlmann fidelity.
not_applicableobjectMeasures skipped because they do not apply to this state, with the reason.
dimsinteger[]Subsystem dimensions used.
stateobjectWhich state was measured: the preset and its parameters, or the input file's sha256.
min_eigenvaluenumberSmallest eigenvalue of the validated density matrix.

Sample result

Werner state with p=0.8: concurrence 0.700, logarithmic negativity 0.7655 bits, singlet fidelity 0.850, purity 0.730.

Generated with

Product version
1.0.0
Seed
null
Parameters
{"dims":null,"preset":"werner","measures":null,"werner_p":0.8,"reference":null,"tolerance":1e-8,"ghz_qubits":null,"matrix_file":null,"renyi_alpha":2,"subsystem_a":null,"reference_file":null}
SDK
0.3.0
Python
3.12.12
Platform
macOS-27.0.1-arm64-arm-64bit
Result data (JSON)
{
  "dims": [
    2,
    2
  ],
  "state": {
    "preset": "werner",
    "source": "preset",
    "werner_p": 0.8,
    "description": "p |Psi-><Psi-| + (1-p) I/4"
  },
  "measures": {
    "purity": 0.7299999999999996,
    "fidelity": 0.849999999999999,
    "negativity": 0.3499999999999999,
    "concurrence": 0.6999999999999997,
    "renyi_entropy": {
      "alpha": 2,
      "value": 0.4540316308947079
    },
    "log_negativity": 0.7655347463629768,
    "trace_distance": 0.15,
    "reduced_entropy": 1,
    "mutual_information": 1.152415320175426,
    "von_neumann_entropy": 0.8475846798245739
  },
  "reference": {
    "source": "ideal",
    "description": "the noiseless pure state of the preset"
  },
  "subsystem_a": [
    0
  ],
  "not_applicable": {}
}

Assumptions, scope and limitations

Assumptions

  • Finite-dimensional states given as dense matrices; subsystems are ordered as in a Kronecker product.
  • Logarithms are base 2. Fidelity is the squared Uhlmann-Jozsa fidelity, F = (Tr sqrt(sqrt(rho) sigma sqrt(rho)))^2.
  • Eigenvalues below 1e-12 are treated as zero in entropies (0 log 0 = 0).

Scope

  • Any valid density matrix or normalised state vector up to dimension 1024.
  • Concurrence for two qubits only; negativity and logarithmic negativity for any bipartition given by subsystem_a.

Limitations

  • Exact dense linear algebra: memory and time grow as d^2 and d^3, so dimension 1024 (10 qubits) is the ceiling.
  • Concurrence is computed for two-qubit states only; no multipartite entanglement measure is provided.
  • Negativity detects only NPT entanglement; a zero value does not prove separability beyond 2x2 and 2x3 systems.
  • Input that violates validity beyond the tolerance is rejected, not projected onto the nearest valid state.
  • Fidelity of rank-deficient states is accurate to about 1e-8, because square roots of round-off-level eigenvalues enter the formula; full-rank states agree to round-off.
  • Tested on macOS and Linux only; Windows is untested.

Environment and resources

Runs
Locally, on your computer
Type
Analysis
Python
>=3.10
Operating systems
Linux, macOS
Resources
Two-qubit presets: milliseconds. Dimension 1024: a few seconds and <300 MB, dominated by eigendecompositions.
SDK extras
qinfo
Minimum SDK
0.3.0

Validation

Verified: the example was executed by CI, validation tests exist and limitations are recorded.

Versions and changelog

  1. 1.0.029 Oct 2026currentShown on this page

    • First catalog release: NumPy state measures with input validation.

    Needs SDK 0.3.0 or later with extras: qinfo.

All product changelogs

Origin, license and credits

KetQat implementation of published methods

The measures are standard definitions from the literature: fidelity (Uhlmann; Jozsa 1994), concurrence (Wootters 1998), negativity and logarithmic negativity (Vidal and Werner 2002), the Werner family (Werner 1989) and the Helstrom bound (Helstrom 1976). KetQat wrote this NumPy implementation, its input validation, its validation tests and this catalog entry. KetQat did not invent any of the measures.

Upstream software

License of what you receive

Apache-2.0 — see Licensing.

Contributors

People credited for this product. KetQat publishes and maintains it; contributors are credited for their work and are not sellers.

  • dorakingx · KetQat maintainer: implementation, validation and catalog entry

How to contribute

References

  1. Michael A. Nielsen, Isaac L. Chuang (2010). Quantum Computation and Quantum Information: 10th Anniversary Edition. Cambridge University Press.DOI 10.1017/CBO9780511976667
  2. Richard Jozsa (1994). Fidelity for mixed quantum states. Journal of Modern Optics 41, 2315-2323.
  3. William K. Wootters (1998). Entanglement of Formation of an Arbitrary State of Two Qubits. Physical Review Letters 80, 2245.DOI 10.1103/PhysRevLett.80.2245arXiv:quant-ph/9709029
  4. G. Vidal, R. F. Werner (2002). Computable measure of entanglement. Physical Review A 65, 032314.DOI 10.1103/PhysRevA.65.032314arXiv:quant-ph/0102117
  5. Reinhard F. Werner (1989). Quantum states with Einstein-Podolsky-Rosen correlations admitting a hidden-variable model. Physical Review A 40, 4277.DOI 10.1103/PhysRevA.40.4277
  6. Carl W. Helstrom (1976). Quantum Detection and Estimation Theory. Academic Press.

Usage

No usage reports yet

Distinct signed-in accounts that chose to send at least one usage report (ketqat report) for this product in the last 90 days. KetQat staff, test and bot accounts are excluded. Reports are opt-in, so this is not a count of all users.

Computed 10 Nov 2026, 17:34 UTC.

Reviews

Not yet rated

Be the first to rate this product after you run it.

Mean of visible reviews. Hidden reviews and reviews by KetQat staff, test and bot accounts are excluded. Pro status gives no extra weight.

Sign in to review this product. One review per person; you can edit it later.

No reviews yet.