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_zgerfsx( int matrix_order, char trans, char equed,
00038 lapack_int n, lapack_int nrhs,
00039 const lapack_complex_double* a, lapack_int lda,
00040 const lapack_complex_double* af, lapack_int ldaf,
00041 const lapack_int* ipiv, const double* r,
00042 const double* c, const lapack_complex_double* b,
00043 lapack_int ldb, lapack_complex_double* x,
00044 lapack_int ldx, double* rcond, double* berr,
00045 lapack_int n_err_bnds, double* err_bnds_norm,
00046 double* err_bnds_comp, lapack_int nparams,
00047 double* params )
00048 {
00049 lapack_int info = 0;
00050 double* rwork = NULL;
00051 lapack_complex_double* work = NULL;
00052 if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
00053 LAPACKE_xerbla( "LAPACKE_zgerfsx", -1 );
00054 return -1;
00055 }
00056 #ifndef LAPACK_DISABLE_NAN_CHECK
00057
00058 if( LAPACKE_zge_nancheck( matrix_order, n, n, a, lda ) ) {
00059 return -6;
00060 }
00061 if( LAPACKE_zge_nancheck( matrix_order, n, n, af, ldaf ) ) {
00062 return -8;
00063 }
00064 if( LAPACKE_zge_nancheck( matrix_order, n, nrhs, b, ldb ) ) {
00065 return -13;
00066 }
00067 if( LAPACKE_lsame( equed, 'b' ) || LAPACKE_lsame( equed, 'c' ) ) {
00068 if( LAPACKE_d_nancheck( n, c, 1 ) ) {
00069 return -12;
00070 }
00071 }
00072 if( nparams>0 ) {
00073 if( LAPACKE_d_nancheck( nparams, params, 1 ) ) {
00074 return -23;
00075 }
00076 }
00077 if( LAPACKE_lsame( equed, 'b' ) || LAPACKE_lsame( equed, 'r' ) ) {
00078 if( LAPACKE_d_nancheck( n, r, 1 ) ) {
00079 return -11;
00080 }
00081 }
00082 if( LAPACKE_zge_nancheck( matrix_order, n, nrhs, x, ldx ) ) {
00083 return -15;
00084 }
00085 #endif
00086
00087 rwork = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,3*n) );
00088 if( rwork == NULL ) {
00089 info = LAPACK_WORK_MEMORY_ERROR;
00090 goto exit_level_0;
00091 }
00092 work = (lapack_complex_double*)
00093 LAPACKE_malloc( sizeof(lapack_complex_double) * MAX(1,2*n) );
00094 if( work == NULL ) {
00095 info = LAPACK_WORK_MEMORY_ERROR;
00096 goto exit_level_1;
00097 }
00098
00099 info = LAPACKE_zgerfsx_work( matrix_order, trans, equed, n, nrhs, a, lda,
00100 af, ldaf, ipiv, r, c, b, ldb, x, ldx, rcond,
00101 berr, n_err_bnds, err_bnds_norm, err_bnds_comp,
00102 nparams, params, work, rwork );
00103
00104 LAPACKE_free( work );
00105 exit_level_1:
00106 LAPACKE_free( rwork );
00107 exit_level_0:
00108 if( info == LAPACK_WORK_MEMORY_ERROR ) {
00109 LAPACKE_xerbla( "LAPACKE_zgerfsx", info );
00110 }
00111 return info;
00112 }