Quantum Information · Channel analysis
Quantum channel analysis
From Kraus operators: Choi matrix, CPTP check, Pauli transfer matrix, gate fidelities, unitarity and diamond distance in one report.
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.
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).
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.
pip install "ketqat[qinfo] @ git+https://github.com/ketqat/ketqat-sdk@2cedabbd814fd199b1989c8ceb1e9efa1744c2c0#subdirectory=python"Save it as example.py and run python example.py. Or use the CLI: ketqat catalog run [email protected].
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")},
}))
{
"purity": 0.73,
"status": "succeeded",
"fidelity": 0.85,
"concurrence": 0.7,
"log_negativity": 0.765534746
}Verified with
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.
| Name | Type | Default | Allowed values | Description |
|---|---|---|---|---|
| preset | string | null | enum: bell, ghz, werner | A named state: bell (|Phi+>), ghz, or werner (p |Psi-><Psi-| + (1-p) I/4). Give exactly one of preset and matrix_file. |
| matrix_file | path | null | fileExtensions: .npy, .json | Your 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_p | number | null | maximum: 1; minimum: 0 | Singlet weight p for preset=werner. |
| ghz_qubits | integer | null | maximum: 10; minimum: 2 | Qubits in the GHZ preset. null means 3. |
| dims | integer[] | null | minItems: 1; itemMinimum: 1 | Subsystem dimensions, Kronecker order. null treats the state as qubits (the dimension must be a power of 2). |
| subsystem_a | integer[] | null | itemMinimum: 0; uniqueItems: true | Subsystem indices forming part A of the bipartition; B is the rest. null means [0]. |
| measures | string[] | null | itemEnum: von_neumann_entropy, renyi_entropy, purity, reduced_entropy, mutual_information, concurrence, negativity, log_negativity, fidelity, trace_distance; minItems: 1; uniqueItems: true | Measures 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_alpha | number | 2 | maximum: 1000; exclusiveMinimum: 0 | Order alpha of the Renyi entropy (alpha = 1 gives von Neumann). |
| reference | string | null | enum: ideal, maximally-mixed, zero | Reference 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_file | path | null | fileExtensions: .npy, .json | Reference state from a file, same formats as matrix_file. Replaces reference. |
| tolerance | number | 1e-8 | maximum: 0.001; exclusiveMinimum: 0 | Tolerance for the Hermitian, positive-semidefinite, unit-trace and normalisation checks. |
| Name | Type | Description |
|---|---|---|
| measures | object | Each computed measure by name. Entropies and log-negativity in bits; fidelity is the squared Uhlmann fidelity. |
| not_applicable | object | Measures skipped because they do not apply to this state, with the reason. |
| dims | integer[] | Subsystem dimensions used. |
| state | object | Which state was measured: the preset and its parameters, or the input file's sha256. |
| min_eigenvalue | number | Smallest eigenvalue of the validated density matrix. |
Werner state with p=0.8: concurrence 0.700, logarithmic negativity 0.7655 bits, singlet fidelity 0.850, purity 0.730.
Generated with
{"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}{
"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": {}
}bell state
Bell state: reduced entropy 1 bit, concurrence 1, logarithmic negativity 1, mutual information 2 bits.
python/tests/test_catalog_products.py::test_state_measures_on_a_bell_state
product states
Product states (including mixed product states with qutrit factors) have zero reduced entropy (pure case), mutual information, concurrence and negativity.
python/tests/test_catalog_products.py::test_state_measures_vanish_on_product_states
werner curves
Werner states over p in [0, 1]: concurrence max(0, (3p-1)/2), logarithmic negativity log2((1+3p)/2) above p = 1/3, purity (1+3p^2)/4, singlet fidelity (1+3p)/4.
python/tests/test_catalog_products.py::test_state_measures_follow_the_werner_curves
two fidelity formulas
Fidelity computed from eigenvalues of sqrt(rho) sigma sqrt(rho) agrees with the singular-value form ||sqrt(rho) sqrt(sigma)||_1^2 on random mixed states, and with |<psi|phi>|^2 on pure states.
python/tests/test_catalog_products.py::test_fidelity_two_independent_formulas_agree
helstrom
Trace distance equals 2 P_Helstrom - 1, with P_Helstrom evaluated from the optimal projective measurement.
python/tests/test_catalog_products.py::test_trace_distance_matches_the_helstrom_measurement
partial trace
Partial trace over arbitrary subsystem dimensions recovers each factor of a tensor product of random states.
python/tests/test_catalog_products.py::test_partial_trace_recovers_tensor_factors
input validation
Non-Hermitian, non-PSD, non-unit-trace, mis-dimensioned and unnormalised inputs are rejected with the violated condition.
python/tests/test_catalog_products.py::test_state_measures_reject_invalid_input
example execution
The example code is executed verbatim in a clean virtual environment with only the qinfo extra installed.
1.0.029 Oct 2026currentShown on this page
Needs SDK 0.3.0 or later with extras: qinfo.
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.
Apache-2.0 — see Licensing.
People credited for this product. KetQat publishes and maintains it; contributors are credited for their work and are not sellers.
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.
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.