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_sstevr_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, float* z,
00041 lapack_int ldz, lapack_int* isuppz, float* work,
00042 lapack_int lwork, lapack_int* iwork,
00043 lapack_int liwork )
00044 {
00045 lapack_int info = 0;
00046 if( matrix_order == LAPACK_COL_MAJOR ) {
00047
00048 LAPACK_sstevr( &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 ncols_z = ( LAPACKE_lsame( range, 'a' ) ||
00056 LAPACKE_lsame( range, 'v' ) ) ? n :
00057 ( LAPACKE_lsame( range, 'i' ) ? (iu-il+1) : 1);
00058 lapack_int ldz_t = MAX(1,n);
00059 float* z_t = NULL;
00060
00061 if( ldz < ncols_z ) {
00062 info = -15;
00063 LAPACKE_xerbla( "LAPACKE_sstevr_work", info );
00064 return info;
00065 }
00066
00067 if( liwork == -1 || lwork == -1 ) {
00068 LAPACK_sstevr( &jobz, &range, &n, d, e, &vl, &vu, &il, &iu, &abstol,
00069 m, w, z, &ldz_t, isuppz, work, &lwork, iwork,
00070 &liwork, &info );
00071 return (info < 0) ? (info - 1) : info;
00072 }
00073
00074 if( LAPACKE_lsame( jobz, 'v' ) ) {
00075 z_t = (float*)
00076 LAPACKE_malloc( sizeof(float) * ldz_t * MAX(1,ncols_z) );
00077 if( z_t == NULL ) {
00078 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
00079 goto exit_level_0;
00080 }
00081 }
00082
00083 LAPACK_sstevr( &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_sge_trans( LAPACK_COL_MAJOR, n, ncols_z, z_t, ldz_t, z,
00092 ldz );
00093 }
00094
00095 if( LAPACKE_lsame( jobz, 'v' ) ) {
00096 LAPACKE_free( z_t );
00097 }
00098 exit_level_0:
00099 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
00100 LAPACKE_xerbla( "LAPACKE_sstevr_work", info );
00101 }
00102 } else {
00103 info = -1;
00104 LAPACKE_xerbla( "LAPACKE_sstevr_work", info );
00105 }
00106 return info;
00107 }