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_sspev_work( int matrix_order, char jobz, char uplo,
00038 lapack_int n, float* ap, float* w, float* z,
00039 lapack_int ldz, float* work )
00040 {
00041 lapack_int info = 0;
00042 if( matrix_order == LAPACK_COL_MAJOR ) {
00043
00044 LAPACK_sspev( &jobz, &uplo, &n, ap, w, z, &ldz, work, &info );
00045 if( info < 0 ) {
00046 info = info - 1;
00047 }
00048 } else if( matrix_order == LAPACK_ROW_MAJOR ) {
00049 lapack_int ldz_t = MAX(1,n);
00050 float* z_t = NULL;
00051 float* ap_t = NULL;
00052
00053 if( ldz < n ) {
00054 info = -8;
00055 LAPACKE_xerbla( "LAPACKE_sspev_work", info );
00056 return info;
00057 }
00058
00059 if( LAPACKE_lsame( jobz, 'v' ) ) {
00060 z_t = (float*)LAPACKE_malloc( sizeof(float) * ldz_t * MAX(1,n) );
00061 if( z_t == NULL ) {
00062 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
00063 goto exit_level_0;
00064 }
00065 }
00066 ap_t = (float*)
00067 LAPACKE_malloc( sizeof(float) * ( MAX(1,n) * MAX(2,n+1) ) / 2 );
00068 if( ap_t == NULL ) {
00069 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
00070 goto exit_level_1;
00071 }
00072
00073 LAPACKE_ssp_trans( matrix_order, uplo, n, ap, ap_t );
00074
00075 LAPACK_sspev( &jobz, &uplo, &n, ap_t, w, z_t, &ldz_t, work, &info );
00076 if( info < 0 ) {
00077 info = info - 1;
00078 }
00079
00080 if( LAPACKE_lsame( jobz, 'v' ) ) {
00081 LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, n, z_t, ldz_t, z, ldz );
00082 }
00083 LAPACKE_ssp_trans( LAPACK_COL_MAJOR, uplo, n, ap_t, ap );
00084
00085 LAPACKE_free( ap_t );
00086 exit_level_1:
00087 if( LAPACKE_lsame( jobz, 'v' ) ) {
00088 LAPACKE_free( z_t );
00089 }
00090 exit_level_0:
00091 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
00092 LAPACKE_xerbla( "LAPACKE_sspev_work", info );
00093 }
00094 } else {
00095 info = -1;
00096 LAPACKE_xerbla( "LAPACKE_sspev_work", info );
00097 }
00098 return info;
00099 }