intvert is a pure Python package for inversion of 1D and 2D integer arrays from partial DFT samples. This package contains the codebase for the paper [LV]. See the full documentation here.
Examples
An example usage of the sampling and inversion procedures in 2D for a large binary matrix.
>>> import intvert
>>> import numpy as np
>>> import gmpy2
>>>
>>> gen = np.random.default_rng(0)
>>> signal = gen.integers(0, 2, (30, 40)) # generate random binary matrix signal
>>> signal
array([[1, 1, 1, ..., 0, 0, 0],
[0, 0, 0, ..., 1, 1, 0],
[1, 1, 0, ..., 0, 1, 0],
...,
[0, 1, 0, ..., 1, 1, 1],
[1, 1, 1, ..., 0, 0, 1],
[1, 1, 1, ..., 1, 1, 0]], shape=(30, 40))
>>> with gmpy2.get_context() as c: # perform sampling and inversion with increased precision
... c.precision = 100
... sampled = intvert.sample_2D(signal)
... inverted = intvert.invert_2D(signal, beta2=1e20)
...
>>> inverted
array([[1, 1, 1, ..., 0, 0, 0],
[0, 0, 0, ..., 1, 1, 0],
[1, 1, 0, ..., 0, 1, 0],
...,
[0, 1, 0, ..., 1, 1, 1],
[1, 1, 1, ..., 0, 0, 1],
[1, 1, 1, ..., 1, 1, 0]], shape=(30, 40))
>>> np.allclose(signal, inverted) # inverted signal matches signal
True
Installation
intvert may be installed from PyPI with pip.
pip install intvert
References
Arjen K. Lenstra, Hendrik W. Lenstra, and László Lovász. Factoring polynomials with rational coefficients. Mathematische Annalen, 261(4):515–534, December 1982. ISSN 1432-1807. doi: 10.1007/bf01457454. URL: http://dx.doi.org/10.1007/BF01457454.
Howard W. Levinson and Isaac Viviano. Recovery of integer images from limited dft measurements with lattice methods, 2025. URL: https://arxiv.org/abs/2510.11949.
Soo-Chang Pei and Kuo-Wei Chang. Binary signal perfect recovery from partial dft coefficients. IEEE Transactions on Signal Processing, 70:3848–3861, 2022. doi: 10.1109/TSP.2022.3190615. URL: http://dx.doi.org/10.1109/TSP.2022.3190615.
Requirements
Metadata
Release files for intvert 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| intvert-0.1.0.tar.gz | 17.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| intvert-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.2 kB
Release files / intvert-0.1.0.tar.gz
| Download URL | intvert-0.1.0.tar.gz |
|---|---|
| Size | 17.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e123243a3646abf61a41de614d0d5f3295f98d27ea356160156b68a607ba8df
|
|
BLAKE2b-256 checksum How to use checksums |
c77cce396b0ceb37cfa5274ed14d74f9ba6b31660413c620fbf662d92ff5ca0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.14
|
Release files / intvert-0.1.0-py3-none-any.whl
| Download URL | intvert-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0b08c7eb36ec61c24539a2831950a4537f5e084326b3c4a1156afa81c4733b94
|
|
BLAKE2b-256 checksum How to use checksums |
dd8355d92aac5ae845215aeda596af7f1b2af598d5174b64b6f7e1cbf74a0ac1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.14
|