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_sstemr( int matrix_order, char jobz, char range,
00038 lapack_int n, float* d, float* e, float vl, float vu,
00039 lapack_int il, lapack_int iu, lapack_int* m,
00040 float* w, float* z, lapack_int ldz, lapack_int nzc,
00041 lapack_int* isuppz, lapack_logical* tryrac )
00042 {
00043 lapack_int info = 0;
00044 lapack_int liwork = -1;
00045 lapack_int lwork = -1;
00046 lapack_int* iwork = NULL;
00047 float* work = NULL;
00048 lapack_int iwork_query;
00049 float work_query;
00050 if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
00051 LAPACKE_xerbla( "LAPACKE_sstemr", -1 );
00052 return -1;
00053 }
00054 #ifndef LAPACK_DISABLE_NAN_CHECK
00055
00056 if( LAPACKE_s_nancheck( n, d, 1 ) ) {
00057 return -5;
00058 }
00059 if( LAPACKE_s_nancheck( n-1, e, 1 ) ) {
00060 return -6;
00061 }
00062 if( LAPACKE_s_nancheck( 1, &vl, 1 ) ) {
00063 return -7;
00064 }
00065 if( LAPACKE_s_nancheck( 1, &vu, 1 ) ) {
00066 return -8;
00067 }
00068 #endif
00069
00070 info = LAPACKE_sstemr_work( matrix_order, jobz, range, n, d, e, vl, vu, il,
00071 iu, m, w, z, ldz, nzc, isuppz, tryrac,
00072 &work_query, lwork, &iwork_query, liwork );
00073 if( info != 0 ) {
00074 goto exit_level_0;
00075 }
00076 liwork = (lapack_int)iwork_query;
00077 lwork = (lapack_int)work_query;
00078
00079 iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
00080 if( iwork == NULL ) {
00081 info = LAPACK_WORK_MEMORY_ERROR;
00082 goto exit_level_0;
00083 }
00084 work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
00085 if( work == NULL ) {
00086 info = LAPACK_WORK_MEMORY_ERROR;
00087 goto exit_level_1;
00088 }
00089
00090 info = LAPACKE_sstemr_work( matrix_order, jobz, range, n, d, e, vl, vu, il,
00091 iu, m, w, z, ldz, nzc, isuppz, tryrac, work,
00092 lwork, iwork, liwork );
00093
00094 LAPACKE_free( work );
00095 exit_level_1:
00096 LAPACKE_free( iwork );
00097 exit_level_0:
00098 if( info == LAPACK_WORK_MEMORY_ERROR ) {
00099 LAPACKE_xerbla( "LAPACKE_sstemr", info );
00100 }
00101 return info;
00102 }