[Type] Introduce function to compute the determinant of any square matrix#5877
[Type] Introduce function to compute the determinant of any square matrix#5877alxbilger wants to merge 4 commits intosofa-framework:masterfrom
Conversation
| for (size_t j = 0; j < N; ++j) | ||
| { | ||
| if (j == p) continue; | ||
| submat(i - 1, colIndex++) = mat(i, j); |
There was a problem hiding this comment.
Wouldn't it be more efficient to only create a vector of col and row indices that is reduced of one element for each determinant development ? So in the end your 'submatrix' is like a view on the original matrix, instead of copying the same values multiple times ?
There was a problem hiding this comment.
I did not try to reach high performances because I don't have the need. Currently, I use it only in init().
There was a problem hiding this comment.
would your changes be easily introduced @bakpaul ?
if yes, we can add it inside this PR
else, it could be done in a later one
There was a problem hiding this comment.
Yes I think so, I just need to take time to do it. Give me one week ?
6ad8416 to
2a4b912
Compare
* Add a version without copy of the matrix content, also works with sparse matrix * Remove unwanted header
|
@bakpaul I finally changed the algorithm for a Gaussian elimination. Neither your code or mine worked on a 12x12 matrix. It hanged infinitely. I also implemented benchmarks for this function: alxbilger/SofaBenchmark#44. Here is a possible result: For small matrices, even 3x3 we are way slower than Eigen. |
|
Well it makes sense, thinking about it now, it was in n! complexity |

By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).
Reviewers will merge this pull-request only if