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