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