Skip to main content

Algebraic toolkit for 2x2 doubly stochastic matrices: cascade, entropy, correction, phase recovery, and compilation

Project description

DS2 — Algebraic Toolkit for 2x2 Doubly Stochastic Matrices

PyPI version Python License Tests

One scalar replaces four complex scattering parameters.

Every 2x2 doubly stochastic matrix is uniquely determined by a single eigenvalue lambda in [-1, 1], and P(a) * P(b) = P(a*b). This monoid structure reduces cascade analysis to scalar multiplication — no matrix algebra needed.

Installation

pip install ds2-toolkit

Quick Start

import ds2_toolkit

# Build a P(lambda) matrix
P = ds2_toolkit.matrix(0.7)
# array([[0.85, 0.15],
#        [0.15, 0.85]])

# Cascade 4 devices: just multiply eigenvalues
result = ds2_toolkit.cascade([0.9, 0.8, -0.5, 0.95])
print(result.eigenvalue)          # -0.342
print(result.insertion_loss_db)   # 3.33 dB

# Analog error correction (k=3 repetition code)
ds2_toolkit.correct(0.3, k=3)  # 0.4365 — repels from 0

# Compile a target IL from standard components
r = ds2_toolkit.compile(target_il=7.0)
print(r.chain)   # ('6dB', '1dB')
print(r.error_db) # 0.0

# Landauer efficiency (quasistatic erasure)
ds2_toolkit.landauer_efficiency(delta_0=0.9, delta_f=0.1, k=100)
# {'eta': 0.982, 'delta_h': 0.469, 'dissipation': 0.009, ...}

# 13-domain universality
ds2_toolkit.domains.bsc(epsilon=0.1)          # 0.8
ds2_toolkit.domains.beam_splitter(reflectance=0.3)  # -0.4
ds2_toolkit.domains.scattering(s11_sq=0.3)    # -0.4

Five Tools

Tool What it does Key result
Cascade lambda_total = prod(lambda_i) Error < 10^-16
Thermodynamics Entropy budget + Landauer cost eta -> 1 as k -> inf
Correction f_3(lambda) = (3*lambda - lambda^3)/2 26.5x capacity gain
Phase recovery Interferometric S-matrix reconstruction 100% on 1000 unitaries
Compiler Target IL -> device chain 0.00 dB error

Thirteen Domains

The DS2 monoid appears in: microwave scattering, quantum gates, Markov chains, softmax/neural networks, optical beam splitters, population genetics, resistor dividers, polarization (Malus's law), IIR filters, binary symmetric channels, synaptic transmission, gene regulation, and epidemic transmission.

from ds2_toolkit.domains import DOMAIN_TABLE
for d in DOMAIN_TABLE:
    print(f"{d['domain']:30s} lambda = {d['lambda']}")

References

  • D. T. Foss, "Algebraic Structure of Doubly Stochastic Power Matrices in Electromagnetic Scattering," Proc. ICEAA/APWC, Toyama, Japan, Sep. 2026.
  • D. T. Foss, "The DS2 Toolkit: Algebraic Methods for Two-Port Network Analysis Across Thirteen Domains," Proc. ICEAA/APWC, Toyama, Japan, Sep. 2026.

License

BSD 3-Clause. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ds2_toolkit-0.1.1.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ds2_toolkit-0.1.1-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file ds2_toolkit-0.1.1.tar.gz.

File metadata

  • Download URL: ds2_toolkit-0.1.1.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for ds2_toolkit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1f71e60a08059e9ad999a9482c1ab965d2e1ae9d8aff3c7f44929ad95a589366
MD5 984d6b4955895889d81030b5164cf328
BLAKE2b-256 069e447e72f9d80aeba42a3fd87a95643f92eb2a031ac1348bfbdbff64f69028

See more details on using hashes here.

File details

Details for the file ds2_toolkit-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ds2_toolkit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for ds2_toolkit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 70909ba3c4abc377d18cd09591a5e4109d68bed1b224d4bec38731b0c7c9eae2
MD5 12508db1cd1073f6d594048c93867c46
BLAKE2b-256 7f74c9bd2a8c6499668919a3d63782721145c7fc641d0c19465261079f2f508b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page