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_cstegr_work( int matrix_order, char jobz, char range,
00038 lapack_int n, float* d, float* e, float vl,
00039 float vu, lapack_int il, lapack_int iu,
00040 float abstol, lapack_int* m, float* w,
00041 lapack_complex_float* z, lapack_int ldz,
00042 lapack_int* isuppz, float* work,
00043 lapack_int lwork, lapack_int* iwork,
00044 lapack_int liwork )
00045 {
00046 lapack_int info = 0;
00047 if( matrix_order == LAPACK_COL_MAJOR ) {
00048
00049 LAPACK_cstegr( &jobz, &range, &n, d, e, &vl, &vu, &il, &iu, &abstol, m,
00050 w, z, &ldz, isuppz, work, &lwork, iwork, &liwork,
00051 &info );
00052 if( info < 0 ) {
00053 info = info - 1;
00054 }
00055 } else if( matrix_order == LAPACK_ROW_MAJOR ) {
00056 lapack_int ldz_t = MAX(1,n);
00057 lapack_complex_float* z_t = NULL;
00058
00059 if( ldz < *m ) {
00060 info = -15;
00061 LAPACKE_xerbla( "LAPACKE_cstegr_work", info );
00062 return info;
00063 }
00064
00065 if( liwork == -1 || lwork == -1 ) {
00066 LAPACK_cstegr( &jobz, &range, &n, d, e, &vl, &vu, &il, &iu, &abstol,
00067 m, w, z, &ldz_t, isuppz, work, &lwork, iwork,
00068 &liwork, &info );
00069 return (info < 0) ? (info - 1) : info;
00070 }
00071
00072 if( LAPACKE_lsame( jobz, 'v' ) ) {
00073
00074 z_t = (lapack_complex_float*)
00075 LAPACKE_malloc( sizeof(lapack_complex_float) *
00076 ldz_t * MAX(1,n) );
00077 if( z_t == NULL ) {
00078 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
00079 goto exit_level_0;
00080 }
00081 }
00082
00083 LAPACK_cstegr( &jobz, &range, &n, d, e, &vl, &vu, &il, &iu, &abstol, m,
00084 w, z_t, &ldz_t, isuppz, work, &lwork, iwork, &liwork,
00085 &info );
00086 if( info < 0 ) {
00087 info = info - 1;
00088 }
00089
00090 if( LAPACKE_lsame( jobz, 'v' ) ) {
00091 LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, *m, z_t, ldz_t, z, ldz );
00092 }
00093
00094 if( LAPACKE_lsame( jobz, 'v' ) ) {
00095 LAPACKE_free( z_t );
00096 }
00097 exit_level_0:
00098 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
00099 LAPACKE_xerbla( "LAPACKE_cstegr_work", info );
00100 }
00101 } else {
00102 info = -1;
00103 LAPACKE_xerbla( "LAPACKE_cstegr_work", info );
00104 }
00105 return info;
00106 }