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