Page 1 of 1

Re: ZGETRI error

PostPosted: Mon Sep 15, 2008 5:56 am
by sven
Please read the documentation for ZGETRI which can be found in the LAPACK Users' Guide, or as the leading comment to the source code.

Firstly, ZGETRI has to be preceded by a call to ZGETRF in order to perform an LU factorization of the matrix A. Secondly, when you call ZGETRI with LWORK = -1, that is a workspace query - the routine simply computes the optimal size of the array WORK, which is returned in WORK(1).

Sven Hammarling.

Re: ZGETRI error

PostPosted: Tue Sep 16, 2008 5:26 am
by sven
On your second question as to "Why the decimal point error in the output of A?", that is because 0.8 is not exactly representable as a binary floating point value. By the way, a statement such as

A(1,2)=cmplx(1.0d0,0.8d0)

stores the value in single precision, even though A is declared as DOUBLE COMPLEX. If you want to store the value as double precision you need to include the optional argument 'kind' to 'cmplx'; for example

A(1,2)=cmplx(1.0d0,0.8d0,kind(1.0d0))

Sven.