v0.7.0 - Complex Number Support #25

Merged
jono merged 8 commits from v0.7.0 into main 2026-01-31 15:31:57 +00:00

8 Commits

Author SHA1 Message Date
401b8e953e Complex Technical Paper now formatted like the original
All checks were successful
Run Python Tests / test (3.12) (pull_request) Successful in 54s
Run Python Tests / test (3.10) (pull_request) Successful in 1m20s
Run Python Tests / test (3.8) (pull_request) Successful in 16s
2026-01-31 11:18:16 -04:00
7547bfd45e Added Technical Paper for Complex Updates 2026-01-31 10:50:44 -04:00
96f2ed409e Update README.md 2026-01-29 17:50:10 -04:00
90b911d5a5 fix: Implemented Relative Mutation 2026-01-29 17:35:14 -04:00
b87ea5011c Improved deprecation warning for min/max_range 2025-12-06 08:52:44 -04:00
117e43a984 Standardize root outputs as numpy arrays. 2025-12-06 08:49:35 -04:00
b415df2983 feat: add complex root finding and dynamic CUDA shared memory optimization
Major update extending the library to solve for complex roots and optimizing GPU performance using Shared Memory.

Complex Number Support:
- Implemented `_solve_complex_cuda` and `_solve_complex_numpy` to find roots in the complex plane.
- Added specialized CUDA kernels (`_FITNESS_KERNEL_COMPLEX`, `_FITNESS_KERNEL_COMPLEX_DYNAMIC`) handling complex arithmetic (multiplication/addition) directly on the GPU.
- Updated `Function` class and `set_coeffs` to handle `np.complex128` data types.
- Updated `quadratic_solve` to return complex roots using `cmath`.

CUDA Performance & Optimization:
- Implemented Dynamic Shared Memory kernels (`extern __shared__`) to cache polynomial coefficients on the GPU block, significantly reducing global memory latency.
- Added intelligent fallback logic: The solver checks `MaxSharedMemoryPerBlock`. If the polynomial is too large for Shared Memory, it falls back to the standard Global Memory kernel to prevent crashes.
- Split complex coefficients into separate Real and Imaginary arrays for CUDA kernel efficiency.

Polynomial Logic:
- Added `_strip_leading_zeros` helper to ensure polynomial degree is correctly maintained after arithmetic operations (e.g., preventing `0x^2 + x` from being treated as degree 2).
- Updated `__init__` to allow direct coefficient injection.

GA Algorithm:
- Updated crossover logic to support 2D search space (Real + Imaginary) for complex solutions.
- Refined fitness function to explicitly handle `isinf`/`isnan` for numerical stability.
2025-12-05 13:47:29 -04:00
602269889b Got rid of min/max_range to exclusively use Cauchy's Bound. Updated quadratic solve to handle complex roots. 2025-11-24 15:05:13 -04:00