tags:

views:

273

answers:

2

What is the best (fastest) way to calculate the determinant of a (non symmetric, squared) LaMatGenDouble matrix with the lapack++ library?

A: 

I don't know about lapack++ but I'm sure there isn't in standard lapack, check. As far as I know lapack++ does not implement the matricial operation itself but uses others', actually you can switch between several of them (atlas, mkl (intel math kernel library) and so on). Therefore my assumption is that there is any determinant operation in lapack++ either.

fco.javier.sanz
Lapack++ contains all BLAS operations. There is no determinant function in BLAS, but there are probably other methods that can be used to obtain the determinant.
Peter Smit
Sorry I misunderstood your question. I deserved the bad karma :-) .
fco.javier.sanz
A: 

One way to calculate the determinant is using the LU decomposition:

  LaVectorLongInt pivots(A.cols());

  LUFactorizeIP(A, pivots);

  double detA = 1;
  for (int i = 0; i < A.cols(); ++i)
    detA *= A(i, i);

Warning, A will change, so making a copy is probably advised.

Peter Smit
I accepted this answer now as the accepted one, because no other options have been provided. If somebody adds another (good, acceptable) solution, I will accept that answer.
Peter Smit