Re: Matrix determinant
Gunter Winkler <[email protected]>
| Newsgroups | gmane.comp.lib.mtl.devel |
|---|---|
| Message-ID | <[email protected]> |
On Friday, 30. August 2002 08:49, you wrote: > Hi, > > I am trying to calculate the determinant of a matrix in MTL > and cant seem to find any functions to do this. > > Is this possible in MTL, if so, how ? Usually you have to do an LU-factorisation and multiply the diagonal elements of U (because L has ones on the diagonal). Currently MTL has an lu_factor(A,pivot) for dense matrices and returns LU factors with pivoting. If you are instrested in the correct sign of the determinant you have to calculate det(P) which is +1 if the number of inversions (*) is even and -1 if this number is odd. Basicly you use det(P*L*U)=det(P)*det(L)*det(U) (*) An inversion means pvector[i]>i. regards Gunter Winkler PS: How about a mtl-user mailing list? _______________________________________________ This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/