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_cgerfs( char *trans, 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_float *a );
00058 static void init_af( lapack_int size, lapack_complex_float *af );
00059 static void init_ipiv( lapack_int size, lapack_int *ipiv );
00060 static void init_b( lapack_int size, lapack_complex_float *b );
00061 static void init_x( lapack_int size, lapack_complex_float *x );
00062 static void init_ferr( lapack_int size, float *ferr );
00063 static void init_berr( lapack_int size, float *berr );
00064 static void init_work( lapack_int size, lapack_complex_float *work );
00065 static void init_rwork( lapack_int size, float *rwork );
00066 static int compare_cgerfs( lapack_complex_float *x, lapack_complex_float *x_i,
00067 float *ferr, float *ferr_i, float *berr,
00068 float *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 trans, trans_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_float *a = NULL, *a_i = NULL;
00091 lapack_complex_float *af = NULL, *af_i = NULL;
00092 lapack_int *ipiv = NULL, *ipiv_i = NULL;
00093 lapack_complex_float *b = NULL, *b_i = NULL;
00094 lapack_complex_float *x = NULL, *x_i = NULL;
00095 float *ferr = NULL, *ferr_i = NULL;
00096 float *berr = NULL, *berr_i = NULL;
00097 lapack_complex_float *work = NULL, *work_i = NULL;
00098 float *rwork = NULL, *rwork_i = NULL;
00099 lapack_complex_float *x_save = NULL;
00100 float *ferr_save = NULL;
00101 float *berr_save = NULL;
00102 lapack_complex_float *a_r = NULL;
00103 lapack_complex_float *af_r = NULL;
00104 lapack_complex_float *b_r = NULL;
00105 lapack_complex_float *x_r = NULL;
00106
00107
00108 init_scalars_cgerfs( &trans, &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 trans_i = trans;
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_float *)
00123 LAPACKE_malloc( lda*n * sizeof(lapack_complex_float) );
00124 af = (lapack_complex_float *)
00125 LAPACKE_malloc( ldaf*n * sizeof(lapack_complex_float) );
00126 ipiv = (lapack_int *)LAPACKE_malloc( n * sizeof(lapack_int) );
00127 b = (lapack_complex_float *)
00128 LAPACKE_malloc( ldb*nrhs * sizeof(lapack_complex_float) );
00129 x = (lapack_complex_float *)
00130 LAPACKE_malloc( ldx*nrhs * sizeof(lapack_complex_float) );
00131 ferr = (float *)LAPACKE_malloc( nrhs * sizeof(float) );
00132 berr = (float *)LAPACKE_malloc( nrhs * sizeof(float) );
00133 work = (lapack_complex_float *)
00134 LAPACKE_malloc( 2*n * sizeof(lapack_complex_float) );
00135 rwork = (float *)LAPACKE_malloc( n * sizeof(float) );
00136
00137
00138 a_i = (lapack_complex_float *)
00139 LAPACKE_malloc( lda*n * sizeof(lapack_complex_float) );
00140 af_i = (lapack_complex_float *)
00141 LAPACKE_malloc( ldaf*n * sizeof(lapack_complex_float) );
00142 ipiv_i = (lapack_int *)LAPACKE_malloc( n * sizeof(lapack_int) );
00143 b_i = (lapack_complex_float *)
00144 LAPACKE_malloc( ldb*nrhs * sizeof(lapack_complex_float) );
00145 x_i = (lapack_complex_float *)
00146 LAPACKE_malloc( ldx*nrhs * sizeof(lapack_complex_float) );
00147 ferr_i = (float *)LAPACKE_malloc( nrhs * sizeof(float) );
00148 berr_i = (float *)LAPACKE_malloc( nrhs * sizeof(float) );
00149 work_i = (lapack_complex_float *)
00150 LAPACKE_malloc( 2*n * sizeof(lapack_complex_float) );
00151 rwork_i = (float *)LAPACKE_malloc( n * sizeof(float) );
00152
00153
00154 x_save = (lapack_complex_float *)
00155 LAPACKE_malloc( ldx*nrhs * sizeof(lapack_complex_float) );
00156 ferr_save = (float *)LAPACKE_malloc( nrhs * sizeof(float) );
00157 berr_save = (float *)LAPACKE_malloc( nrhs * sizeof(float) );
00158
00159
00160 a_r = (lapack_complex_float *)
00161 LAPACKE_malloc( n*(n+2) * sizeof(lapack_complex_float) );
00162 af_r = (lapack_complex_float *)
00163 LAPACKE_malloc( n*(n+2) * sizeof(lapack_complex_float) );
00164 b_r = (lapack_complex_float *)
00165 LAPACKE_malloc( n*(nrhs+2) * sizeof(lapack_complex_float) );
00166 x_r = (lapack_complex_float *)
00167 LAPACKE_malloc( n*(nrhs+2) * sizeof(lapack_complex_float) );
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 cgerfs_( &trans, &n, &nrhs, a, &lda, af, &ldaf, ipiv, b, &ldb, x, &ldx,
00193 ferr, 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_cgerfs_work( LAPACK_COL_MAJOR, trans_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_cgerfs( 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 cgerfs\n" );
00232 } else {
00233 printf( "FAILED: column-major middle-level interface to cgerfs\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_cgerfs( LAPACK_COL_MAJOR, trans_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_cgerfs( 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 cgerfs\n" );
00273 } else {
00274 printf( "FAILED: column-major high-level interface to cgerfs\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_cge_trans( LAPACK_COL_MAJOR, n, n, a_i, lda, a_r, n+2 );
00308 LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, af_i, ldaf, af_r, n+2 );
00309 LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, nrhs, b_i, ldb, b_r, nrhs+2 );
00310 LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, nrhs, x_i, ldx, x_r, nrhs+2 );
00311 info_i = LAPACKE_cgerfs_work( LAPACK_ROW_MAJOR, trans_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_cge_trans( LAPACK_ROW_MAJOR, n, nrhs, x_r, nrhs+2, x_i, ldx );
00316
00317 failed = compare_cgerfs( 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 cgerfs\n" );
00321 } else {
00322 printf( "FAILED: row-major middle-level interface to cgerfs\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_cge_trans( LAPACK_COL_MAJOR, n, n, a_i, lda, a_r, n+2 );
00357 LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, af_i, ldaf, af_r, n+2 );
00358 LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, nrhs, b_i, ldb, b_r, nrhs+2 );
00359 LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, nrhs, x_i, ldx, x_r, nrhs+2 );
00360 info_i = LAPACKE_cgerfs( LAPACK_ROW_MAJOR, trans_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_cge_trans( LAPACK_ROW_MAJOR, n, nrhs, x_r, nrhs+2, x_i, ldx );
00365
00366 failed = compare_cgerfs( 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 cgerfs\n" );
00370 } else {
00371 printf( "FAILED: row-major high-level interface to cgerfs\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_cgerfs( char *trans, lapack_int *n, lapack_int *nrhs,
00456 lapack_int *lda, lapack_int *ldaf,
00457 lapack_int *ldb, lapack_int *ldx )
00458 {
00459 *trans = 'N';
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_float *a ) {
00472 lapack_int i;
00473 for( i = 0; i < size; i++ ) {
00474 a[i] = lapack_make_complex_float( 0.0f, 0.0f );
00475 }
00476 a[0] = lapack_make_complex_float( -1.340000033e+000, 2.549999952e+000 );
00477 a[8] = lapack_make_complex_float( 2.800000012e-001, 3.170000076e+000 );
00478 a[16] = lapack_make_complex_float( -6.389999866e+000, -2.200000048e+000 );
00479 a[24] = lapack_make_complex_float( 7.200000286e-001, -9.200000167e-001 );
00480 a[1] = lapack_make_complex_float( -1.700000018e-001, -1.409999967e+000 );
00481 a[9] = lapack_make_complex_float( 3.309999943e+000, -1.500000060e-001 );
00482 a[17] = lapack_make_complex_float( -1.500000060e-001, 1.340000033e+000 );
00483 a[25] = lapack_make_complex_float( 1.289999962e+000, 1.379999995e+000 );
00484 a[2] = lapack_make_complex_float( -3.289999962e+000, -2.390000105e+000 );
00485 a[10] = lapack_make_complex_float( -1.909999967e+000, 4.420000076e+000 );
00486 a[18] = lapack_make_complex_float( -1.400000006e-001, -1.350000024e+000 );
00487 a[26] = lapack_make_complex_float( 1.720000029e+000, 1.350000024e+000 );
00488 a[3] = lapack_make_complex_float( 2.410000086e+000, 3.899999857e-001 );
00489 a[11] = lapack_make_complex_float( -5.600000024e-001, 1.470000029e+000 );
00490 a[19] = lapack_make_complex_float( -8.299999833e-001, -6.899999976e-001 );
00491 a[27] = lapack_make_complex_float( -1.960000038e+000, 6.700000167e-001 );
00492 }
00493 static void init_af( lapack_int size, lapack_complex_float *af ) {
00494 lapack_int i;
00495 for( i = 0; i < size; i++ ) {
00496 af[i] = lapack_make_complex_float( 0.0f, 0.0f );
00497 }
00498 af[0] = lapack_make_complex_float( -3.289999962e+000, -2.390000105e+000 );
00499 af[8] = lapack_make_complex_float( -1.909999967e+000, 4.420000076e+000 );
00500 af[16] = lapack_make_complex_float( -1.400000006e-001, -1.350000024e+000 );
00501 af[24] = lapack_make_complex_float( 1.720000029e+000, 1.350000024e+000 );
00502 af[1] = lapack_make_complex_float( 2.376120239e-001, 2.559596300e-001 );
00503 af[9] = lapack_make_complex_float( 4.895180702e+000, -7.113622427e-001 );
00504 af[17] = lapack_make_complex_float( -4.622798264e-001, 1.696610570e+000 );
00505 af[25] = lapack_make_complex_float( 1.226852775e+000, 6.189731956e-001 );
00506 af[2] = lapack_make_complex_float( -1.019521058e-001, -7.010135055e-001 );
00507 af[10] = lapack_make_complex_float( -6.691496968e-001, 3.688699007e-001 );
00508 af[18] = lapack_make_complex_float( -5.141410828e+000, -1.129969597e+000 );
00509 af[26] = lapack_make_complex_float( 9.982581139e-001, 3.850151896e-001 );
00510 af[3] = lapack_make_complex_float( -5.358546376e-001, 2.707273066e-001 );
00511 af[11] = lapack_make_complex_float( -2.040217221e-001, 8.601181507e-001 );
00512 af[19] = lapack_make_complex_float( 8.233040571e-003, 1.210636795e-001 );
00513 af[27] = lapack_make_complex_float( 1.482392550e-001, -1.252242178e-001 );
00514 }
00515 static void init_ipiv( lapack_int size, lapack_int *ipiv ) {
00516 lapack_int i;
00517 for( i = 0; i < size; i++ ) {
00518 ipiv[i] = 0;
00519 }
00520 ipiv[0] = 3;
00521 ipiv[1] = 2;
00522 ipiv[2] = 3;
00523 ipiv[3] = 4;
00524 }
00525 static void init_b( lapack_int size, lapack_complex_float *b ) {
00526 lapack_int i;
00527 for( i = 0; i < size; i++ ) {
00528 b[i] = lapack_make_complex_float( 0.0f, 0.0f );
00529 }
00530 b[0] = lapack_make_complex_float( 2.626000023e+001, 5.177999878e+001 );
00531 b[8] = lapack_make_complex_float( 3.131999969e+001, -6.699999809e+000 );
00532 b[1] = lapack_make_complex_float( 6.429999828e+000, -8.680000305e+000 );
00533 b[9] = lapack_make_complex_float( 1.585999966e+001, -1.419999957e+000 );
00534 b[2] = lapack_make_complex_float( -5.750000000e+000, 2.530999947e+001 );
00535 b[10] = lapack_make_complex_float( -2.150000095e+000, 3.019000053e+001 );
00536 b[3] = lapack_make_complex_float( 1.159999967e+000, 2.569999933e+000 );
00537 b[11] = lapack_make_complex_float( -2.559999943e+000, 7.550000191e+000 );
00538 }
00539 static void init_x( lapack_int size, lapack_complex_float *x ) {
00540 lapack_int i;
00541 for( i = 0; i < size; i++ ) {
00542 x[i] = lapack_make_complex_float( 0.0f, 0.0f );
00543 }
00544 x[0] = lapack_make_complex_float( 9.999898672e-001, 9.999940395e-001 );
00545 x[8] = lapack_make_complex_float( -1.000002265e+000, -1.999994636e+000 );
00546 x[1] = lapack_make_complex_float( 1.999998808e+000, -2.999995947e+000 );
00547 x[9] = lapack_make_complex_float( 5.000001907e+000, 1.000000238e+000 );
00548 x[2] = lapack_make_complex_float( -4.000001431e+000, -5.000002861e+000 );
00549 x[10] = lapack_make_complex_float( -3.000001431e+000, 4.000000954e+000 );
00550 x[3] = lapack_make_complex_float( -9.536743164e-006, 5.999988079e+000 );
00551 x[11] = lapack_make_complex_float( 1.999994278e+000, -2.999994516e+000 );
00552 }
00553 static void init_ferr( lapack_int size, float *ferr ) {
00554 lapack_int i;
00555 for( i = 0; i < size; i++ ) {
00556 ferr[i] = 0;
00557 }
00558 }
00559 static void init_berr( lapack_int size, float *berr ) {
00560 lapack_int i;
00561 for( i = 0; i < size; i++ ) {
00562 berr[i] = 0;
00563 }
00564 }
00565 static void init_work( lapack_int size, lapack_complex_float *work ) {
00566 lapack_int i;
00567 for( i = 0; i < size; i++ ) {
00568 work[i] = lapack_make_complex_float( 0.0f, 0.0f );
00569 }
00570 }
00571 static void init_rwork( lapack_int size, float *rwork ) {
00572 lapack_int i;
00573 for( i = 0; i < size; i++ ) {
00574 rwork[i] = 0;
00575 }
00576 }
00577
00578
00579
00580 static int compare_cgerfs( lapack_complex_float *x, lapack_complex_float *x_i,
00581 float *ferr, float *ferr_i, float *berr,
00582 float *berr_i, lapack_int info, lapack_int info_i,
00583 lapack_int ldx, lapack_int nrhs )
00584 {
00585 lapack_int i;
00586 int failed = 0;
00587 for( i = 0; i < ldx*nrhs; i++ ) {
00588 failed += compare_complex_floats(x[i],x_i[i]);
00589 }
00590 for( i = 0; i < nrhs; i++ ) {
00591 failed += compare_floats(ferr[i],ferr_i[i]);
00592 }
00593 for( i = 0; i < nrhs; i++ ) {
00594 failed += compare_floats(berr[i],berr_i[i]);
00595 }
00596 failed += (info == info_i) ? 0 : 1;
00597 if( info != 0 || info_i != 0 ) {
00598 printf( "info=%d, info_i=%d\n",(int)info,(int)info_i );
00599 }
00600
00601 return failed;
00602 }