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