First off, thank you for considering contributing to libadic! It's people like you that make libadic a groundbreaking tool for mathematical research.
libadic aims to be the definitive implementation of p-adic arithmetic for validating the Reid-Li Criterion. We value:
- Mathematical Rigor: Every algorithm must be mathematically correct
- Performance: Optimized for large-scale computations
- Clarity: Code should be self-documenting with clear intent
- Testing: Comprehensive validation with mathematical proofs
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/libadic.git cd libadic - Add the upstream repository:
git remote add upstream https://github.com/IguanAI/libadic.git
We recommend using the Docker environment for consistency:
docker-compose up -d
docker-compose exec libadic bashCreate a feature branch from main:
git checkout -b feature/your-feature-nameUse descriptive branch names:
feature/- New featuresfix/- Bug fixesdocs/- Documentation improvementsperf/- Performance improvementstest/- Test improvements
- C++ Standard: Use C++17 features appropriately
- Naming:
- Classes:
PascalCase - Functions/Methods:
snake_case - Constants:
UPPER_SNAKE_CASE - Member variables:
member_var_(trailing underscore for private)
- Classes:
- Headers: Use include guards, not
#pragma once - Memory: RAII everywhere - no manual memory management
- Errors: Use exceptions for error handling
Every mathematical function must include:
- Convergence conditions clearly documented
- Precision guarantees explicitly stated
- Mathematical proof or reference to literature
- Test cases validating the mathematics
Example:
/**
* Computes the p-adic logarithm of x.
*
* Mathematical basis: Taylor series log(1+u) = u - u²/2 + u³/3 - ...
* Convergence: Requires x ≡ 1 (mod p) for p ≠ 2, or x ≡ 1 (mod 4) for p = 2
* Precision: Returns result with precision O(p^N) where N is input precision
*
* Reference: Koblitz, "p-adic Numbers", Chapter 4
*
* @param x p-adic number with valuation 0
* @return p-adic logarithm of x
* @throws domain_error if convergence conditions not met
*/
Qp log_p(const Qp& x);Every contribution must include tests:
void test_my_feature() {
TestFramework test("My Feature Test");
// Test the mathematical identity
test.mathematical_proof(
"Identity name",
"Proof description",
actual_value == expected_value
);
// Test edge cases
test.assert_true(edge_case_handled, "Edge case description");
// Validate precision
test.assert_precision(computed, expected, tolerance, "Precision test");
test.report();
test.require_all_passed();
}- Update the README if you've added new features
- Add inline documentation for all public APIs
- Include mathematical proofs in comments
- Update CHANGELOG.md with your changes
Write clear, descriptive commit messages:
git commit -m "feat: Add Iwasawa logarithm for p-adic L-functions
- Implement convergent series expansion
- Add Mahler coefficient computation
- Validate against Coleman's formula
- Test convergence for p=2,3,5,7"Follow conventional commits:
feat:- New featurefix:- Bug fixdocs:- Documentationperf:- Performance improvementtest:- Test addition/modificationrefactor:- Code refactoring
Before pushing, ensure all tests pass:
cd build
cmake ..
make -j$(nproc)
ctest --verboseVerify mathematical correctness:
./milestone1_test 5 60
./milestone1_test 7 60
./milestone1_test 11 60git push origin feature/your-feature-nameThen create a Pull Request on GitHub with:
- Clear description of changes
- Mathematical justification if applicable
- Test results
- Any benchmark improvements
When optimizing performance:
- Benchmark First: Measure before and after
- Document Complexity: State big-O complexity
- Maintain Accuracy: Never sacrifice correctness for speed
- Test Thoroughly: Include large-precision tests
Example benchmark format:
// Benchmark: Computing log_p for 1000-digit precision
// Before: 2.3s
// After: 0.8s
// Method: Implemented binary splitting for series evaluationFor new mathematical algorithms:
- Provide Proof: Include complete mathematical proof or citation
- Verify Convergence: Document convergence conditions
- Test Exhaustively: Multiple test cases across different primes
- Compare Literature: Reference existing implementations
Include:
- Minimal reproducible example
- Expected behavior
- Actual behavior
- System information (OS, compiler, GMP version)
- Mathematical context if relevant
Include:
- Mathematical motivation
- Use case description
- Proposed implementation approach
- References to literature
- Koblitz, N. "p-adic Numbers, p-adic Analysis, and Zeta-Functions"
- Robert, A. "A Course in p-adic Analysis"
- Gouvêa, F. "p-adic Numbers: An Introduction"
Contributors will be:
- Listed in CONTRIBUTORS.md
- Acknowledged in release notes
- Credited in academic publications using the library
- GitHub Issues: Technical discussions
- GitHub Discussions: General questions and ideas
- Pull Requests: Code review and implementation discussion
- Be respectful and inclusive
- Welcome newcomers and help them get started
- Focus on mathematical correctness and clarity
- Accept constructive criticism gracefully
- Put the project's goals first
- Never compromise mathematical correctness
- Always verify claims with proofs or citations
- Acknowledge limitations and assumptions
- Be transparent about precision and error bounds
By contributing, you agree that your contributions will be licensed under the MIT License.
Your contributions are helping advance mathematical research on one of the most important unsolved problems in mathematics. Every improvement, no matter how small, brings us closer to validating the Reid-Li Criterion.
"Pure mathematics is, in its way, the poetry of logical ideas." - Albert Einstein