SFT-Torch
SFT-Torch is a Torch-native, data-agnostic compiler from structured data to spectral operator programs.
DataView -> Lift -> OperatorSpec -> SpectralProgram -> W / kappa / tail / codec
The core does not know about domains such as audio, images, astronomy, or text. It knows data topology and operator lifts:
sequence(x).fourier_bands(...)grid(x).laplacian(...)graph(edge_index, n).laplacian(...)tokens(...).transition(...)operator(A0, basis)
Example:
import sft_torch as sft
program = sft.grid(blocks).laplacian(weight=0.3).compile("cuda")
kappa = program.kappa()
tail = program.tail()
This package is intentionally separate from sft while it is being developed.
The Hermitian lane is the default production path. The non-Hermitian lane is now
coverage-gated for the theory stands listed in THEORY_COVERAGE.md: biorthogonal
W, Hessian/proxy diagnostics, projector branch tracking, EP/Puiseux/Jordan
helpers, and conditioned continuation.
Install
From a local checkout:
python3 -m pip install -e ".[dev,parity]"
For a wheel/sdist release, the PyPI package name is sftransform and the
Python import name is sft_torch:
python3 -m pip install sftransform
Build and install a local release artifact:
python3 -m pip install build
python3 -m build
python3 -m pip install dist/*.whl
python3 -c "import sft_torch; print(sft_torch.__version__)"
Install directly from the repository:
python3 -m pip install "git+ssh://git@github.com/dimaq12/spectral-flow-torch.git"
Quickstart
import torch
import sft_torch as sft
x = torch.sin(torch.linspace(0, 8, 256, dtype=torch.float64))
program = sft.sequence(x).fourier_bands(n_bands=16).compile("cpu")
W = program.W
predicted = program.predict(torch.zeros(program.M, dtype=program.dtype))
tail = program.tail(strict=False)
Production Readiness
The current Hermitian layer is a production candidate, not just a smoke demo. The test suite is split by intent:
unit: fast deterministic contracts and guardrails.parity: numeric parity against the NumPy/SciPysft.OperatorFamily.integration: cross-layer Omega/commonOperators and SFT x Omega gates.realdata: tiny deterministic fixtures forsequence,grid,graph,tokens, and explicitoperatorlifts.slowandcuda: optional paths for profiler/GPU validation.
Run the default CPU suite:
python3 -m pytest
Run targeted production groups:
python3 -m pytest -m parity
python3 -m pytest -m integration
python3 -m pytest -m realdata
python3 -m pytest -m "not slow and not cuda"
Run grouped theory coverage validation:
python3 -m sft_torch.validate --out-dir .benchmarks/validation
Run CUDA/profiler checks when a CUDA build is available:
python3 -m pytest -m cuda
Benchmarks
sft_torch.bench reports machine-readable metrics for CPU/CUDA runs:
python3 -m sft_torch.bench core --json
python3 -m sft_torch.bench graph --n 1000 --k 64 --device cuda --json
python3 -m sft_torch.bench grid --n 32 --batch 2048 --device cuda --json
python3 -m sft_torch.bench tail --n 7680 --json
python3 -m sft_torch.bench nonhermitian --n 6 --k 3 --batch 4 --json
The installed console command is also available as:
sftransform-bench core --json
Each result includes time_ms, device, dtype, batch, N, M,
eigh_count, svd_count, basis_kind, materialized_elements,
peak_memory, throughput, accuracy where applicable, and the selected
execution plan.
Store benchmark output outside source-controlled files:
python3 -m sft_torch.bench core --json --output .benchmarks/core.json
Release Docs
RELEASE_NOTES.mdrecords the0.1.0scope and validation commands.THEORY_COVERAGE.mdmaps theory/commonOperators stands to package coverage.NONHERMITIAN_ROADMAP.mdtracks the remaining future biorthogonal / EP work.PUBLISHING.mdrecords the PyPI build, upload, and install verification flow.
Known Gaps
- CUDA tests are skip-if-no-CUDA in this workspace.
- Multi-slice
grid[B,H,W]batching is explicit viabatch_mode="first","mean", or"block"; richer temporal/video operators remain future work. - Directed graph Laplacian is implemented as an explicit non-Hermitian out-degree lift. Normalized graph Laplacian is implemented for undirected graphs.
- The
taillayer exposes strict Omega mode fork | N; convenience mode is explicit and should not be used as a proof gate. - Pseudospectrum and numerical-range dashboards are optional diagnostics and are intentionally kept out of hot paths.
- Fully automatic global EP-safe inverse workflows remain roadmap work; local Puiseux/Jordan chart helpers are coverage-gated.
Metadata
Release files for sftransform 0.2.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 | |
|---|---|---|---|
| sftransform-0.2.0.tar.gz | 57.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sftransform-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 95.3 kB
Release files / sftransform-0.2.0.tar.gz
| Download URL | sftransform-0.2.0.tar.gz |
|---|---|
| Size | 57.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7c633e9c2f2d3100dac3308adc6fdc1d6ae61ed1b730741fc94ceb77c330800c
|
|
BLAKE2b-256 checksum How to use checksums |
0349731fd75042c45a6b7c73008d57bfe18d2709c8dc105d2ea53b139d4498f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / sftransform-0.2.0-py3-none-any.whl
| Download URL | sftransform-0.2.0-py3-none-any.whl |
|---|---|
| Size | 37.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f92fbbc4b4878e509eb0afca0657fe476fad18bdf094d0eb0f254d5f862d0f84
|
|
BLAKE2b-256 checksum How to use checksums |
c1cdb218d68955732715c1f6d119944f2a9e1bcde82e91ba8008f89e134b1f92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|