Uh oh!
There was an error while loading. Please reload this page.
feat: add determinant algorithm - #280
Conversation
appgurueu
left a comment
There was a problem hiding this comment.
What this essentially does is:
- Use row operations (swaps, addition of scaled multiples) to achieve an upper triangular form; keep track of number of swaps for the sign;
- Multiply the diagonal elements to find the determinant
I would ask you to factor out these two parts into two different functions or closures so this becomes more clear.
The first part in particular largely duplicates the logic in
https://github.com/TheAlgorithms/TypeScript/blob/master/maths/gaussian_elimination.ts.
It should ideally be possible to make this generic by simply having callbacks for row operations. Then both gaussian elimination and determinant computation could use the same function to achieve upper triangular form.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
cosmicproc
commented
Mar 6, 2025
The original version of this code used different functions but I wasn't sure which one would be preferred so I decided to merge them. |
Implemented a determinant algorithm by using elimination.