M3: Matrix-free measurement mitigation
Project description
mthree
Matrix-free Measurement Mitigation (M3).
M3 is a measurement mitigation technique that solves for corrected measurement probabilities using a dimensionality reduction step followed by either direct LU factorization or a preconditioned iterative method that nominally converges in O(1) steps, and can be computed in parallel. For example, M3 can compute corrections on 42 qubit GHZ problems in under two seconds on a quad-core machine (depending on the number of unique bitstrings in the output).
Documentation
Online Documentation @ Qiskit.org
Installation
You can pip
install M3 in using PyPi via:
pip install mthree
This will install an OpenMP optimized version on Linux, and serial versions for OSX and Windows. Alternatively, one can install from source:
pip install .
To enable openmp one must have an openmp 3.0+ enabled compiler and install with:
MTHREE_OPENMP=1 pip install .
OpenMP on OSX
On OSX one must install GCC using homebrew:
brew install gcc
Then installation with openmp can be accomplished using a call like:
MTHREE_OPENMP=1 CC=gcc-14 CXX=g++14 python setup.py install
Note that previously the instructions said to install LLVM and NOT GCC. However, in the latest version of OSX (Sequoia) LLVM based installations will build, but segfault upon execution. GCC however works fine, thus the change above.
Usage
Basic usage
M3 is simple to use:
import mthree
# Specify a mitigator object targeting a given backend
mit = mthree.M3Mitigation(backend)
# Compute the 1Q calibration matrices for the given qubits and given number of shots
# By default it is over all backend qubits at 10000 shots.
mit.cals_from_system(qubits, shots)
# Apply mitigation to a given dict of raw counts over the specified qubits
m3_quasi = mit.apply_correction(raw_counts, qubits)
Note that here qubits
is a list of which qubits are measured to yield the bits in the output.
For example the list [4,3,1,2,0]
indicates that a measurement on physical qubit 4 was written to
classical bit zero in the output bit-strings, physical qubit 3 maps to classical bit 1, etc.
The fact that the zeroth bit is right-most in the bitstring is handled internally.
Error bounds
It is possible to compute error bounds in a similarly efficient manner. This is not done by default, but rather turned on using:
m3_quasi = mit.apply_correction(raw_counts, qubits, return_mitigation_overhead=True)
Then the distribution itself can be called to return things like the expectation value and the standard deviation:
expval, stddev = quasi.expval_and_stddev()
Closest probability distribution
The results of M3 mitigation are quasi-probabilities that nominally contain small negative values. This is suitable for use in computing corrected expectation values or sampling problems where one is interested in the highest probability bit-string. However, if one needs a true probability distribution then it is possible to convert from quasi-probabilites to the closest true probability distribution in L2-norm using:
closest_probs = m3_quasi.nearest_probability_distribution()
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file mthree-2.7.0.tar.gz
.
File metadata
- Download URL: mthree-2.7.0.tar.gz
- Upload date:
- Size: 979.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a31d85fc047f8b6a8e43f8f5db26f4581ac7028d79114bbaecad4f94b0845703 |
|
MD5 | 91978a3d8c992173707f3ea14e781733 |
|
BLAKE2b-256 | 148c2297f0403e5978d5be4895d956072d4da51fdb50bed5272dac4785289f39 |
File details
Details for the file mthree-2.7.0-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: mthree-2.7.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7df225491a7003b740c92434c1ac551e374d9f41af86fdc3ad523658b954e258 |
|
MD5 | 732b670029ad3f1d63cd23ace3ed6e5f |
|
BLAKE2b-256 | 93bd60d55c412fcce26cccd594867f4eac57faf08e4b54a2f153139bdca5d0bf |
File details
Details for the file mthree-2.7.0-cp312-cp312-win32.whl
.
File metadata
- Download URL: mthree-2.7.0-cp312-cp312-win32.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.12, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4deb26eda85c6f210bc9a684d7b38fc31579f7b09c5d1c300078126a3d9a10aa |
|
MD5 | b7762f0d65566504f101b2e8757266db |
|
BLAKE2b-256 | 802271e1fae77c8494cb252c21a2312badc12185446073f3b0fee7136b711cbe |
File details
Details for the file mthree-2.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mthree-2.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24c95fb0fb32c86a4f07a9c87d18f528b6b1a7b58d1e2840f5a8de325a59807d |
|
MD5 | e67792c017e9a9120b165ca4b1674051 |
|
BLAKE2b-256 | e4f861f3800434a84f85544f161924d2e9c7faadf755d7860d9175fb2e4eca9e |
File details
Details for the file mthree-2.7.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: mthree-2.7.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 4.1 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c071144c0f061514170cd3a879411a240cf95a302689cf1073f9d6b8acb3bd6 |
|
MD5 | 5b44c7fcb44dabc7277dec33c1eaf024 |
|
BLAKE2b-256 | 3a64692385c6ee5af1a41c1192ba9aacf4170459541d73fd1e5056f34ae3ac29 |
File details
Details for the file mthree-2.7.0-cp312-cp312-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: mthree-2.7.0-cp312-cp312-macosx_12_0_x86_64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.12, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20664daa545b7fe5cf7bf5b5c9aee870f19f15cf73d5175309f285c95f25e885 |
|
MD5 | 6eb6850d918f0c253de8eed356966a48 |
|
BLAKE2b-256 | 8b18f2425688aa0e477f1788d3eabda803c61abb39b1fa88980b012096769283 |
File details
Details for the file mthree-2.7.0-cp312-cp312-macosx_12_0_universal2.whl
.
File metadata
- Download URL: mthree-2.7.0-cp312-cp312-macosx_12_0_universal2.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.12, macOS 12.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 834ee894dbaf08cf47c5ee7849bd46dca82b139714fbec59b8bb8379a32116c6 |
|
MD5 | fe216b9f126e9d51cce8ee0dcb7bd224 |
|
BLAKE2b-256 | a1d91dbe5b8e5a83774ff11f109ab306f549349ae49dd00a72af3dfb4a0df3cc |
File details
Details for the file mthree-2.7.0-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: mthree-2.7.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f92706a7042605b1603ce7251e698a7697038c4a2e191f0c56aae2cdb8d4eb3 |
|
MD5 | 5e51e8b2ca9620268f5592bff95ba0e1 |
|
BLAKE2b-256 | 0c0c39d0942efb0236f15754759f6dcca15fd97fd15c0e2844a29e412c7b9b1d |
File details
Details for the file mthree-2.7.0-cp311-cp311-win32.whl
.
File metadata
- Download URL: mthree-2.7.0-cp311-cp311-win32.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.11, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7eeb128b62e68d79a78d7297f573f918adb6417e64ace915607c0e2068d5b81c |
|
MD5 | 432482f13deb43c9c79c0204050f42e6 |
|
BLAKE2b-256 | 35c741107ff55f13ac030ae0f5164787dda957d31838cfe0f878ec02a6e4478a |
File details
Details for the file mthree-2.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mthree-2.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.3 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2f3e81284dfaf9156ffe4473d84dc0e02bd2d0895b38a0637f6030325263e54 |
|
MD5 | ad1eb5eb34ec0c69c83c2f43e3954a27 |
|
BLAKE2b-256 | 81f8b9ed9aee4b27163ecfcf9a5f12925ae5e9ad0c5af4852f34fa98cf371f1d |
File details
Details for the file mthree-2.7.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: mthree-2.7.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e2ccbd42a579fb80a1e66e9c02e3a3470e3e8fa5e2bf7b6d90b0c810b677e5c |
|
MD5 | 6ef94dcd529bbe126f21df19af5d540f |
|
BLAKE2b-256 | a231f423ccb8ad933a9002e54606e9b107c36a89501a0c67ff842e42dd623bee |
File details
Details for the file mthree-2.7.0-cp311-cp311-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: mthree-2.7.0-cp311-cp311-macosx_12_0_x86_64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.11, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b5573591e2816c69e70500bc8d70a89752bb2fd9022a0067456f489be1cdcf4 |
|
MD5 | da521af0326fd0aa6219fdaf8d14a49d |
|
BLAKE2b-256 | 6dc551dd187731b2e6175cb94a3f7012df95c3a80a7a9fb66edbf6c4cf549bd4 |
File details
Details for the file mthree-2.7.0-cp311-cp311-macosx_12_0_universal2.whl
.
File metadata
- Download URL: mthree-2.7.0-cp311-cp311-macosx_12_0_universal2.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.11, macOS 12.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 001cbdebbf3dd4e73a4e3b6189e9035c141f583e46d82f3b59d10a5e1e0566dc |
|
MD5 | 0e0826813d4d4b3eb455bd28eeeaa539 |
|
BLAKE2b-256 | 294335d3b7c0241bf910d3be2a1e5ea9e78887fe32eb07dd13519c0eb947062d |
File details
Details for the file mthree-2.7.0-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: mthree-2.7.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fac2f6781b9e07f55e9200060fff012e1d89b389c25023d5363662fc0e5402c |
|
MD5 | 95a0202ba4f625d879c4a420cf0c950f |
|
BLAKE2b-256 | 3413575328eb91415b2466c70ccbe883aebd5f81b15e77bb1a87d85c1bae33a7 |
File details
Details for the file mthree-2.7.0-cp310-cp310-win32.whl
.
File metadata
- Download URL: mthree-2.7.0-cp310-cp310-win32.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.10, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff7d4dfbd1b3b3edd2c227d66a51be85151b5ce46a924bc58f1529d478d82412 |
|
MD5 | 4ee328b3a6cbb9bb6dce5fcdf649a5ce |
|
BLAKE2b-256 | 383e44522a663a9d866b3e106d8efd636df1ee04dd1c88037f064b6bb59eb9c8 |
File details
Details for the file mthree-2.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mthree-2.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.1 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 489c7d6c8c8789ee4ef693c2c2db08d4ce528e1d44bfded1b8d0f93f4b55d66c |
|
MD5 | b7a3b4f34f31c89d289fcc20e75c166c |
|
BLAKE2b-256 | 055756be0673fecf29c82942e53b8a897f2dd28c7440394fe1f9fd54e6530fe5 |
File details
Details for the file mthree-2.7.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: mthree-2.7.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90cd3a486812bde6cee627de486e2c7d6573983a8c47320f8b0c7c8c26230c37 |
|
MD5 | 288397d52a542f74a33bad6db664f3a0 |
|
BLAKE2b-256 | 8b2a57fbd62b60eb496028bf448fd162a2935de3fa08fa102e6a366778184d5a |
File details
Details for the file mthree-2.7.0-cp310-cp310-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: mthree-2.7.0-cp310-cp310-macosx_12_0_x86_64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.10, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a7a29a8de40aa116ff8f5a19d0864d5a15bb368d7ba00efa97890dbdae3f6be |
|
MD5 | ffa0dcfae96d000e54c6e3af8bc7b5bb |
|
BLAKE2b-256 | bdd492a0bd8966f75397309d9af5be85e2593523c71c33751c54939281772261 |
File details
Details for the file mthree-2.7.0-cp310-cp310-macosx_12_0_universal2.whl
.
File metadata
- Download URL: mthree-2.7.0-cp310-cp310-macosx_12_0_universal2.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.10, macOS 12.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b83a23dd0887592c656715c86de4a4c38f49577ab408c6c2a10800cfcf51633 |
|
MD5 | 3497ed0f669f62dae01c5d0d29520fbc |
|
BLAKE2b-256 | b10daa5630f6f381f17519d050197ff67a3a1e1262aa5df39504c02e98f44cb0 |
File details
Details for the file mthree-2.7.0-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: mthree-2.7.0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ed52af7a659cd2d99b0798eba0353ba7ebcaaae36d103ff3369936dc470d064 |
|
MD5 | 9faaab77d425d28c939b7ff8c9d54c99 |
|
BLAKE2b-256 | d456fd256c5effe681b0d60aa01da2596dc923b6222696a8b4c81ef9a55c4228 |
File details
Details for the file mthree-2.7.0-cp39-cp39-win32.whl
.
File metadata
- Download URL: mthree-2.7.0-cp39-cp39-win32.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.9, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b76453f3b1061596353d59159dc4f78be78c92cf3af1e8950c469e91da52013 |
|
MD5 | e3f434df0b18dc755f2c73d130df2658 |
|
BLAKE2b-256 | f19383b80ec63a19132d52e9087b0fd08de61ebe2e5fcb5d988341ddb98884a7 |
File details
Details for the file mthree-2.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mthree-2.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 4.1 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76113cee8d4cfe2f15966177a8a8fd8f9d08531d6ed3b4786de2a0c06532703d |
|
MD5 | 01eb51c61a8822ed285675b7ab502da8 |
|
BLAKE2b-256 | 40f4a3f7af2f92393405365bb3add408a07bb7fcac64e0e10541c0ef8428a282 |
File details
Details for the file mthree-2.7.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: mthree-2.7.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 4.0 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 632230b0ef4b2ad59e67d178dfa146a5561a7b96ad1fe358722411ea807dd0fa |
|
MD5 | 4aec864fc3921fb267b9e1b6bf81cf32 |
|
BLAKE2b-256 | 771c15e8c20c1c3f7514fecdcdc160892461b8a6389768b4ef48a86a3002e421 |
File details
Details for the file mthree-2.7.0-cp39-cp39-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: mthree-2.7.0-cp39-cp39-macosx_12_0_x86_64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.9, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cdc9cd797399403b24a2f2042312cddd49a7167ab7e5d95dc42507ef58cb743d |
|
MD5 | d1ec80748b4ee8f887e735f6ea083e08 |
|
BLAKE2b-256 | 1bcab8fb5bc962a9f7ef4a212d5d6e2b74cac1ff69a593d9f378c3d85d08e62c |
File details
Details for the file mthree-2.7.0-cp39-cp39-macosx_12_0_universal2.whl
.
File metadata
- Download URL: mthree-2.7.0-cp39-cp39-macosx_12_0_universal2.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.9, macOS 12.0+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f9a73737f38991d7ffef000764d94509da5c704eeb8ac0378e1f4106224e35f |
|
MD5 | 0438d64489cf063367573cadd55f0801 |
|
BLAKE2b-256 | 07544a11848c58ba6c12e7c10ea3c8b873ed1d5b37620ec125ae89d2b9e35266 |