-
-
Notifications
You must be signed in to change notification settings - Fork 46.8k
Added determinate function #1429
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
""" | ||
A = Matrix([[1, 1, 4, 5], [3, 3, 3, 2], [5, 1, 9, 0], [9, 7, 7, 9]], 4, 4) | ||
self.assertEqual(-376, A.determinate()) | ||
|
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.
Please add the following function to the bottom of this file just above line 160.
def force_test() -> None:
"""
This will ensure that pytest runs the unit tests above.
>>> unittest.main()
"""
pass
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.
We can see that our tests are not being run:
https://travis-ci.com/TheAlgorithms/Python/builds/133339192#L386
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.
Added
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.
Thanks for this! A really nice addition. I commented out the test and we can fix it in #1124.
If Travis passes on my change, I will land this one.
Awesome. Sorry for the hiccups |
No problems. |
Please give some thought to #1124 (comment) |
* Added determinate function * Changed determinate function name * Changed instance of .det() to .determinate() * Added force_test() function * Update tests.py
Hi.
This is my first pull request so just let me know if there is anything else I should do. I thought the linear algebra class was missing a pretty important aspect of real valued matrices so thought it should be included.
It uses Laplace expansion to find the determinate recursively. It a pretty slow algorithm but it does the trick.