Skip to main content

Flatn - Python Wrapper for Flatter

Flatn is a Python wrapper around the execellent flatter lattice reduction library, providing a simple and convenient way to perform lattice reduction operations from Python code.

Lattice reduction is an important technique in computational number theory and cryptanalysis that transforms a given set of basis vectors into a "nicer" (shorter) basis for the same lattice. If you found this package, you probably know why you want to do this...

Installation

You can install Flatn using pip:

pip install flatn

Currently, only darwin/aarch64, linux/x86_64, and linux/arm64 are supported. No dependencies are required: all the flatter dependencies are statically linked into the binary.

Usage Example

The library provides two main functions:

  • reduce(): The main function for lattice reduction
  • run_flatter_raw(): Lowest-level function for debugging: simply calls the flatter binary.

Here is a simple example:

import flatn

# define a lattice as a list of basis vectors
lattice = [
    [1, 0, 331, 303],
    [0, 1, 456, 225],
    [0, 0, 628, 0],
    [0, 0, 0, 628]
]

# derform lattice reduction
reduced_basis = flatn.reduce(lattice)

print(reduced_basis)
# output:
# [[-9, 1, -11, 10],
#  [16, -2, -12, 2],
#  [12, 23, 16, 19],
#  [3, 35, -3, -8]]

# You can also control the reduction quality with parameters:
# - alpha: higher means more reduced
# - rhf: target root Hermite factor
# - delta: LLL parameter (between 0.25 and 1.0)
# - logcond: maximum allowed log of condition number

# For example, specifying delta:
reduced_basis = flatn.reduce(lattice, delta=0.99)

Metadata

Release files for flatn 0.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for flatn 0.3.5
File Interpreter ABI Platform Actions
flatn-0.3.5-py3-none-manylinux1_x86_64.whl Python 3 none Linux glibc 2.5+ x86-64 Details for flatn-0.3.5-py3-none-manylinux1_x86_64.whl
flatn-0.3.5-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for flatn-0.3.5-py3-none-macosx_11_0_arm64.whl

Total release size: 29.4 MB

Release files / flatn-0.3.5-py3-none-manylinux1_x86_64.whl

Download URL flatn-0.3.5-py3-none-manylinux1_x86_64.whl
Size 16.8 MB
Tags Linux glibc 2.5+ x86-64 Python 3
SHA-256 checksum
How to use checksums
61c1da06a51342d3e42fa83185b7459be2a885c696d377acecd70a1a5f9ad380
BLAKE2b-256 checksum
How to use checksums
b0c5d0a76fc673f0b1e02a23322350a61e8ee09e5daf2022bd3fc6da729b46cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.

Transparency log

Release files / flatn-0.3.5-py3-none-macosx_11_0_arm64.whl

Download URL flatn-0.3.5-py3-none-macosx_11_0_arm64.whl
Size 12.6 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
94a708322883a37db3f50599813b08f70143fb25c67c46627d5833b5fdfc350c
BLAKE2b-256 checksum
How to use checksums
11b8b1da779e3880bc8ebbf8d12ea43eb0f1610cec026209c5b4b09f86221e4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.

Transparency log

Security for flatn 0.3.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for flatn-0.3.5-py3-none-manylinux1_x86_64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page