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