-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Added Matrix Exponentiation #1203
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking cool! A doctest or two would help https://docs.python.org/3/library/doctest.html
maths/matrix_exponentiation.py
Outdated
|
||
|
||
fibonacci_with_matrix_exponentiation(n, f1, f2) | ||
''' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For readability, simplify this to:
code = "fibonacci_with_matrix_exponentiation(randint(1,70000), 1, 1)"
maths/matrix_exponentiation.py
Outdated
''' | ||
exec_time = timeit.timeit(setup = setup, | ||
stmt = code, | ||
number = 100) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might reformat your code with https://github.com/python/black
maths/matrix_exponentiation.py
Outdated
stmt = code, | ||
number = 100) | ||
|
||
print ("Without matrix exponentiation the average execution time is ", exec_time/100) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No space between print and (. print() is a function call just like randint() is.
maths/matrix_exponentiation.py
Outdated
|
||
|
||
if __name__ == "__main__": | ||
main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 GitHub editor is telling you to add a single carriage return at the end of your file.
Implemented the changes and re-submitted the PR, have a look. |
* Added the matrix_exponentiation.py file in maths directory * Implemented the requested changes * Update matrix_exponentiation.py
Fixes #1180 Added the matrix_exponentiation.py file in maths directory