This is a simple (yet hopefully) fast implementation of the Fibonacci sequence in Python using Jax with matrix exponentiation.
The justification (explanation) and analysis of the method in the notebook /notebooks/explanation.ipynb
Also we show how the Jax implementation is faster than alternative implementations in the notebook /notebooks/efficient_implementation.ipynb.
Finally the clean implementation is in the file (/src/matrix_exponentiation.py).
To run the code you need to install Jax. You can do this by running the following command:
pip install jax[cpu]