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