Skip to main content

Solver for linear systems modulo a prime

Project description

Linear System Solver Modulo a Prime

This repository contains a small solver for systems of linear equations with coefficients in (\mathbb{Z}_p), where (p) is a prime. It supports both a terminal interface and a minimal web-based calculator suitable for hosting on GitHub Pages.

Features

  • core algorithm in solver/alg.py; no dependencies other than the standard library
  • command-line tool (python -m solver or via solver.cli) that can read a matrix interactively, from a file, or from a pipe
  • static web page (docs/index.html) with a JavaScript port of the algorithm – perfect for .github.io pages

Installation

You can use the package directly from the source directory:

python3 -m venv .venv        # optional virtual env
source .venv/bin/activate
pip install -e .              # later, if packaging added

Command‑line usage

# interactive mode
python -m solver -p 7 -i

# read matrix from file
python -m solver -p 13 -f matrix.txt

# read from standard input
cat matrix.txt | python -m solver -p 5

The matrix file should contain one row per equation; each row must have the coefficients followed by the constant term, separated by spaces.

Example

$ cat matrix.txt
1 1 2
1 6 0

$ python -m solver -p 7 -f matrix.txt
solution: [2, 0]

Web interface

Currently, the web interface is available here.

Open docs/index.html in a browser or host the contents of the docs/ directory using GitHub Pages. You can point the Pages source to /docs via the repository settings and the page will be available at https://<your-username>.github.io/<repo-name>/.

The page allows you to paste a matrix and a prime modulus, then click "Solve" to see the result.

Development

  • tests can be added under tests/ using pytest
  • the algorithm is written to keep mutation local; helper functions are pure and easily ported to other languages

Feel free to extend the UI or add more command‑line options!

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

lin_sys_mod_solver-0.1.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

lin_sys_mod_solver-0.1.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for lin_sys_mod_solver-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a0a7b835d0adec403afb37a25809e2649e7256778f3676da68dab6a72114d345
MD5 084fe89007f698dd5fae3b6a024c633b
BLAKE2b-256 00e47c730a8d7cd6f257588934bd940ba999db202974d5c265c63c3232bbb3fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lin_sys_mod_solver-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b29da981438d74766f2b2762e1d0a3ed6d7a146f79f7e552693dbcedb71e81f7
MD5 f681c9aef5fb0a5000fc4e22e4560161
BLAKE2b-256 318e8ef2e8a3c04e3da421e7cd7155648cc327cdc65d40d4918e844754342fdb

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