Skip to content

Scarfinos matrix exponentiation #12388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Prev Previous commit
Update matrix_exponentiation.py
  • Loading branch information
MaximSmolskiy authored Dec 27, 2024
commit d5a423b14ae19ae72cc0d12d967d8e6d29245e49
6 changes: 2 additions & 4 deletions maths/matrix_exponentiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,13 @@ def simple_fibonacci(n, f1, f2):
elif n == 2:
return f2

fn_1 = f1
fn_2 = f2
n -= 2

while n > 0:
fn_2, fn_1 = fn_1 + fn_2, fn_2
f2, f1 = f1 + f2, f2
n -= 1

return fn_2
return f2


def matrix_exponentiation_time():
Expand Down
Loading