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
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #include <stdio.h>
00050 #include "lapacke.h"
00051 #include "lapacke_utils.h"
00052 #include "test_utils.h"
00053
00054 static void init_scalars_zherfs( char *uplo, lapack_int *n, lapack_int *nrhs,
00055 lapack_int *lda, lapack_int *ldaf,
00056 lapack_int *ldb, lapack_int *ldx );
00057 static void init_a( lapack_int size, lapack_complex_double *a );
00058 static void init_af( lapack_int size, lapack_complex_double *af );
00059 static void init_ipiv( lapack_int size, lapack_int *ipiv );
00060 static void init_b( lapack_int size, lapack_complex_double *b );
00061 static void init_x( lapack_int size, lapack_complex_double *x );
00062 static void init_ferr( lapack_int size, double *ferr );
00063 static void init_berr( lapack_int size, double *berr );
00064 static void init_work( lapack_int size, lapack_complex_double *work );
00065 static void init_rwork( lapack_int size, double *rwork );
00066 static int compare_zherfs( lapack_complex_double *x, lapack_complex_double *x_i,
00067 double *ferr, double *ferr_i, double *berr,
00068 double *berr_i, lapack_int info, lapack_int info_i,
00069 lapack_int ldx, lapack_int nrhs );
00070
00071 int main(void)
00072 {
00073
00074 char uplo, uplo_i;
00075 lapack_int n, n_i;
00076 lapack_int nrhs, nrhs_i;
00077 lapack_int lda, lda_i;
00078 lapack_int lda_r;
00079 lapack_int ldaf, ldaf_i;
00080 lapack_int ldaf_r;
00081 lapack_int ldb, ldb_i;
00082 lapack_int ldb_r;
00083 lapack_int ldx, ldx_i;
00084 lapack_int ldx_r;
00085 lapack_int info, info_i;
00086 lapack_int i;
00087 int failed;
00088
00089
00090 lapack_complex_double *a = NULL, *a_i = NULL;
00091 lapack_complex_double *af = NULL, *af_i = NULL;
00092 lapack_int *ipiv = NULL, *ipiv_i = NULL;
00093 lapack_complex_double *b = NULL, *b_i = NULL;
00094 lapack_complex_double *x = NULL, *x_i = NULL;
00095 double *ferr = NULL, *ferr_i = NULL;
00096 double *berr = NULL, *berr_i = NULL;
00097 lapack_complex_double *work = NULL, *work_i = NULL;
00098 double *rwork = NULL, *rwork_i = NULL;
00099 lapack_complex_double *x_save = NULL;
00100 double *ferr_save = NULL;
00101 double *berr_save = NULL;
00102 lapack_complex_double *a_r = NULL;
00103 lapack_complex_double *af_r = NULL;
00104 lapack_complex_double *b_r = NULL;
00105 lapack_complex_double *x_r = NULL;
00106
00107
00108 init_scalars_zherfs( &uplo, &n, &nrhs, &lda, &ldaf, &ldb, &ldx );
00109 lda_r = n+2;
00110 ldaf_r = n+2;
00111 ldb_r = nrhs+2;
00112 ldx_r = nrhs+2;
00113 uplo_i = uplo;
00114 n_i = n;
00115 nrhs_i = nrhs;
00116 lda_i = lda;
00117 ldaf_i = ldaf;
00118 ldb_i = ldb;
00119 ldx_i = ldx;
00120
00121
00122 a = (lapack_complex_double *)
00123 LAPACKE_malloc( lda*n * sizeof(lapack_complex_double) );
00124 af = (lapack_complex_double *)
00125 LAPACKE_malloc( ldaf*n * sizeof(lapack_complex_double) );
00126 ipiv = (lapack_int *)LAPACKE_malloc( n * sizeof(lapack_int) );
00127 b = (lapack_complex_double *)
00128 LAPACKE_malloc( ldb*nrhs * sizeof(lapack_complex_double) );
00129 x = (lapack_complex_double *)
00130 LAPACKE_malloc( ldx*nrhs * sizeof(lapack_complex_double) );
00131 ferr = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00132 berr = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00133 work = (lapack_complex_double *)
00134 LAPACKE_malloc( 2*n * sizeof(lapack_complex_double) );
00135 rwork = (double *)LAPACKE_malloc( n * sizeof(double) );
00136
00137
00138 a_i = (lapack_complex_double *)
00139 LAPACKE_malloc( lda*n * sizeof(lapack_complex_double) );
00140 af_i = (lapack_complex_double *)
00141 LAPACKE_malloc( ldaf*n * sizeof(lapack_complex_double) );
00142 ipiv_i = (lapack_int *)LAPACKE_malloc( n * sizeof(lapack_int) );
00143 b_i = (lapack_complex_double *)
00144 LAPACKE_malloc( ldb*nrhs * sizeof(lapack_complex_double) );
00145 x_i = (lapack_complex_double *)
00146 LAPACKE_malloc( ldx*nrhs * sizeof(lapack_complex_double) );
00147 ferr_i = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00148 berr_i = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00149 work_i = (lapack_complex_double *)
00150 LAPACKE_malloc( 2*n * sizeof(lapack_complex_double) );
00151 rwork_i = (double *)LAPACKE_malloc( n * sizeof(double) );
00152
00153
00154 x_save = (lapack_complex_double *)
00155 LAPACKE_malloc( ldx*nrhs * sizeof(lapack_complex_double) );
00156 ferr_save = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00157 berr_save = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00158
00159
00160 a_r = (lapack_complex_double *)
00161 LAPACKE_malloc( n*(n+2) * sizeof(lapack_complex_double) );
00162 af_r = (lapack_complex_double *)
00163 LAPACKE_malloc( n*(n+2) * sizeof(lapack_complex_double) );
00164 b_r = (lapack_complex_double *)
00165 LAPACKE_malloc( n*(nrhs+2) * sizeof(lapack_complex_double) );
00166 x_r = (lapack_complex_double *)
00167 LAPACKE_malloc( n*(nrhs+2) * sizeof(lapack_complex_double) );
00168
00169
00170 init_a( lda*n, a );
00171 init_af( ldaf*n, af );
00172 init_ipiv( n, ipiv );
00173 init_b( ldb*nrhs, b );
00174 init_x( ldx*nrhs, x );
00175 init_ferr( nrhs, ferr );
00176 init_berr( nrhs, berr );
00177 init_work( 2*n, work );
00178 init_rwork( n, rwork );
00179
00180
00181 for( i = 0; i < ldx*nrhs; i++ ) {
00182 x_save[i] = x[i];
00183 }
00184 for( i = 0; i < nrhs; i++ ) {
00185 ferr_save[i] = ferr[i];
00186 }
00187 for( i = 0; i < nrhs; i++ ) {
00188 berr_save[i] = berr[i];
00189 }
00190
00191
00192 zherfs_( &uplo, &n, &nrhs, a, &lda, af, &ldaf, ipiv, b, &ldb, x, &ldx, ferr,
00193 berr, work, rwork, &info );
00194
00195
00196
00197 for( i = 0; i < lda*n; i++ ) {
00198 a_i[i] = a[i];
00199 }
00200 for( i = 0; i < ldaf*n; i++ ) {
00201 af_i[i] = af[i];
00202 }
00203 for( i = 0; i < n; i++ ) {
00204 ipiv_i[i] = ipiv[i];
00205 }
00206 for( i = 0; i < ldb*nrhs; i++ ) {
00207 b_i[i] = b[i];
00208 }
00209 for( i = 0; i < ldx*nrhs; i++ ) {
00210 x_i[i] = x_save[i];
00211 }
00212 for( i = 0; i < nrhs; i++ ) {
00213 ferr_i[i] = ferr_save[i];
00214 }
00215 for( i = 0; i < nrhs; i++ ) {
00216 berr_i[i] = berr_save[i];
00217 }
00218 for( i = 0; i < 2*n; i++ ) {
00219 work_i[i] = work[i];
00220 }
00221 for( i = 0; i < n; i++ ) {
00222 rwork_i[i] = rwork[i];
00223 }
00224 info_i = LAPACKE_zherfs_work( LAPACK_COL_MAJOR, uplo_i, n_i, nrhs_i, a_i,
00225 lda_i, af_i, ldaf_i, ipiv_i, b_i, ldb_i, x_i,
00226 ldx_i, ferr_i, berr_i, work_i, rwork_i );
00227
00228 failed = compare_zherfs( x, x_i, ferr, ferr_i, berr, berr_i, info, info_i,
00229 ldx, nrhs );
00230 if( failed == 0 ) {
00231 printf( "PASSED: column-major middle-level interface to zherfs\n" );
00232 } else {
00233 printf( "FAILED: column-major middle-level interface to zherfs\n" );
00234 }
00235
00236
00237
00238 for( i = 0; i < lda*n; i++ ) {
00239 a_i[i] = a[i];
00240 }
00241 for( i = 0; i < ldaf*n; i++ ) {
00242 af_i[i] = af[i];
00243 }
00244 for( i = 0; i < n; i++ ) {
00245 ipiv_i[i] = ipiv[i];
00246 }
00247 for( i = 0; i < ldb*nrhs; i++ ) {
00248 b_i[i] = b[i];
00249 }
00250 for( i = 0; i < ldx*nrhs; i++ ) {
00251 x_i[i] = x_save[i];
00252 }
00253 for( i = 0; i < nrhs; i++ ) {
00254 ferr_i[i] = ferr_save[i];
00255 }
00256 for( i = 0; i < nrhs; i++ ) {
00257 berr_i[i] = berr_save[i];
00258 }
00259 for( i = 0; i < 2*n; i++ ) {
00260 work_i[i] = work[i];
00261 }
00262 for( i = 0; i < n; i++ ) {
00263 rwork_i[i] = rwork[i];
00264 }
00265 info_i = LAPACKE_zherfs( LAPACK_COL_MAJOR, uplo_i, n_i, nrhs_i, a_i, lda_i,
00266 af_i, ldaf_i, ipiv_i, b_i, ldb_i, x_i, ldx_i,
00267 ferr_i, berr_i );
00268
00269 failed = compare_zherfs( x, x_i, ferr, ferr_i, berr, berr_i, info, info_i,
00270 ldx, nrhs );
00271 if( failed == 0 ) {
00272 printf( "PASSED: column-major high-level interface to zherfs\n" );
00273 } else {
00274 printf( "FAILED: column-major high-level interface to zherfs\n" );
00275 }
00276
00277
00278
00279 for( i = 0; i < lda*n; i++ ) {
00280 a_i[i] = a[i];
00281 }
00282 for( i = 0; i < ldaf*n; i++ ) {
00283 af_i[i] = af[i];
00284 }
00285 for( i = 0; i < n; i++ ) {
00286 ipiv_i[i] = ipiv[i];
00287 }
00288 for( i = 0; i < ldb*nrhs; i++ ) {
00289 b_i[i] = b[i];
00290 }
00291 for( i = 0; i < ldx*nrhs; i++ ) {
00292 x_i[i] = x_save[i];
00293 }
00294 for( i = 0; i < nrhs; i++ ) {
00295 ferr_i[i] = ferr_save[i];
00296 }
00297 for( i = 0; i < nrhs; i++ ) {
00298 berr_i[i] = berr_save[i];
00299 }
00300 for( i = 0; i < 2*n; i++ ) {
00301 work_i[i] = work[i];
00302 }
00303 for( i = 0; i < n; i++ ) {
00304 rwork_i[i] = rwork[i];
00305 }
00306
00307 LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, a_i, lda, a_r, n+2 );
00308 LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, af_i, ldaf, af_r, n+2 );
00309 LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, b_i, ldb, b_r, nrhs+2 );
00310 LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, x_i, ldx, x_r, nrhs+2 );
00311 info_i = LAPACKE_zherfs_work( LAPACK_ROW_MAJOR, uplo_i, n_i, nrhs_i, a_r,
00312 lda_r, af_r, ldaf_r, ipiv_i, b_r, ldb_r, x_r,
00313 ldx_r, ferr_i, berr_i, work_i, rwork_i );
00314
00315 LAPACKE_zge_trans( LAPACK_ROW_MAJOR, n, nrhs, x_r, nrhs+2, x_i, ldx );
00316
00317 failed = compare_zherfs( x, x_i, ferr, ferr_i, berr, berr_i, info, info_i,
00318 ldx, nrhs );
00319 if( failed == 0 ) {
00320 printf( "PASSED: row-major middle-level interface to zherfs\n" );
00321 } else {
00322 printf( "FAILED: row-major middle-level interface to zherfs\n" );
00323 }
00324
00325
00326
00327 for( i = 0; i < lda*n; i++ ) {
00328 a_i[i] = a[i];
00329 }
00330 for( i = 0; i < ldaf*n; i++ ) {
00331 af_i[i] = af[i];
00332 }
00333 for( i = 0; i < n; i++ ) {
00334 ipiv_i[i] = ipiv[i];
00335 }
00336 for( i = 0; i < ldb*nrhs; i++ ) {
00337 b_i[i] = b[i];
00338 }
00339 for( i = 0; i < ldx*nrhs; i++ ) {
00340 x_i[i] = x_save[i];
00341 }
00342 for( i = 0; i < nrhs; i++ ) {
00343 ferr_i[i] = ferr_save[i];
00344 }
00345 for( i = 0; i < nrhs; i++ ) {
00346 berr_i[i] = berr_save[i];
00347 }
00348 for( i = 0; i < 2*n; i++ ) {
00349 work_i[i] = work[i];
00350 }
00351 for( i = 0; i < n; i++ ) {
00352 rwork_i[i] = rwork[i];
00353 }
00354
00355
00356 LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, a_i, lda, a_r, n+2 );
00357 LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, af_i, ldaf, af_r, n+2 );
00358 LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, b_i, ldb, b_r, nrhs+2 );
00359 LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, x_i, ldx, x_r, nrhs+2 );
00360 info_i = LAPACKE_zherfs( LAPACK_ROW_MAJOR, uplo_i, n_i, nrhs_i, a_r, lda_r,
00361 af_r, ldaf_r, ipiv_i, b_r, ldb_r, x_r, ldx_r,
00362 ferr_i, berr_i );
00363
00364 LAPACKE_zge_trans( LAPACK_ROW_MAJOR, n, nrhs, x_r, nrhs+2, x_i, ldx );
00365
00366 failed = compare_zherfs( x, x_i, ferr, ferr_i, berr, berr_i, info, info_i,
00367 ldx, nrhs );
00368 if( failed == 0 ) {
00369 printf( "PASSED: row-major high-level interface to zherfs\n" );
00370 } else {
00371 printf( "FAILED: row-major high-level interface to zherfs\n" );
00372 }
00373
00374
00375 if( a != NULL ) {
00376 LAPACKE_free( a );
00377 }
00378 if( a_i != NULL ) {
00379 LAPACKE_free( a_i );
00380 }
00381 if( a_r != NULL ) {
00382 LAPACKE_free( a_r );
00383 }
00384 if( af != NULL ) {
00385 LAPACKE_free( af );
00386 }
00387 if( af_i != NULL ) {
00388 LAPACKE_free( af_i );
00389 }
00390 if( af_r != NULL ) {
00391 LAPACKE_free( af_r );
00392 }
00393 if( ipiv != NULL ) {
00394 LAPACKE_free( ipiv );
00395 }
00396 if( ipiv_i != NULL ) {
00397 LAPACKE_free( ipiv_i );
00398 }
00399 if( b != NULL ) {
00400 LAPACKE_free( b );
00401 }
00402 if( b_i != NULL ) {
00403 LAPACKE_free( b_i );
00404 }
00405 if( b_r != NULL ) {
00406 LAPACKE_free( b_r );
00407 }
00408 if( x != NULL ) {
00409 LAPACKE_free( x );
00410 }
00411 if( x_i != NULL ) {
00412 LAPACKE_free( x_i );
00413 }
00414 if( x_r != NULL ) {
00415 LAPACKE_free( x_r );
00416 }
00417 if( x_save != NULL ) {
00418 LAPACKE_free( x_save );
00419 }
00420 if( ferr != NULL ) {
00421 LAPACKE_free( ferr );
00422 }
00423 if( ferr_i != NULL ) {
00424 LAPACKE_free( ferr_i );
00425 }
00426 if( ferr_save != NULL ) {
00427 LAPACKE_free( ferr_save );
00428 }
00429 if( berr != NULL ) {
00430 LAPACKE_free( berr );
00431 }
00432 if( berr_i != NULL ) {
00433 LAPACKE_free( berr_i );
00434 }
00435 if( berr_save != NULL ) {
00436 LAPACKE_free( berr_save );
00437 }
00438 if( work != NULL ) {
00439 LAPACKE_free( work );
00440 }
00441 if( work_i != NULL ) {
00442 LAPACKE_free( work_i );
00443 }
00444 if( rwork != NULL ) {
00445 LAPACKE_free( rwork );
00446 }
00447 if( rwork_i != NULL ) {
00448 LAPACKE_free( rwork_i );
00449 }
00450
00451 return 0;
00452 }
00453
00454
00455 static void init_scalars_zherfs( char *uplo, lapack_int *n, lapack_int *nrhs,
00456 lapack_int *lda, lapack_int *ldaf,
00457 lapack_int *ldb, lapack_int *ldx )
00458 {
00459 *uplo = 'L';
00460 *n = 4;
00461 *nrhs = 2;
00462 *lda = 8;
00463 *ldaf = 8;
00464 *ldb = 8;
00465 *ldx = 8;
00466
00467 return;
00468 }
00469
00470
00471 static void init_a( lapack_int size, lapack_complex_double *a ) {
00472 lapack_int i;
00473 for( i = 0; i < size; i++ ) {
00474 a[i] = lapack_make_complex_double( 0.0, 0.0 );
00475 }
00476 a[0] = lapack_make_complex_double( -1.36000000000000010e+000,
00477 0.00000000000000000e+000 );
00478 a[8] = lapack_make_complex_double( 0.00000000000000000e+000,
00479 0.00000000000000000e+000 );
00480 a[16] = lapack_make_complex_double( 0.00000000000000000e+000,
00481 0.00000000000000000e+000 );
00482 a[24] = lapack_make_complex_double( 0.00000000000000000e+000,
00483 0.00000000000000000e+000 );
00484 a[1] = lapack_make_complex_double( 1.58000000000000010e+000,
00485 -9.00000000000000020e-001 );
00486 a[9] = lapack_make_complex_double( -8.86999999999999920e+000,
00487 0.00000000000000000e+000 );
00488 a[17] = lapack_make_complex_double( 0.00000000000000000e+000,
00489 0.00000000000000000e+000 );
00490 a[25] = lapack_make_complex_double( 0.00000000000000000e+000,
00491 0.00000000000000000e+000 );
00492 a[2] = lapack_make_complex_double( 2.21000000000000000e+000,
00493 2.09999999999999990e-001 );
00494 a[10] = lapack_make_complex_double( -1.84000000000000010e+000,
00495 2.99999999999999990e-002 );
00496 a[18] = lapack_make_complex_double( -4.62999999999999990e+000,
00497 0.00000000000000000e+000 );
00498 a[26] = lapack_make_complex_double( 0.00000000000000000e+000,
00499 0.00000000000000000e+000 );
00500 a[3] = lapack_make_complex_double( 3.91000000000000010e+000,
00501 -1.50000000000000000e+000 );
00502 a[11] = lapack_make_complex_double( -1.78000000000000000e+000,
00503 -1.17999999999999990e+000 );
00504 a[19] = lapack_make_complex_double( 1.10000000000000000e-001,
00505 -1.10000000000000000e-001 );
00506 a[27] = lapack_make_complex_double( -1.84000000000000010e+000,
00507 0.00000000000000000e+000 );
00508 }
00509 static void init_af( lapack_int size, lapack_complex_double *af ) {
00510 lapack_int i;
00511 for( i = 0; i < size; i++ ) {
00512 af[i] = lapack_make_complex_double( 0.0, 0.0 );
00513 }
00514 af[0] = lapack_make_complex_double( -1.36000000000000010e+000,
00515 0.00000000000000000e+000 );
00516 af[8] = lapack_make_complex_double( 0.00000000000000000e+000,
00517 0.00000000000000000e+000 );
00518 af[16] = lapack_make_complex_double( 0.00000000000000000e+000,
00519 0.00000000000000000e+000 );
00520 af[24] = lapack_make_complex_double( 0.00000000000000000e+000,
00521 0.00000000000000000e+000 );
00522 af[1] = lapack_make_complex_double( 3.91000000000000010e+000,
00523 -1.50000000000000000e+000 );
00524 af[9] = lapack_make_complex_double( -1.84000000000000010e+000,
00525 0.00000000000000000e+000 );
00526 af[17] = lapack_make_complex_double( 0.00000000000000000e+000,
00527 0.00000000000000000e+000 );
00528 af[25] = lapack_make_complex_double( 0.00000000000000000e+000,
00529 0.00000000000000000e+000 );
00530 af[2] = lapack_make_complex_double( 3.10028798127124030e-001,
00531 4.33302074396270180e-002 );
00532 af[10] = lapack_make_complex_double( 5.63705048650877560e-001,
00533 2.85034950151971610e-001 );
00534 af[18] = lapack_make_complex_double( -5.41762438729157920e+000,
00535 0.00000000000000000e+000 );
00536 af[26] = lapack_make_complex_double( 0.00000000000000000e+000,
00537 0.00000000000000000e+000 );
00538 af[3] = lapack_make_complex_double( -1.51812020724010200e-001,
00539 3.74295842561370500e-001 );
00540 af[11] = lapack_make_complex_double( 3.39658279960360960e-001,
00541 3.03145181135563540e-002 );
00542 af[19] = lapack_make_complex_double( 2.99724464607583510e-001,
00543 1.57826837278577770e-001 );
00544 af[27] = lapack_make_complex_double( -7.10280989580184220e+000,
00545 0.00000000000000000e+000 );
00546 }
00547 static void init_ipiv( lapack_int size, lapack_int *ipiv ) {
00548 lapack_int i;
00549 for( i = 0; i < size; i++ ) {
00550 ipiv[i] = 0;
00551 }
00552 ipiv[0] = -4;
00553 ipiv[1] = -4;
00554 ipiv[2] = 3;
00555 ipiv[3] = 4;
00556 }
00557 static void init_b( lapack_int size, lapack_complex_double *b ) {
00558 lapack_int i;
00559 for( i = 0; i < size; i++ ) {
00560 b[i] = lapack_make_complex_double( 0.0, 0.0 );
00561 }
00562 b[0] = lapack_make_complex_double( 7.79000000000000000e+000,
00563 5.48000000000000040e+000 );
00564 b[8] = lapack_make_complex_double( -3.53900000000000010e+001,
00565 1.80100000000000020e+001 );
00566 b[1] = lapack_make_complex_double( -7.70000000000000020e-001,
00567 -1.60500000000000010e+001 );
00568 b[9] = lapack_make_complex_double( 4.23000000000000040e+000,
00569 -7.00199999999999960e+001 );
00570 b[2] = lapack_make_complex_double( -9.58000000000000010e+000,
00571 3.87999999999999990e+000 );
00572 b[10] = lapack_make_complex_double( -2.47899999999999990e+001,
00573 -8.40000000000000040e+000 );
00574 b[3] = lapack_make_complex_double( 2.98000000000000000e+000,
00575 -1.01800000000000000e+001 );
00576 b[11] = lapack_make_complex_double( 2.86800000000000000e+001,
00577 -3.98900000000000010e+001 );
00578 }
00579 static void init_x( lapack_int size, lapack_complex_double *x ) {
00580 lapack_int i;
00581 for( i = 0; i < size; i++ ) {
00582 x[i] = lapack_make_complex_double( 0.0, 0.0 );
00583 }
00584 x[0] = lapack_make_complex_double( 1.00000000000000040e+000,
00585 -1.00000000000000000e+000 );
00586 x[8] = lapack_make_complex_double( 3.00000000000000270e+000,
00587 -4.00000000000000000e+000 );
00588 x[1] = lapack_make_complex_double( -1.00000000000000020e+000,
00589 2.00000000000000040e+000 );
00590 x[9] = lapack_make_complex_double( -1.00000000000000040e+000,
00591 5.00000000000000090e+000 );
00592 x[2] = lapack_make_complex_double( 3.00000000000000000e+000,
00593 -2.00000000000000040e+000 );
00594 x[10] = lapack_make_complex_double( 7.00000000000000000e+000,
00595 -2.00000000000000090e+000 );
00596 x[3] = lapack_make_complex_double( 2.00000000000000000e+000,
00597 1.00000000000000000e+000 );
00598 x[11] = lapack_make_complex_double( -7.99999999999999820e+000,
00599 6.00000000000000090e+000 );
00600 }
00601 static void init_ferr( lapack_int size, double *ferr ) {
00602 lapack_int i;
00603 for( i = 0; i < size; i++ ) {
00604 ferr[i] = 0;
00605 }
00606 }
00607 static void init_berr( lapack_int size, double *berr ) {
00608 lapack_int i;
00609 for( i = 0; i < size; i++ ) {
00610 berr[i] = 0;
00611 }
00612 }
00613 static void init_work( lapack_int size, lapack_complex_double *work ) {
00614 lapack_int i;
00615 for( i = 0; i < size; i++ ) {
00616 work[i] = lapack_make_complex_double( 0.0, 0.0 );
00617 }
00618 }
00619 static void init_rwork( lapack_int size, double *rwork ) {
00620 lapack_int i;
00621 for( i = 0; i < size; i++ ) {
00622 rwork[i] = 0;
00623 }
00624 }
00625
00626
00627
00628 static int compare_zherfs( lapack_complex_double *x, lapack_complex_double *x_i,
00629 double *ferr, double *ferr_i, double *berr,
00630 double *berr_i, lapack_int info, lapack_int info_i,
00631 lapack_int ldx, lapack_int nrhs )
00632 {
00633 lapack_int i;
00634 int failed = 0;
00635 for( i = 0; i < ldx*nrhs; i++ ) {
00636 failed += compare_complex_doubles(x[i],x_i[i]);
00637 }
00638 for( i = 0; i < nrhs; i++ ) {
00639 failed += compare_doubles(ferr[i],ferr_i[i]);
00640 }
00641 for( i = 0; i < nrhs; i++ ) {
00642 failed += compare_doubles(berr[i],berr_i[i]);
00643 }
00644 failed += (info == info_i) ? 0 : 1;
00645 if( info != 0 || info_i != 0 ) {
00646 printf( "info=%d, info_i=%d\n",(int)info,(int)info_i );
00647 }
00648
00649 return failed;
00650 }