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_cstemr_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 lapack_int* m, float* w,
00041 lapack_complex_float* z, lapack_int ldz,
00042 lapack_int nzc, lapack_int* isuppz,
00043 lapack_logical* tryrac, float* work,
00044 lapack_int lwork, lapack_int* iwork,
00045 lapack_int liwork )
00046 {
00047 lapack_int info = 0;
00048 if( matrix_order == LAPACK_COL_MAJOR ) {
00049
00050 LAPACK_cstemr( &jobz, &range, &n, d, e, &vl, &vu, &il, &iu, m, w, z,
00051 &ldz, &nzc, isuppz, tryrac, work, &lwork, iwork, &liwork,
00052 &info );
00053 if( info < 0 ) {
00054 info = info - 1;
00055 }
00056 } else if( matrix_order == LAPACK_ROW_MAJOR ) {
00057 lapack_int ldz_t = MAX(1,n);
00058 lapack_complex_float* z_t = NULL;
00059
00060 if( ldz < n ) {
00061 info = -14;
00062 LAPACKE_xerbla( "LAPACKE_cstemr_work", info );
00063 return info;
00064 }
00065
00066 if( liwork == -1 || lwork == -1 ) {
00067 LAPACK_cstemr( &jobz, &range, &n, d, e, &vl, &vu, &il, &iu, m, w, z,
00068 &ldz_t, &nzc, isuppz, tryrac, work, &lwork, iwork,
00069 &liwork, &info );
00070 return (info < 0) ? (info - 1) : info;
00071 }
00072
00073 if( LAPACKE_lsame( jobz, 'v' ) ) {
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_cstemr( &jobz, &range, &n, d, e, &vl, &vu, &il, &iu, m, w, z_t,
00084 &ldz_t, &nzc, isuppz, tryrac, work, &lwork, iwork,
00085 &liwork, &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, n, 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_cstemr_work", info );
00100 }
00101 } else {
00102 info = -1;
00103 LAPACKE_xerbla( "LAPACKE_cstemr_work", info );
00104 }
00105 return info;
00106 }