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_cgbbrd_work( int matrix_order, char vect, lapack_int m,
00038 lapack_int n, lapack_int ncc, lapack_int kl,
00039 lapack_int ku, lapack_complex_float* ab,
00040 lapack_int ldab, float* d, float* e,
00041 lapack_complex_float* q, lapack_int ldq,
00042 lapack_complex_float* pt, lapack_int ldpt,
00043 lapack_complex_float* c, lapack_int ldc,
00044 lapack_complex_float* work, float* rwork )
00045 {
00046 lapack_int info = 0;
00047 if( matrix_order == LAPACK_COL_MAJOR ) {
00048
00049 LAPACK_cgbbrd( &vect, &m, &n, &ncc, &kl, &ku, ab, &ldab, d, e, q, &ldq,
00050 pt, &ldpt, c, &ldc, work, rwork, &info );
00051 if( info < 0 ) {
00052 info = info - 1;
00053 }
00054 } else if( matrix_order == LAPACK_ROW_MAJOR ) {
00055 lapack_int ldab_t = MAX(1,kl+ku+1);
00056 lapack_int ldc_t = MAX(1,m);
00057 lapack_int ldpt_t = MAX(1,n);
00058 lapack_int ldq_t = MAX(1,m);
00059 lapack_complex_float* ab_t = NULL;
00060 lapack_complex_float* q_t = NULL;
00061 lapack_complex_float* pt_t = NULL;
00062 lapack_complex_float* c_t = NULL;
00063
00064 if( ldab < n ) {
00065 info = -9;
00066 LAPACKE_xerbla( "LAPACKE_cgbbrd_work", info );
00067 return info;
00068 }
00069 if( ldc < ncc ) {
00070 info = -17;
00071 LAPACKE_xerbla( "LAPACKE_cgbbrd_work", info );
00072 return info;
00073 }
00074 if( ldpt < n ) {
00075 info = -15;
00076 LAPACKE_xerbla( "LAPACKE_cgbbrd_work", info );
00077 return info;
00078 }
00079 if( ldq < m ) {
00080 info = -13;
00081 LAPACKE_xerbla( "LAPACKE_cgbbrd_work", info );
00082 return info;
00083 }
00084
00085 ab_t = (lapack_complex_float*)
00086 LAPACKE_malloc( sizeof(lapack_complex_float) * ldab_t * MAX(1,n) );
00087 if( ab_t == NULL ) {
00088 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
00089 goto exit_level_0;
00090 }
00091 if( LAPACKE_lsame( vect, 'b' ) || LAPACKE_lsame( vect, 'q' ) ) {
00092 q_t = (lapack_complex_float*)
00093 LAPACKE_malloc( sizeof(lapack_complex_float) *
00094 ldq_t * MAX(1,m) );
00095 if( q_t == NULL ) {
00096 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
00097 goto exit_level_1;
00098 }
00099 }
00100 if( LAPACKE_lsame( vect, 'b' ) || LAPACKE_lsame( vect, 'p' ) ) {
00101 pt_t = (lapack_complex_float*)
00102 LAPACKE_malloc( sizeof(lapack_complex_float) *
00103 ldpt_t * MAX(1,n) );
00104 if( pt_t == NULL ) {
00105 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
00106 goto exit_level_2;
00107 }
00108 }
00109 if( ncc != 0 ) {
00110 c_t = (lapack_complex_float*)
00111 LAPACKE_malloc( sizeof(lapack_complex_float) *
00112 ldc_t * MAX(1,ncc) );
00113 if( c_t == NULL ) {
00114 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
00115 goto exit_level_3;
00116 }
00117 }
00118
00119 LAPACKE_cgb_trans( matrix_order, m, n, kl, ku, ab, ldab, ab_t, ldab_t );
00120 if( ncc != 0 ) {
00121 LAPACKE_cge_trans( matrix_order, m, ncc, c, ldc, c_t, ldc_t );
00122 }
00123
00124 LAPACK_cgbbrd( &vect, &m, &n, &ncc, &kl, &ku, ab_t, &ldab_t, d, e, q_t,
00125 &ldq_t, pt_t, &ldpt_t, c_t, &ldc_t, work, rwork, &info );
00126 if( info < 0 ) {
00127 info = info - 1;
00128 }
00129
00130 LAPACKE_cgb_trans( LAPACK_COL_MAJOR, m, n, kl, ku, ab_t, ldab_t, ab,
00131 ldab );
00132 if( LAPACKE_lsame( vect, 'b' ) || LAPACKE_lsame( vect, 'q' ) ) {
00133 LAPACKE_cge_trans( LAPACK_COL_MAJOR, m, m, q_t, ldq_t, q, ldq );
00134 }
00135 if( LAPACKE_lsame( vect, 'b' ) || LAPACKE_lsame( vect, 'p' ) ) {
00136 LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, pt_t, ldpt_t, pt, ldpt );
00137 }
00138 if( ncc != 0 ) {
00139 LAPACKE_cge_trans( LAPACK_COL_MAJOR, m, ncc, c_t, ldc_t, c, ldc );
00140 }
00141
00142 if( ncc != 0 ) {
00143 LAPACKE_free( c_t );
00144 }
00145 exit_level_3:
00146 if( LAPACKE_lsame( vect, 'b' ) || LAPACKE_lsame( vect, 'p' ) ) {
00147 LAPACKE_free( pt_t );
00148 }
00149 exit_level_2:
00150 if( LAPACKE_lsame( vect, 'b' ) || LAPACKE_lsame( vect, 'q' ) ) {
00151 LAPACKE_free( q_t );
00152 }
00153 exit_level_1:
00154 LAPACKE_free( ab_t );
00155 exit_level_0:
00156 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
00157 LAPACKE_xerbla( "LAPACKE_cgbbrd_work", info );
00158 }
00159 } else {
00160 info = -1;
00161 LAPACKE_xerbla( "LAPACKE_cgbbrd_work", info );
00162 }
00163 return info;
00164 }