()
| 96 | |
| 97 | |
| 98 | def matrix_exponentiation_time() -> float: |
| 99 | setup = """ |
| 100 | from random import randint |
| 101 | from __main__ import fibonacci_with_matrix_exponentiation |
| 102 | """ |
| 103 | code = "fibonacci_with_matrix_exponentiation(randint(1,70000), 1, 1)" |
| 104 | exec_time = timeit.timeit(setup=setup, stmt=code, number=100) |
| 105 | print("With matrix exponentiation the average execution time is ", exec_time / 100) |
| 106 | return exec_time |
| 107 | |
| 108 | |
| 109 | def simple_fibonacci_time() -> float: |