Go to the documentation of this file.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_cstedc( int matrix_order, char compz, lapack_int n, float* d,
00038 float* e, lapack_complex_float* z, lapack_int ldz )
00039 {
00040 lapack_int info = 0;
00041 lapack_int liwork = -1;
00042 lapack_int lrwork = -1;
00043 lapack_int lwork = -1;
00044 lapack_int* iwork = NULL;
00045 float* rwork = NULL;
00046 lapack_complex_float* work = NULL;
00047 lapack_int iwork_query;
00048 float rwork_query;
00049 lapack_complex_float work_query;
00050 if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
00051 LAPACKE_xerbla( "LAPACKE_cstedc", -1 );
00052 return -1;
00053 }
00054 #ifndef LAPACK_DISABLE_NAN_CHECK
00055
00056 if( LAPACKE_s_nancheck( n, d, 1 ) ) {
00057 return -4;
00058 }
00059 if( LAPACKE_s_nancheck( n-1, e, 1 ) ) {
00060 return -5;
00061 }
00062 if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) {
00063 if( LAPACKE_cge_nancheck( matrix_order, n, n, z, ldz ) ) {
00064 return -6;
00065 }
00066 }
00067 #endif
00068
00069 info = LAPACKE_cstedc_work( matrix_order, compz, n, d, e, z, ldz,
00070 &work_query, lwork, &rwork_query, lrwork,
00071 &iwork_query, liwork );
00072 if( info != 0 ) {
00073 goto exit_level_0;
00074 }
00075 liwork = (lapack_int)iwork_query;
00076 lrwork = (lapack_int)rwork_query;
00077 lwork = LAPACK_C2INT( work_query );
00078
00079 iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
00080 if( iwork == NULL ) {
00081 info = LAPACK_WORK_MEMORY_ERROR;
00082 goto exit_level_0;
00083 }
00084 rwork = (float*)LAPACKE_malloc( sizeof(float) * lrwork );
00085 if( rwork == NULL ) {
00086 info = LAPACK_WORK_MEMORY_ERROR;
00087 goto exit_level_1;
00088 }
00089 work = (lapack_complex_float*)
00090 LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
00091 if( work == NULL ) {
00092 info = LAPACK_WORK_MEMORY_ERROR;
00093 goto exit_level_2;
00094 }
00095
00096 info = LAPACKE_cstedc_work( matrix_order, compz, n, d, e, z, ldz, work,
00097 lwork, rwork, lrwork, iwork, liwork );
00098
00099 LAPACKE_free( work );
00100 exit_level_2:
00101 LAPACKE_free( rwork );
00102 exit_level_1:
00103 LAPACKE_free( iwork );
00104 exit_level_0:
00105 if( info == LAPACK_WORK_MEMORY_ERROR ) {
00106 LAPACKE_xerbla( "LAPACKE_cstedc", info );
00107 }
00108 return info;
00109 }