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_strsna_work( int matrix_order, char job, char howmny,
00038 const lapack_logical* select, lapack_int n,
00039 const float* t, lapack_int ldt, const float* vl,
00040 lapack_int ldvl, const float* vr,
00041 lapack_int ldvr, float* s, float* sep,
00042 lapack_int mm, lapack_int* m, float* work,
00043 lapack_int ldwork, lapack_int* iwork )
00044 {
00045 lapack_int info = 0;
00046 if( matrix_order == LAPACK_COL_MAJOR ) {
00047
00048 LAPACK_strsna( &job, &howmny, select, &n, t, &ldt, vl, &ldvl, vr, &ldvr,
00049 s, sep, &mm, m, work, &ldwork, iwork, &info );
00050 if( info < 0 ) {
00051 info = info - 1;
00052 }
00053 } else if( matrix_order == LAPACK_ROW_MAJOR ) {
00054 lapack_int ldt_t = MAX(1,n);
00055 lapack_int ldvl_t = MAX(1,n);
00056 lapack_int ldvr_t = MAX(1,n);
00057 float* t_t = NULL;
00058 float* vl_t = NULL;
00059 float* vr_t = NULL;
00060
00061 if( ldt < n ) {
00062 info = -7;
00063 LAPACKE_xerbla( "LAPACKE_strsna_work", info );
00064 return info;
00065 }
00066 if( ldvl < mm ) {
00067 info = -9;
00068 LAPACKE_xerbla( "LAPACKE_strsna_work", info );
00069 return info;
00070 }
00071 if( ldvr < mm ) {
00072 info = -11;
00073 LAPACKE_xerbla( "LAPACKE_strsna_work", info );
00074 return info;
00075 }
00076
00077 t_t = (float*)LAPACKE_malloc( sizeof(float) * ldt_t * MAX(1,n) );
00078 if( t_t == NULL ) {
00079 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
00080 goto exit_level_0;
00081 }
00082 if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'e' ) ) {
00083 vl_t = (float*)LAPACKE_malloc( sizeof(float) * ldvl_t * MAX(1,mm) );
00084 if( vl_t == NULL ) {
00085 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
00086 goto exit_level_1;
00087 }
00088 }
00089 if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'e' ) ) {
00090 vr_t = (float*)LAPACKE_malloc( sizeof(float) * ldvr_t * MAX(1,mm) );
00091 if( vr_t == NULL ) {
00092 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
00093 goto exit_level_2;
00094 }
00095 }
00096
00097 LAPACKE_sge_trans( matrix_order, n, n, t, ldt, t_t, ldt_t );
00098 if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'e' ) ) {
00099 LAPACKE_sge_trans( matrix_order, n, mm, vl, ldvl, vl_t, ldvl_t );
00100 }
00101 if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'e' ) ) {
00102 LAPACKE_sge_trans( matrix_order, n, mm, vr, ldvr, vr_t, ldvr_t );
00103 }
00104
00105 LAPACK_strsna( &job, &howmny, select, &n, t_t, &ldt_t, vl_t, &ldvl_t,
00106 vr_t, &ldvr_t, s, sep, &mm, m, work, &ldwork, iwork,
00107 &info );
00108 if( info < 0 ) {
00109 info = info - 1;
00110 }
00111
00112 if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'e' ) ) {
00113 LAPACKE_free( vr_t );
00114 }
00115 exit_level_2:
00116 if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'e' ) ) {
00117 LAPACKE_free( vl_t );
00118 }
00119 exit_level_1:
00120 LAPACKE_free( t_t );
00121 exit_level_0:
00122 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
00123 LAPACKE_xerbla( "LAPACKE_strsna_work", info );
00124 }
00125 } else {
00126 info = -1;
00127 LAPACKE_xerbla( "LAPACKE_strsna_work", info );
00128 }
00129 return info;
00130 }