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_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, float* z,
00041 lapack_int ldz, lapack_int nzc,
00042 lapack_int* isuppz, lapack_logical* tryrac,
00043 float* work, lapack_int lwork,
00044 lapack_int* iwork, lapack_int liwork )
00045 {
00046 lapack_int info = 0;
00047 if( matrix_order == LAPACK_COL_MAJOR ) {
00048
00049 LAPACK_sstemr( &jobz, &range, &n, d, e, &vl, &vu, &il, &iu, m, w, z,
00050 &ldz, &nzc, isuppz, tryrac, 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 float* z_t = NULL;
00058
00059 if( ldz < n ) {
00060 info = -14;
00061 LAPACKE_xerbla( "LAPACKE_sstemr_work", info );
00062 return info;
00063 }
00064
00065 if( liwork == -1 || lwork == -1 ) {
00066 LAPACK_sstemr( &jobz, &range, &n, d, e, &vl, &vu, &il, &iu, m, w, z,
00067 &ldz_t, &nzc, isuppz, tryrac, work, &lwork, iwork,
00068 &liwork, &info );
00069 return (info < 0) ? (info - 1) : info;
00070 }
00071
00072 if( LAPACKE_lsame( jobz, 'v' ) ) {
00073 z_t = (float*)LAPACKE_malloc( sizeof(float) * 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_sstemr( &jobz, &range, &n, d, e, &vl, &vu, &il, &iu, m, w, z_t,
00081 &ldz_t, &nzc, isuppz, tryrac, work, &lwork, iwork,
00082 &liwork, &info );
00083 if( info < 0 ) {
00084 info = info - 1;
00085 }
00086
00087 if( LAPACKE_lsame( jobz, 'v' ) ) {
00088 LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, n, 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_sstemr_work", info );
00097 }
00098 } else {
00099 info = -1;
00100 LAPACKE_xerbla( "LAPACKE_sstemr_work", info );
00101 }
00102 return info;
00103 }