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_zhbevx( int matrix_order, char jobz, char range, char uplo,
00038 lapack_int n, lapack_int kd,
00039 lapack_complex_double* ab, lapack_int ldab,
00040 lapack_complex_double* q, lapack_int ldq, double vl,
00041 double vu, lapack_int il, lapack_int iu,
00042 double abstol, lapack_int* m, double* w,
00043 lapack_complex_double* z, lapack_int ldz,
00044 lapack_int* ifail )
00045 {
00046 lapack_int info = 0;
00047 lapack_int* iwork = NULL;
00048 double* rwork = NULL;
00049 lapack_complex_double* work = NULL;
00050 if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
00051 LAPACKE_xerbla( "LAPACKE_zhbevx", -1 );
00052 return -1;
00053 }
00054 #ifndef LAPACK_DISABLE_NAN_CHECK
00055
00056 if( LAPACKE_zhb_nancheck( matrix_order, uplo, n, kd, ab, ldab ) ) {
00057 return -7;
00058 }
00059 if( LAPACKE_d_nancheck( 1, &abstol, 1 ) ) {
00060 return -15;
00061 }
00062 if( LAPACKE_lsame( range, 'v' ) ) {
00063 if( LAPACKE_d_nancheck( 1, &vl, 1 ) ) {
00064 return -11;
00065 }
00066 }
00067 if( LAPACKE_lsame( range, 'v' ) ) {
00068 if( LAPACKE_d_nancheck( 1, &vu, 1 ) ) {
00069 return -12;
00070 }
00071 }
00072 #endif
00073
00074 iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,5*n) );
00075 if( iwork == NULL ) {
00076 info = LAPACK_WORK_MEMORY_ERROR;
00077 goto exit_level_0;
00078 }
00079 rwork = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,7*n) );
00080 if( rwork == NULL ) {
00081 info = LAPACK_WORK_MEMORY_ERROR;
00082 goto exit_level_1;
00083 }
00084 work = (lapack_complex_double*)
00085 LAPACKE_malloc( sizeof(lapack_complex_double) * MAX(1,n) );
00086 if( work == NULL ) {
00087 info = LAPACK_WORK_MEMORY_ERROR;
00088 goto exit_level_2;
00089 }
00090
00091 info = LAPACKE_zhbevx_work( matrix_order, jobz, range, uplo, n, kd, ab,
00092 ldab, q, ldq, vl, vu, il, iu, abstol, m, w, z,
00093 ldz, work, rwork, iwork, ifail );
00094
00095 LAPACKE_free( work );
00096 exit_level_2:
00097 LAPACKE_free( rwork );
00098 exit_level_1:
00099 LAPACKE_free( iwork );
00100 exit_level_0:
00101 if( info == LAPACK_WORK_MEMORY_ERROR ) {
00102 LAPACKE_xerbla( "LAPACKE_zhbevx", info );
00103 }
00104 return info;
00105 }