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_dsbevd( int matrix_order, char jobz, char uplo, lapack_int n,
00038 lapack_int kd, double* ab, lapack_int ldab,
00039 double* w, double* z, lapack_int ldz )
00040 {
00041 lapack_int info = 0;
00042 lapack_int liwork = -1;
00043 lapack_int lwork = -1;
00044 lapack_int* iwork = NULL;
00045 double* work = NULL;
00046 lapack_int iwork_query;
00047 double work_query;
00048 if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
00049 LAPACKE_xerbla( "LAPACKE_dsbevd", -1 );
00050 return -1;
00051 }
00052 #ifndef LAPACK_DISABLE_NAN_CHECK
00053
00054 if( LAPACKE_dsb_nancheck( matrix_order, uplo, n, kd, ab, ldab ) ) {
00055 return -6;
00056 }
00057 #endif
00058
00059 info = LAPACKE_dsbevd_work( matrix_order, jobz, uplo, n, kd, ab, ldab, w, z,
00060 ldz, &work_query, lwork, &iwork_query, liwork );
00061 if( info != 0 ) {
00062 goto exit_level_0;
00063 }
00064 liwork = (lapack_int)iwork_query;
00065 lwork = (lapack_int)work_query;
00066
00067 iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
00068 if( iwork == NULL ) {
00069 info = LAPACK_WORK_MEMORY_ERROR;
00070 goto exit_level_0;
00071 }
00072 work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
00073 if( work == NULL ) {
00074 info = LAPACK_WORK_MEMORY_ERROR;
00075 goto exit_level_1;
00076 }
00077
00078 info = LAPACKE_dsbevd_work( matrix_order, jobz, uplo, n, kd, ab, ldab, w, z,
00079 ldz, work, lwork, iwork, liwork );
00080
00081 LAPACKE_free( work );
00082 exit_level_1:
00083 LAPACKE_free( iwork );
00084 exit_level_0:
00085 if( info == LAPACK_WORK_MEMORY_ERROR ) {
00086 LAPACKE_xerbla( "LAPACKE_dsbevd", info );
00087 }
00088 return info;
00089 }