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_dtbrfs_work( int matrix_order, char uplo, char trans,
00038 char diag, lapack_int n, lapack_int kd,
00039 lapack_int nrhs, const double* ab,
00040 lapack_int ldab, const double* b,
00041 lapack_int ldb, const double* x, lapack_int ldx,
00042 double* ferr, double* berr, double* work,
00043 lapack_int* iwork )
00044 {
00045 lapack_int info = 0;
00046 if( matrix_order == LAPACK_COL_MAJOR ) {
00047
00048 LAPACK_dtbrfs( &uplo, &trans, &diag, &n, &kd, &nrhs, ab, &ldab, b, &ldb,
00049 x, &ldx, ferr, berr, work, iwork, &info );
00050 if( info < 0 ) {
00051 info = info - 1;
00052 }
00053 } else if( matrix_order == LAPACK_ROW_MAJOR ) {
00054 lapack_int ldab_t = MAX(1,kd+1);
00055 lapack_int ldb_t = MAX(1,n);
00056 lapack_int ldx_t = MAX(1,n);
00057 double* ab_t = NULL;
00058 double* b_t = NULL;
00059 double* x_t = NULL;
00060
00061 if( ldab < n ) {
00062 info = -9;
00063 LAPACKE_xerbla( "LAPACKE_dtbrfs_work", info );
00064 return info;
00065 }
00066 if( ldb < nrhs ) {
00067 info = -11;
00068 LAPACKE_xerbla( "LAPACKE_dtbrfs_work", info );
00069 return info;
00070 }
00071 if( ldx < nrhs ) {
00072 info = -13;
00073 LAPACKE_xerbla( "LAPACKE_dtbrfs_work", info );
00074 return info;
00075 }
00076
00077 ab_t = (double*)LAPACKE_malloc( sizeof(double) * ldab_t * MAX(1,n) );
00078 if( ab_t == NULL ) {
00079 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
00080 goto exit_level_0;
00081 }
00082 b_t = (double*)LAPACKE_malloc( sizeof(double) * ldb_t * MAX(1,nrhs) );
00083 if( b_t == NULL ) {
00084 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
00085 goto exit_level_1;
00086 }
00087 x_t = (double*)LAPACKE_malloc( sizeof(double) * ldx_t * MAX(1,nrhs) );
00088 if( x_t == NULL ) {
00089 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
00090 goto exit_level_2;
00091 }
00092
00093 LAPACKE_dtb_trans( matrix_order, uplo, diag, n, kd, ab, ldab, ab_t,
00094 ldab_t );
00095 LAPACKE_dge_trans( matrix_order, n, nrhs, b, ldb, b_t, ldb_t );
00096 LAPACKE_dge_trans( matrix_order, n, nrhs, x, ldx, x_t, ldx_t );
00097
00098 LAPACK_dtbrfs( &uplo, &trans, &diag, &n, &kd, &nrhs, ab_t, &ldab_t, b_t,
00099 &ldb_t, x_t, &ldx_t, ferr, berr, work, iwork, &info );
00100 if( info < 0 ) {
00101 info = info - 1;
00102 }
00103
00104 LAPACKE_free( x_t );
00105 exit_level_2:
00106 LAPACKE_free( b_t );
00107 exit_level_1:
00108 LAPACKE_free( ab_t );
00109 exit_level_0:
00110 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
00111 LAPACKE_xerbla( "LAPACKE_dtbrfs_work", info );
00112 }
00113 } else {
00114 info = -1;
00115 LAPACKE_xerbla( "LAPACKE_dtbrfs_work", info );
00116 }
00117 return info;
00118 }