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