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_zhgeqz( int matrix_order, char job, char compq, char compz,
00038 lapack_int n, lapack_int ilo, lapack_int ihi,
00039 lapack_complex_double* h, lapack_int ldh,
00040 lapack_complex_double* t, lapack_int ldt,
00041 lapack_complex_double* alpha,
00042 lapack_complex_double* beta,
00043 lapack_complex_double* q, lapack_int ldq,
00044 lapack_complex_double* z, lapack_int ldz )
00045 {
00046 lapack_int info = 0;
00047 lapack_int lwork = -1;
00048 double* rwork = NULL;
00049 lapack_complex_double* work = NULL;
00050 lapack_complex_double work_query;
00051 if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
00052 LAPACKE_xerbla( "LAPACKE_zhgeqz", -1 );
00053 return -1;
00054 }
00055 #ifndef LAPACK_DISABLE_NAN_CHECK
00056
00057 if( LAPACKE_zge_nancheck( matrix_order, n, n, h, ldh ) ) {
00058 return -8;
00059 }
00060 if( LAPACKE_lsame( compq, 'i' ) || LAPACKE_lsame( compq, 'v' ) ) {
00061 if( LAPACKE_zge_nancheck( matrix_order, n, n, q, ldq ) ) {
00062 return -14;
00063 }
00064 }
00065 if( LAPACKE_zge_nancheck( matrix_order, n, n, t, ldt ) ) {
00066 return -10;
00067 }
00068 if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) {
00069 if( LAPACKE_zge_nancheck( matrix_order, n, n, z, ldz ) ) {
00070 return -16;
00071 }
00072 }
00073 #endif
00074
00075 rwork = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,n) );
00076 if( rwork == NULL ) {
00077 info = LAPACK_WORK_MEMORY_ERROR;
00078 goto exit_level_0;
00079 }
00080
00081 info = LAPACKE_zhgeqz_work( matrix_order, job, compq, compz, n, ilo, ihi, h,
00082 ldh, t, ldt, alpha, beta, q, ldq, z, ldz,
00083 &work_query, lwork, rwork );
00084 if( info != 0 ) {
00085 goto exit_level_1;
00086 }
00087 lwork = LAPACK_Z2INT( work_query );
00088
00089 work = (lapack_complex_double*)
00090 LAPACKE_malloc( sizeof(lapack_complex_double) * lwork );
00091 if( work == NULL ) {
00092 info = LAPACK_WORK_MEMORY_ERROR;
00093 goto exit_level_1;
00094 }
00095
00096 info = LAPACKE_zhgeqz_work( matrix_order, job, compq, compz, n, ilo, ihi, h,
00097 ldh, t, ldt, alpha, beta, q, ldq, z, ldz, work,
00098 lwork, rwork );
00099
00100 LAPACKE_free( work );
00101 exit_level_1:
00102 LAPACKE_free( rwork );
00103 exit_level_0:
00104 if( info == LAPACK_WORK_MEMORY_ERROR ) {
00105 LAPACKE_xerbla( "LAPACKE_zhgeqz", info );
00106 }
00107 return info;
00108 }