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_cgeesx( int matrix_order, char jobvs, char sort,
00038 LAPACK_C_SELECT1 select, char sense, lapack_int n,
00039 lapack_complex_float* a, lapack_int lda,
00040 lapack_int* sdim, lapack_complex_float* w,
00041 lapack_complex_float* vs, lapack_int ldvs,
00042 float* rconde, float* rcondv )
00043 {
00044 lapack_int info = 0;
00045 lapack_int lwork = -1;
00046 lapack_logical* bwork = NULL;
00047 float* rwork = NULL;
00048 lapack_complex_float* work = NULL;
00049 lapack_complex_float work_query;
00050 if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
00051 LAPACKE_xerbla( "LAPACKE_cgeesx", -1 );
00052 return -1;
00053 }
00054 #ifndef LAPACK_DISABLE_NAN_CHECK
00055
00056 if( LAPACKE_cge_nancheck( matrix_order, n, n, a, lda ) ) {
00057 return -7;
00058 }
00059 #endif
00060
00061 if( LAPACKE_lsame( sort, 's' ) ) {
00062 bwork = (lapack_logical*)
00063 LAPACKE_malloc( sizeof(lapack_logical) * MAX(1,n) );
00064 if( bwork == NULL ) {
00065 info = LAPACK_WORK_MEMORY_ERROR;
00066 goto exit_level_0;
00067 }
00068 }
00069 rwork = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,n) );
00070 if( rwork == NULL ) {
00071 info = LAPACK_WORK_MEMORY_ERROR;
00072 goto exit_level_1;
00073 }
00074
00075 info = LAPACKE_cgeesx_work( matrix_order, jobvs, sort, select, sense, n, a,
00076 lda, sdim, w, vs, ldvs, rconde, rcondv,
00077 &work_query, lwork, rwork, bwork );
00078 if( info != 0 ) {
00079 goto exit_level_2;
00080 }
00081 lwork = LAPACK_C2INT( work_query );
00082
00083 work = (lapack_complex_float*)
00084 LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
00085 if( work == NULL ) {
00086 info = LAPACK_WORK_MEMORY_ERROR;
00087 goto exit_level_2;
00088 }
00089
00090 info = LAPACKE_cgeesx_work( matrix_order, jobvs, sort, select, sense, n, a,
00091 lda, sdim, w, vs, ldvs, rconde, rcondv, work,
00092 lwork, rwork, bwork );
00093
00094 LAPACKE_free( work );
00095 exit_level_2:
00096 LAPACKE_free( rwork );
00097 exit_level_1:
00098 if( LAPACKE_lsame( sort, 's' ) ) {
00099 LAPACKE_free( bwork );
00100 }
00101 exit_level_0:
00102 if( info == LAPACK_WORK_MEMORY_ERROR ) {
00103 LAPACKE_xerbla( "LAPACKE_cgeesx", info );
00104 }
00105 return info;
00106 }