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