LAPACK Archives

[Lapack] question about how to use a routine dgetri.c


Hi Carolina,

Just to follow up on Julie's email, if you master the eigensolvers of 
lapack, you will probably be able to handle the inversion subroutines. A 
(square) matrix is represented by the triplet (N, A, LDA) in all the 
subroutines. So that the same "representation" for DSYEV and DGETRI.

Just one warning, when you call DGETRI ... do not forget to call DGETRF 
first ... So simply something like:
       CALL DGETRF( M, N, A, LDA, IPIV, INFO )
       CALL DGETRI( N, A, LDA, IPIV, WORK, LWORK, INFO )
should work. If you do not call DGETRF, you will get garbage.

Cheers,
J



On Thu, 24 Feb 2011, julie langou wrote:

Carolina,yes 1D will be fine, just do a dimension of LDA*N.
The comments are coming from the Fortran LAPACK, this is why.
For info, CLAPACK has been replaced by the new?Standard C language APIs for 
LAPACK. http://netlib.org/lapack/#_standard_c_language_apis_for_lapack
LAPACKE requires to have the Fortran LAPACK library as it is just an APIs.
The move from CLAPACK to LAPACKE should go smoothly.
Sincerely,
Julie Langou
On Feb 23, 2011, at 3:49 PM, Carolina Brito wrote:

      Hello!

      I have been using clapack to obtain the eigenvalues and eigenvectors of 
a matrix and it worked quite well.
      I now need to invert a matrix and I see that the routine dgetri.c does 
it.
      However, I can t undertand the arguments of this function because the 
declaration is

      /* Subroutine */ int dgetri_(integer *n, doublereal *a, integer *lda, 
integer
      ??????? *ipiv, doublereal *work, integer *lwork, integer *info)

      and the explanation about the matrix "a" says that:

      ?A?????? (input/output) DOUBLE PRECISION array, dimension (LDA,N)??
      ??????????? On entry, the factors L and U from the factorization??
      ??????????? A = P*L*U as computed by DGETRF.??
      ??????????? On exit, if INFO = 0, the inverse of the original matrix 
A.??



      What I don t understand is that? the matrix accepted by the function is 
of the type *matA, but in the explanation of the argument says that
      the dimension is ( LDA, N)
      So how should I declare? the matrix? and pass it to? the function?

      the matrix I want to invert is a n x n matrix and I declare this as, 
let s say
      double **matA
      Should I transform this into a one dimensional matrix ?

      Thank you in advance,
      Carolina


      ?_______________________________________________
      Lapack mailing list
      Lapack@Domain.Removed
      http://lists.eecs.utk.edu/mailman/listinfo/lapack


**********************************************
Julie Langou; Research Associate in Computer Science
Innovative Computing Laboratory;
University of Tennessee from Denver, Colorado ;-)
julie@Domain.Removed;?http://www.cs.utk.edu/~julie/










<Prev in Thread] Current Thread [Next in Thread>


For additional information you may use the LAPACK/ScaLAPACK Forum.
Or one of the mailing lists, or