00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include "lapacke.h"
00035 #include "lapacke_utils.h"
00036
00037 lapack_int LAPACKE_zggev( int matrix_order, char jobvl, char jobvr,
00038 lapack_int n, lapack_complex_double* a,
00039 lapack_int lda, lapack_complex_double* b,
00040 lapack_int ldb, lapack_complex_double* alpha,
00041 lapack_complex_double* beta,
00042 lapack_complex_double* vl, lapack_int ldvl,
00043 lapack_complex_double* vr, lapack_int ldvr )
00044 {
00045 lapack_int info = 0;
00046 lapack_int lwork = -1;
00047 double* rwork = NULL;
00048 lapack_complex_double* work = NULL;
00049 lapack_complex_double work_query;
00050 if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
00051 LAPACKE_xerbla( "LAPACKE_zggev", -1 );
00052 return -1;
00053 }
00054 #ifndef LAPACK_DISABLE_NAN_CHECK
00055
00056 if( LAPACKE_zge_nancheck( matrix_order, n, n, a, lda ) ) {
00057 return -5;
00058 }
00059 if( LAPACKE_zge_nancheck( matrix_order, n, n, b, ldb ) ) {
00060 return -7;
00061 }
00062 #endif
00063
00064 rwork = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,8*n) );
00065 if( rwork == NULL ) {
00066 info = LAPACK_WORK_MEMORY_ERROR;
00067 goto exit_level_0;
00068 }
00069
00070 info = LAPACKE_zggev_work( matrix_order, jobvl, jobvr, n, a, lda, b, ldb,
00071 alpha, beta, vl, ldvl, vr, ldvr, &work_query,
00072 lwork, rwork );
00073 if( info != 0 ) {
00074 goto exit_level_1;
00075 }
00076 lwork = LAPACK_Z2INT( work_query );
00077
00078 work = (lapack_complex_double*)
00079 LAPACKE_malloc( sizeof(lapack_complex_double) * lwork );
00080 if( work == NULL ) {
00081 info = LAPACK_WORK_MEMORY_ERROR;
00082 goto exit_level_1;
00083 }
00084
00085 info = LAPACKE_zggev_work( matrix_order, jobvl, jobvr, n, a, lda, b, ldb,
00086 alpha, beta, vl, ldvl, vr, ldvr, work, lwork,
00087 rwork );
00088
00089 LAPACKE_free( work );
00090 exit_level_1:
00091 LAPACKE_free( rwork );
00092 exit_level_0:
00093 if( info == LAPACK_WORK_MEMORY_ERROR ) {
00094 LAPACKE_xerbla( "LAPACKE_zggev", info );
00095 }
00096 return info;
00097 }