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_cupmtr_work( int matrix_order, char side, char uplo,
00038 char trans, lapack_int m, lapack_int n,
00039 const lapack_complex_float* ap,
00040 const lapack_complex_float* tau,
00041 lapack_complex_float* c, lapack_int ldc,
00042 lapack_complex_float* work )
00043 {
00044 lapack_int info = 0;
00045 if( matrix_order == LAPACK_COL_MAJOR ) {
00046
00047 LAPACK_cupmtr( &side, &uplo, &trans, &m, &n, ap, tau, c, &ldc, work,
00048 &info );
00049 if( info < 0 ) {
00050 info = info - 1;
00051 }
00052 } else if( matrix_order == LAPACK_ROW_MAJOR ) {
00053 lapack_int r = LAPACKE_lsame( side, 'l' ) ? m : n;
00054 lapack_int ldc_t = MAX(1,m);
00055 lapack_complex_float* c_t = NULL;
00056 lapack_complex_float* ap_t = NULL;
00057
00058 if( ldc < n ) {
00059 info = -10;
00060 LAPACKE_xerbla( "LAPACKE_cupmtr_work", info );
00061 return info;
00062 }
00063
00064 c_t = (lapack_complex_float*)
00065 LAPACKE_malloc( sizeof(lapack_complex_float) * ldc_t * MAX(1,n) );
00066 if( c_t == NULL ) {
00067 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
00068 goto exit_level_0;
00069 }
00070 ap_t = (lapack_complex_float*)
00071 LAPACKE_malloc( sizeof(lapack_complex_float) *
00072 ( MAX(1,r) * MAX(2,r+1) ) / 2 );
00073 if( ap_t == NULL ) {
00074 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
00075 goto exit_level_1;
00076 }
00077
00078 LAPACKE_cge_trans( matrix_order, m, n, c, ldc, c_t, ldc_t );
00079 LAPACKE_cpp_trans( matrix_order, uplo, r, ap, ap_t );
00080
00081 LAPACK_cupmtr( &side, &uplo, &trans, &m, &n, ap_t, tau, c_t, &ldc_t,
00082 work, &info );
00083 if( info < 0 ) {
00084 info = info - 1;
00085 }
00086
00087 LAPACKE_cge_trans( LAPACK_COL_MAJOR, m, n, c_t, ldc_t, c, ldc );
00088
00089 LAPACKE_free( ap_t );
00090 exit_level_1:
00091 LAPACKE_free( c_t );
00092 exit_level_0:
00093 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
00094 LAPACKE_xerbla( "LAPACKE_cupmtr_work", info );
00095 }
00096 } else {
00097 info = -1;
00098 LAPACKE_xerbla( "LAPACKE_cupmtr_work", info );
00099 }
00100 return info;
00101 }