How tristandelcourt/tipe works
Project Type and Purpose
• Project Type: A command-line, C-based factorization toolkit.
• Purpose: Expose multiple prime-factor algorithms (Dixon, Quadratic Sieve, Multipolynomial Quadratic Sieve, Parallel MPQS) via a single executable called factor.
• Users interact via CLI flags; the program delegates to one of four algorithms and prints or saves results.
File Structure
Top-level:
• _python_deprecated, _random_deprecated: historical implementations (can be shown as “legacy” or omitted).
• c/: primary source code.
• tests/: test inputs, outputs, and test drivers (both C and Python).
Inside c/:
• main.c + Makefile: build and entry point.
• Algo modules: dixon/, qsieve/, mpqs/ (with parallel_mpqs.c).
• Shared utilities: factorbase.{c,h}, list_matrix_utils.{c,h}, parse_input.{c,h}, system.{c,h}, vector.{c,h}, plus MPQS-specific polynomial.{c,h}.
README for Insights
• Confirms CLI flags (--number, --type, --bound, etc.)
• Explains each algorithm’s folder holds the core smooth-relation logic.
• Build via Makefile → produces factor executable.
Main Components & Interactions
a. Components:
1. User / CLI Interface
2. Argument Parser (parse_input)
3. Main Controller (main.c)
4. Algorithm Modules (plug-ins):
– Dixon (c/dixon/dixon.c)
– QSieve (c/qsieve/qsieve.c)
– MPQS (c/mpqs/mpqs.c)
– Parallel MPQS (c/mpqs/parallel_mpqs.c)
5. Shared Libraries:
– Factor Base (factorbase.*)
– Matrix Utilities (list_matrix_utils.*)
– Polynomial Utils (for MPQS)
– System Helpers (system.*)
– Vector Data Structures (vector.*)
6. Output Layer (stdout or file)
7. Test Harness (tests/tests.c, tests/tests.py)
b. Interactions & Data Flow:
• User runs factor --type qsieve -n 12345 …
↓
• CLI Interface → parse_input populates a config struct
↓
• main.c reads config → switches on algorithm type
↓
• Invokes selected Algorithm Module → calls Shared Libraries for:
– Building prime factor base
– Sieving or relation collection
– Linear algebra (matrix utils)
↓
• Algorithm returns factorization result
↓
• Main Controller sends output to stdout or writes to file
↓
• Tests invoke the same CLI or call modules directly, compare against expected JSON/text results.
c. Architectural Patterns & Principles:
• Modular plugin-style for each algorithm.
• Core-side separation: CLI/Controller vs. Algorithm vs. Shared Utilities.
• Reuse of generic data structures (vectors, matrices).
• Parallelism hidden behind the MPQS plugin (note thread-creation or OpenMP).
d. Key Technologies:
• Language: C
• Build: GNU Make
• Parallelism: POSIX threads or OpenMP (in parallel_mpqs.c)
• Tests: C unit-style (tests.c) and Python runner (tests.py)
• Documentation: LaTeX/Beamer
Don’t Overthink—Be Exhaustive
• Every logical component (do not merge Dixon and QSieve into “Algorithms” without noting them separately).