Skip to content

Comments

Add manual determinant calculator using cofactor expansion#13618

Closed
Naman-Vasudev wants to merge 10 commits intoTheAlgorithms:masterfrom
Naman-Vasudev:determinant_calculator.py
Closed

Add manual determinant calculator using cofactor expansion#13618
Naman-Vasudev wants to merge 10 commits intoTheAlgorithms:masterfrom
Naman-Vasudev:determinant_calculator.py

Conversation

@Naman-Vasudev
Copy link

Describe your change:

  • Add an algorithm

This pull request adds a manual determinant calculator for square matrices using
cofactor expansion. The implementation works for matrices of any size and supports
both integers and floats. The algorithm recursively computes minors and cofactors
to calculate the determinant.

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work.
  • This PR only changes one algorithm file.
  • All new Python files are placed inside an existing directory.
  • All function parameters and return values are annotated with type hints.
  • All functions have doctests that pass automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.

References

@algorithms-keeper algorithms-keeper bot added the require tests Tests [doctest/unittest/pytest] are required label Oct 20, 2025
Copy link

@algorithms-keeper algorithms-keeper bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

@@ -0,0 +1,70 @@
# Wikipedia URL- https://en.wikipedia.org/wiki/Determinant

def get_minor(matrix: list[list[int] | list[float]], row: int, col: int) -> list[list[int] | list[float]]:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file matrix/determinant_calculator.py, please provide doctest for the function get_minor

@algorithms-keeper algorithms-keeper bot added the awaiting reviews This PR is ready to be reviewed label Oct 20, 2025
@algorithms-keeper algorithms-keeper bot added tests are failing Do not merge until tests pass and removed require tests Tests [doctest/unittest/pytest] are required labels Oct 20, 2025
@Naman-Vasudev Naman-Vasudev reopened this Oct 20, 2025
@Naman-Vasudev Naman-Vasudev deleted the determinant_calculator.py branch October 20, 2025 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant