zgbrfs_1.c
Go to the documentation of this file.
00001 /*****************************************************************************
00002   Copyright (c) 2010, Intel Corp.
00003   All rights reserved.
00004 
00005   Redistribution and use in source and binary forms, with or without
00006   modification, are permitted provided that the following conditions are met:
00007 
00008     * Redistributions of source code must retain the above copyright notice,
00009       this list of conditions and the following disclaimer.
00010     * Redistributions in binary form must reproduce the above copyright
00011       notice, this list of conditions and the following disclaimer in the
00012       documentation and/or other materials provided with the distribution.
00013     * Neither the name of Intel Corporation nor the names of its contributors
00014       may be used to endorse or promote products derived from this software
00015       without specific prior written permission.
00016 
00017   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00021   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00022   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00023   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00024   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00025   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00026   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
00027   THE POSSIBILITY OF SUCH DAMAGE.
00028 *****************************************************************************/
00029 /*  Contents: test routine for C interface to LAPACK
00030 *   Author: Intel Corporation
00031 *   Created in March, 2010
00032 *
00033 * Purpose
00034 *
00035 * zgbrfs_1 is the test program for the C interface to LAPACK
00036 * routine zgbrfs
00037 * The program doesn't require an input, the input data is hardcoded in the
00038 * test program.
00039 * The program tests the C interface in the four combinations:
00040 *   1) column-major layout, middle-level interface
00041 *   2) column-major layout, high-level interface
00042 *   3) row-major layout, middle-level interface
00043 *   4) row-major layout, high-level interface
00044 * The output of the C interface function is compared to those obtained from
00045 * the corresponiding LAPACK routine with the same input data, and the
00046 * comparison diagnostics is then printed on the standard output having PASSED
00047 * keyword if the test is passed, and FAILED keyword if the test isn't passed.
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_zgbrfs( char *trans, lapack_int *n, lapack_int *kl,
00055                                  lapack_int *ku, lapack_int *nrhs,
00056                                  lapack_int *ldab, lapack_int *ldafb,
00057                                  lapack_int *ldb, lapack_int *ldx );
00058 static void init_ab( lapack_int size, lapack_complex_double *ab );
00059 static void init_afb( lapack_int size, lapack_complex_double *afb );
00060 static void init_ipiv( lapack_int size, lapack_int *ipiv );
00061 static void init_b( lapack_int size, lapack_complex_double *b );
00062 static void init_x( lapack_int size, lapack_complex_double *x );
00063 static void init_ferr( lapack_int size, double *ferr );
00064 static void init_berr( lapack_int size, double *berr );
00065 static void init_work( lapack_int size, lapack_complex_double *work );
00066 static void init_rwork( lapack_int size, double *rwork );
00067 static int compare_zgbrfs( lapack_complex_double *x, lapack_complex_double *x_i,
00068                            double *ferr, double *ferr_i, double *berr,
00069                            double *berr_i, lapack_int info, lapack_int info_i,
00070                            lapack_int ldx, lapack_int nrhs );
00071 
00072 int main(void)
00073 {
00074     /* Local scalars */
00075     char trans, trans_i;
00076     lapack_int n, n_i;
00077     lapack_int kl, kl_i;
00078     lapack_int ku, ku_i;
00079     lapack_int nrhs, nrhs_i;
00080     lapack_int ldab, ldab_i;
00081     lapack_int ldab_r;
00082     lapack_int ldafb, ldafb_i;
00083     lapack_int ldafb_r;
00084     lapack_int ldb, ldb_i;
00085     lapack_int ldb_r;
00086     lapack_int ldx, ldx_i;
00087     lapack_int ldx_r;
00088     lapack_int info, info_i;
00089     lapack_int i;
00090     int failed;
00091 
00092     /* Local arrays */
00093     lapack_complex_double *ab = NULL, *ab_i = NULL;
00094     lapack_complex_double *afb = NULL, *afb_i = NULL;
00095     lapack_int *ipiv = NULL, *ipiv_i = NULL;
00096     lapack_complex_double *b = NULL, *b_i = NULL;
00097     lapack_complex_double *x = NULL, *x_i = NULL;
00098     double *ferr = NULL, *ferr_i = NULL;
00099     double *berr = NULL, *berr_i = NULL;
00100     lapack_complex_double *work = NULL, *work_i = NULL;
00101     double *rwork = NULL, *rwork_i = NULL;
00102     lapack_complex_double *x_save = NULL;
00103     double *ferr_save = NULL;
00104     double *berr_save = NULL;
00105     lapack_complex_double *ab_r = NULL;
00106     lapack_complex_double *afb_r = NULL;
00107     lapack_complex_double *b_r = NULL;
00108     lapack_complex_double *x_r = NULL;
00109 
00110     /* Iniitialize the scalar parameters */
00111     init_scalars_zgbrfs( &trans, &n, &kl, &ku, &nrhs, &ldab, &ldafb, &ldb,
00112                          &ldx );
00113     ldab_r = n+2;
00114     ldafb_r = n+2;
00115     ldb_r = nrhs+2;
00116     ldx_r = nrhs+2;
00117     trans_i = trans;
00118     n_i = n;
00119     kl_i = kl;
00120     ku_i = ku;
00121     nrhs_i = nrhs;
00122     ldab_i = ldab;
00123     ldafb_i = ldafb;
00124     ldb_i = ldb;
00125     ldx_i = ldx;
00126 
00127     /* Allocate memory for the LAPACK routine arrays */
00128     ab = (lapack_complex_double *)
00129         LAPACKE_malloc( ldab*n * sizeof(lapack_complex_double) );
00130     afb = (lapack_complex_double *)
00131         LAPACKE_malloc( ldafb*n * sizeof(lapack_complex_double) );
00132     ipiv = (lapack_int *)LAPACKE_malloc( n * sizeof(lapack_int) );
00133     b = (lapack_complex_double *)
00134         LAPACKE_malloc( ldb*nrhs * sizeof(lapack_complex_double) );
00135     x = (lapack_complex_double *)
00136         LAPACKE_malloc( ldx*nrhs * sizeof(lapack_complex_double) );
00137     ferr = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00138     berr = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00139     work = (lapack_complex_double *)
00140         LAPACKE_malloc( 2*n * sizeof(lapack_complex_double) );
00141     rwork = (double *)LAPACKE_malloc( n * sizeof(double) );
00142 
00143     /* Allocate memory for the C interface function arrays */
00144     ab_i = (lapack_complex_double *)
00145         LAPACKE_malloc( ldab*n * sizeof(lapack_complex_double) );
00146     afb_i = (lapack_complex_double *)
00147         LAPACKE_malloc( ldafb*n * sizeof(lapack_complex_double) );
00148     ipiv_i = (lapack_int *)LAPACKE_malloc( n * sizeof(lapack_int) );
00149     b_i = (lapack_complex_double *)
00150         LAPACKE_malloc( ldb*nrhs * sizeof(lapack_complex_double) );
00151     x_i = (lapack_complex_double *)
00152         LAPACKE_malloc( ldx*nrhs * sizeof(lapack_complex_double) );
00153     ferr_i = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00154     berr_i = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00155     work_i = (lapack_complex_double *)
00156         LAPACKE_malloc( 2*n * sizeof(lapack_complex_double) );
00157     rwork_i = (double *)LAPACKE_malloc( n * sizeof(double) );
00158 
00159     /* Allocate memory for the backup arrays */
00160     x_save = (lapack_complex_double *)
00161         LAPACKE_malloc( ldx*nrhs * sizeof(lapack_complex_double) );
00162     ferr_save = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00163     berr_save = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00164 
00165     /* Allocate memory for the row-major arrays */
00166     ab_r = (lapack_complex_double *)
00167         LAPACKE_malloc( (kl+ku+1)*(n+2) * sizeof(lapack_complex_double) );
00168     afb_r = (lapack_complex_double *)
00169         LAPACKE_malloc( ((2*kl+ku+1)*(n+2)) * sizeof(lapack_complex_double) );
00170     b_r = (lapack_complex_double *)
00171         LAPACKE_malloc( n*(nrhs+2) * sizeof(lapack_complex_double) );
00172     x_r = (lapack_complex_double *)
00173         LAPACKE_malloc( n*(nrhs+2) * sizeof(lapack_complex_double) );
00174 
00175     /* Initialize input arrays */
00176     init_ab( ldab*n, ab );
00177     init_afb( ldafb*n, afb );
00178     init_ipiv( n, ipiv );
00179     init_b( ldb*nrhs, b );
00180     init_x( ldx*nrhs, x );
00181     init_ferr( nrhs, ferr );
00182     init_berr( nrhs, berr );
00183     init_work( 2*n, work );
00184     init_rwork( n, rwork );
00185 
00186     /* Backup the ouptut arrays */
00187     for( i = 0; i < ldx*nrhs; i++ ) {
00188         x_save[i] = x[i];
00189     }
00190     for( i = 0; i < nrhs; i++ ) {
00191         ferr_save[i] = ferr[i];
00192     }
00193     for( i = 0; i < nrhs; i++ ) {
00194         berr_save[i] = berr[i];
00195     }
00196 
00197     /* Call the LAPACK routine */
00198     zgbrfs_( &trans, &n, &kl, &ku, &nrhs, ab, &ldab, afb, &ldafb, ipiv, b, &ldb,
00199              x, &ldx, ferr, berr, work, rwork, &info );
00200 
00201     /* Initialize input data, call the column-major middle-level
00202      * interface to LAPACK routine and check the results */
00203     for( i = 0; i < ldab*n; i++ ) {
00204         ab_i[i] = ab[i];
00205     }
00206     for( i = 0; i < ldafb*n; i++ ) {
00207         afb_i[i] = afb[i];
00208     }
00209     for( i = 0; i < n; i++ ) {
00210         ipiv_i[i] = ipiv[i];
00211     }
00212     for( i = 0; i < ldb*nrhs; i++ ) {
00213         b_i[i] = b[i];
00214     }
00215     for( i = 0; i < ldx*nrhs; i++ ) {
00216         x_i[i] = x_save[i];
00217     }
00218     for( i = 0; i < nrhs; i++ ) {
00219         ferr_i[i] = ferr_save[i];
00220     }
00221     for( i = 0; i < nrhs; i++ ) {
00222         berr_i[i] = berr_save[i];
00223     }
00224     for( i = 0; i < 2*n; i++ ) {
00225         work_i[i] = work[i];
00226     }
00227     for( i = 0; i < n; i++ ) {
00228         rwork_i[i] = rwork[i];
00229     }
00230     info_i = LAPACKE_zgbrfs_work( LAPACK_COL_MAJOR, trans_i, n_i, kl_i, ku_i,
00231                                   nrhs_i, ab_i, ldab_i, afb_i, ldafb_i, ipiv_i,
00232                                   b_i, ldb_i, x_i, ldx_i, ferr_i, berr_i,
00233                                   work_i, rwork_i );
00234 
00235     failed = compare_zgbrfs( x, x_i, ferr, ferr_i, berr, berr_i, info, info_i,
00236                              ldx, nrhs );
00237     if( failed == 0 ) {
00238         printf( "PASSED: column-major middle-level interface to zgbrfs\n" );
00239     } else {
00240         printf( "FAILED: column-major middle-level interface to zgbrfs\n" );
00241     }
00242 
00243     /* Initialize input data, call the column-major high-level
00244      * interface to LAPACK routine and check the results */
00245     for( i = 0; i < ldab*n; i++ ) {
00246         ab_i[i] = ab[i];
00247     }
00248     for( i = 0; i < ldafb*n; i++ ) {
00249         afb_i[i] = afb[i];
00250     }
00251     for( i = 0; i < n; i++ ) {
00252         ipiv_i[i] = ipiv[i];
00253     }
00254     for( i = 0; i < ldb*nrhs; i++ ) {
00255         b_i[i] = b[i];
00256     }
00257     for( i = 0; i < ldx*nrhs; i++ ) {
00258         x_i[i] = x_save[i];
00259     }
00260     for( i = 0; i < nrhs; i++ ) {
00261         ferr_i[i] = ferr_save[i];
00262     }
00263     for( i = 0; i < nrhs; i++ ) {
00264         berr_i[i] = berr_save[i];
00265     }
00266     for( i = 0; i < 2*n; i++ ) {
00267         work_i[i] = work[i];
00268     }
00269     for( i = 0; i < n; i++ ) {
00270         rwork_i[i] = rwork[i];
00271     }
00272     info_i = LAPACKE_zgbrfs( LAPACK_COL_MAJOR, trans_i, n_i, kl_i, ku_i, nrhs_i,
00273                              ab_i, ldab_i, afb_i, ldafb_i, ipiv_i, b_i, ldb_i,
00274                              x_i, ldx_i, ferr_i, berr_i );
00275 
00276     failed = compare_zgbrfs( x, x_i, ferr, ferr_i, berr, berr_i, info, info_i,
00277                              ldx, nrhs );
00278     if( failed == 0 ) {
00279         printf( "PASSED: column-major high-level interface to zgbrfs\n" );
00280     } else {
00281         printf( "FAILED: column-major high-level interface to zgbrfs\n" );
00282     }
00283 
00284     /* Initialize input data, call the row-major middle-level
00285      * interface to LAPACK routine and check the results */
00286     for( i = 0; i < ldab*n; i++ ) {
00287         ab_i[i] = ab[i];
00288     }
00289     for( i = 0; i < ldafb*n; i++ ) {
00290         afb_i[i] = afb[i];
00291     }
00292     for( i = 0; i < n; i++ ) {
00293         ipiv_i[i] = ipiv[i];
00294     }
00295     for( i = 0; i < ldb*nrhs; i++ ) {
00296         b_i[i] = b[i];
00297     }
00298     for( i = 0; i < ldx*nrhs; i++ ) {
00299         x_i[i] = x_save[i];
00300     }
00301     for( i = 0; i < nrhs; i++ ) {
00302         ferr_i[i] = ferr_save[i];
00303     }
00304     for( i = 0; i < nrhs; i++ ) {
00305         berr_i[i] = berr_save[i];
00306     }
00307     for( i = 0; i < 2*n; i++ ) {
00308         work_i[i] = work[i];
00309     }
00310     for( i = 0; i < n; i++ ) {
00311         rwork_i[i] = rwork[i];
00312     }
00313 
00314     LAPACKE_zge_trans( LAPACK_COL_MAJOR, kl+ku+1, n, ab_i, ldab, ab_r, n+2 );
00315     LAPACKE_zge_trans( LAPACK_COL_MAJOR, 2*kl+ku+1, n, afb_i, ldafb, afb_r,
00316                        n+2 );
00317     LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, b_i, ldb, b_r, nrhs+2 );
00318     LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, x_i, ldx, x_r, nrhs+2 );
00319     info_i = LAPACKE_zgbrfs_work( LAPACK_ROW_MAJOR, trans_i, n_i, kl_i, ku_i,
00320                                   nrhs_i, ab_r, ldab_r, afb_r, ldafb_r, ipiv_i,
00321                                   b_r, ldb_r, x_r, ldx_r, ferr_i, berr_i,
00322                                   work_i, rwork_i );
00323 
00324     LAPACKE_zge_trans( LAPACK_ROW_MAJOR, n, nrhs, x_r, nrhs+2, x_i, ldx );
00325 
00326     failed = compare_zgbrfs( x, x_i, ferr, ferr_i, berr, berr_i, info, info_i,
00327                              ldx, nrhs );
00328     if( failed == 0 ) {
00329         printf( "PASSED: row-major middle-level interface to zgbrfs\n" );
00330     } else {
00331         printf( "FAILED: row-major middle-level interface to zgbrfs\n" );
00332     }
00333 
00334     /* Initialize input data, call the row-major high-level
00335      * interface to LAPACK routine and check the results */
00336     for( i = 0; i < ldab*n; i++ ) {
00337         ab_i[i] = ab[i];
00338     }
00339     for( i = 0; i < ldafb*n; i++ ) {
00340         afb_i[i] = afb[i];
00341     }
00342     for( i = 0; i < n; i++ ) {
00343         ipiv_i[i] = ipiv[i];
00344     }
00345     for( i = 0; i < ldb*nrhs; i++ ) {
00346         b_i[i] = b[i];
00347     }
00348     for( i = 0; i < ldx*nrhs; i++ ) {
00349         x_i[i] = x_save[i];
00350     }
00351     for( i = 0; i < nrhs; i++ ) {
00352         ferr_i[i] = ferr_save[i];
00353     }
00354     for( i = 0; i < nrhs; i++ ) {
00355         berr_i[i] = berr_save[i];
00356     }
00357     for( i = 0; i < 2*n; i++ ) {
00358         work_i[i] = work[i];
00359     }
00360     for( i = 0; i < n; i++ ) {
00361         rwork_i[i] = rwork[i];
00362     }
00363 
00364     /* Init row_major arrays */
00365     LAPACKE_zge_trans( LAPACK_COL_MAJOR, kl+ku+1, n, ab_i, ldab, ab_r, n+2 );
00366     LAPACKE_zge_trans( LAPACK_COL_MAJOR, 2*kl+ku+1, n, afb_i, ldafb, afb_r,
00367                        n+2 );
00368     LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, b_i, ldb, b_r, nrhs+2 );
00369     LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, x_i, ldx, x_r, nrhs+2 );
00370     info_i = LAPACKE_zgbrfs( LAPACK_ROW_MAJOR, trans_i, n_i, kl_i, ku_i, nrhs_i,
00371                              ab_r, ldab_r, afb_r, ldafb_r, ipiv_i, b_r, ldb_r,
00372                              x_r, ldx_r, ferr_i, berr_i );
00373 
00374     LAPACKE_zge_trans( LAPACK_ROW_MAJOR, n, nrhs, x_r, nrhs+2, x_i, ldx );
00375 
00376     failed = compare_zgbrfs( x, x_i, ferr, ferr_i, berr, berr_i, info, info_i,
00377                              ldx, nrhs );
00378     if( failed == 0 ) {
00379         printf( "PASSED: row-major high-level interface to zgbrfs\n" );
00380     } else {
00381         printf( "FAILED: row-major high-level interface to zgbrfs\n" );
00382     }
00383 
00384     /* Release memory */
00385     if( ab != NULL ) {
00386         LAPACKE_free( ab );
00387     }
00388     if( ab_i != NULL ) {
00389         LAPACKE_free( ab_i );
00390     }
00391     if( ab_r != NULL ) {
00392         LAPACKE_free( ab_r );
00393     }
00394     if( afb != NULL ) {
00395         LAPACKE_free( afb );
00396     }
00397     if( afb_i != NULL ) {
00398         LAPACKE_free( afb_i );
00399     }
00400     if( afb_r != NULL ) {
00401         LAPACKE_free( afb_r );
00402     }
00403     if( ipiv != NULL ) {
00404         LAPACKE_free( ipiv );
00405     }
00406     if( ipiv_i != NULL ) {
00407         LAPACKE_free( ipiv_i );
00408     }
00409     if( b != NULL ) {
00410         LAPACKE_free( b );
00411     }
00412     if( b_i != NULL ) {
00413         LAPACKE_free( b_i );
00414     }
00415     if( b_r != NULL ) {
00416         LAPACKE_free( b_r );
00417     }
00418     if( x != NULL ) {
00419         LAPACKE_free( x );
00420     }
00421     if( x_i != NULL ) {
00422         LAPACKE_free( x_i );
00423     }
00424     if( x_r != NULL ) {
00425         LAPACKE_free( x_r );
00426     }
00427     if( x_save != NULL ) {
00428         LAPACKE_free( x_save );
00429     }
00430     if( ferr != NULL ) {
00431         LAPACKE_free( ferr );
00432     }
00433     if( ferr_i != NULL ) {
00434         LAPACKE_free( ferr_i );
00435     }
00436     if( ferr_save != NULL ) {
00437         LAPACKE_free( ferr_save );
00438     }
00439     if( berr != NULL ) {
00440         LAPACKE_free( berr );
00441     }
00442     if( berr_i != NULL ) {
00443         LAPACKE_free( berr_i );
00444     }
00445     if( berr_save != NULL ) {
00446         LAPACKE_free( berr_save );
00447     }
00448     if( work != NULL ) {
00449         LAPACKE_free( work );
00450     }
00451     if( work_i != NULL ) {
00452         LAPACKE_free( work_i );
00453     }
00454     if( rwork != NULL ) {
00455         LAPACKE_free( rwork );
00456     }
00457     if( rwork_i != NULL ) {
00458         LAPACKE_free( rwork_i );
00459     }
00460 
00461     return 0;
00462 }
00463 
00464 /* Auxiliary function: zgbrfs scalar parameters initialization */
00465 static void init_scalars_zgbrfs( char *trans, lapack_int *n, lapack_int *kl,
00466                                  lapack_int *ku, lapack_int *nrhs,
00467                                  lapack_int *ldab, lapack_int *ldafb,
00468                                  lapack_int *ldb, lapack_int *ldx )
00469 {
00470     *trans = 'N';
00471     *n = 4;
00472     *kl = 1;
00473     *ku = 2;
00474     *nrhs = 2;
00475     *ldab = 17;
00476     *ldafb = 25;
00477     *ldb = 8;
00478     *ldx = 8;
00479 
00480     return;
00481 }
00482 
00483 /* Auxiliary functions: zgbrfs array parameters initialization */
00484 static void init_ab( lapack_int size, lapack_complex_double *ab ) {
00485     lapack_int i;
00486     for( i = 0; i < size; i++ ) {
00487         ab[i] = lapack_make_complex_double( 0.0, 0.0 );
00488     }
00489     ab[0] = lapack_make_complex_double( 0.00000000000000000e+000,
00490                                         0.00000000000000000e+000 );
00491     ab[17] = lapack_make_complex_double( 0.00000000000000000e+000,
00492                                          0.00000000000000000e+000 );
00493     ab[34] = lapack_make_complex_double( 9.69999999999999970e-001,
00494                                          -2.83999999999999990e+000 );
00495     ab[51] = lapack_make_complex_double( 5.89999999999999970e-001,
00496                                          -4.79999999999999980e-001 );
00497     ab[1] = lapack_make_complex_double( 0.00000000000000000e+000,
00498                                         0.00000000000000000e+000 );
00499     ab[18] = lapack_make_complex_double( -2.04999999999999980e+000,
00500                                          -8.49999999999999980e-001 );
00501     ab[35] = lapack_make_complex_double( -3.99000000000000020e+000,
00502                                          4.00999999999999980e+000 );
00503     ab[52] = lapack_make_complex_double( 3.33000000000000010e+000,
00504                                          -1.04000000000000000e+000 );
00505     ab[2] = lapack_make_complex_double( -1.64999999999999990e+000,
00506                                         2.25999999999999980e+000 );
00507     ab[19] = lapack_make_complex_double( -1.48000000000000000e+000,
00508                                          -1.75000000000000000e+000 );
00509     ab[36] = lapack_make_complex_double( -1.06000000000000010e+000,
00510                                          1.93999999999999990e+000 );
00511     ab[53] = lapack_make_complex_double( -4.60000000000000020e-001,
00512                                          -1.72000000000000000e+000 );
00513     ab[3] = lapack_make_complex_double( 0.00000000000000000e+000,
00514                                         6.29999999999999980e+000 );
00515     ab[20] = lapack_make_complex_double( -7.70000000000000020e-001,
00516                                          2.83000000000000010e+000 );
00517     ab[37] = lapack_make_complex_double( 4.48000000000000040e+000,
00518                                          -1.09000000000000010e+000 );
00519     ab[54] = lapack_make_complex_double( 0.00000000000000000e+000,
00520                                          0.00000000000000000e+000 );
00521 }
00522 static void init_afb( lapack_int size, lapack_complex_double *afb ) {
00523     lapack_int i;
00524     for( i = 0; i < size; i++ ) {
00525         afb[i] = lapack_make_complex_double( 0.0, 0.0 );
00526     }
00527     afb[0] = lapack_make_complex_double( 0.00000000000000000e+000,
00528                                          0.00000000000000000e+000 );
00529     afb[25] = lapack_make_complex_double( 0.00000000000000000e+000,
00530                                           0.00000000000000000e+000 );
00531     afb[50] = lapack_make_complex_double( 0.00000000000000000e+000,
00532                                           0.00000000000000000e+000 );
00533     afb[75] = lapack_make_complex_double( 5.89999999999999970e-001,
00534                                           -4.79999999999999980e-001 );
00535     afb[1] = lapack_make_complex_double( 0.00000000000000000e+000,
00536                                          0.00000000000000000e+000 );
00537     afb[26] = lapack_make_complex_double( 0.00000000000000000e+000,
00538                                           0.00000000000000000e+000 );
00539     afb[51] = lapack_make_complex_double( -3.99000000000000020e+000,
00540                                           4.00999999999999980e+000 );
00541     afb[76] = lapack_make_complex_double( 3.33000000000000010e+000,
00542                                           -1.04000000000000000e+000 );
00543     afb[2] = lapack_make_complex_double( 0.00000000000000000e+000,
00544                                          0.00000000000000000e+000 );
00545     afb[27] = lapack_make_complex_double( -1.48000000000000000e+000,
00546                                           -1.75000000000000000e+000 );
00547     afb[52] = lapack_make_complex_double( -1.06000000000000010e+000,
00548                                           1.93999999999999990e+000 );
00549     afb[77] = lapack_make_complex_double( -1.76920938160968100e+000,
00550                                           -1.85874728194578730e+000 );
00551     afb[3] = lapack_make_complex_double( 0.00000000000000000e+000,
00552                                          6.29999999999999980e+000 );
00553     afb[28] = lapack_make_complex_double( -7.70000000000000020e-001,
00554                                           2.83000000000000010e+000 );
00555     afb[53] = lapack_make_complex_double( 4.93026694117547140e+000,
00556                                           -3.00856374062719210e+000 );
00557     afb[78] = lapack_make_complex_double( 4.33774926590159760e-001,
00558                                           1.23252818156083470e-001 );
00559     afb[4] = lapack_make_complex_double( 3.58730158730158680e-001,
00560                                          2.61904761904761860e-001 );
00561     afb[29] = lapack_make_complex_double( 2.31426072874374280e-001,
00562                                           6.35764884204745640e-001 );
00563     afb[54] = lapack_make_complex_double( 7.60422661963551130e-001,
00564                                           2.42944258926713260e-001 );
00565     afb[79] = lapack_make_complex_double( 0.00000000000000000e+000,
00566                                           0.00000000000000000e+000 );
00567 }
00568 static void init_ipiv( lapack_int size, lapack_int *ipiv ) {
00569     lapack_int i;
00570     for( i = 0; i < size; i++ ) {
00571         ipiv[i] = 0;
00572     }
00573     ipiv[0] = 2;
00574     ipiv[1] = 3;
00575     ipiv[2] = 3;
00576     ipiv[3] = 4;
00577 }
00578 static void init_b( lapack_int size, lapack_complex_double *b ) {
00579     lapack_int i;
00580     for( i = 0; i < size; i++ ) {
00581         b[i] = lapack_make_complex_double( 0.0, 0.0 );
00582     }
00583     b[0] = lapack_make_complex_double( -1.06000000000000010e+000,
00584                                        2.15000000000000000e+001 );
00585     b[8] = lapack_make_complex_double( 1.28500000000000000e+001,
00586                                        2.83999999999999990e+000 );
00587     b[1] = lapack_make_complex_double( -2.27199999999999990e+001,
00588                                        -5.38999999999999990e+001 );
00589     b[9] = lapack_make_complex_double( -7.02199999999999990e+001,
00590                                        2.15700000000000000e+001 );
00591     b[2] = lapack_make_complex_double( 2.82399999999999980e+001,
00592                                        -3.86000000000000010e+001 );
00593     b[10] = lapack_make_complex_double( -2.07300000000000000e+001,
00594                                         -1.23000000000000000e+000 );
00595     b[3] = lapack_make_complex_double( -3.45600000000000020e+001,
00596                                        1.67300000000000000e+001 );
00597     b[11] = lapack_make_complex_double( 2.60100000000000020e+001,
00598                                         3.19699999999999990e+001 );
00599 }
00600 static void init_x( lapack_int size, lapack_complex_double *x ) {
00601     lapack_int i;
00602     for( i = 0; i < size; i++ ) {
00603         x[i] = lapack_make_complex_double( 0.0, 0.0 );
00604     }
00605     x[0] = lapack_make_complex_double( -3.00000000000000670e+000,
00606                                        1.99999999999999800e+000 );
00607     x[8] = lapack_make_complex_double( 9.99999999999996230e-001,
00608                                        5.99999999999999640e+000 );
00609     x[1] = lapack_make_complex_double( 9.99999999999999560e-001,
00610                                        -7.00000000000000800e+000 );
00611     x[9] = lapack_make_complex_double( -6.99999999999999820e+000,
00612                                        -4.00000000000000620e+000 );
00613     x[2] = lapack_make_complex_double( -4.99999999999999730e+000,
00614                                        3.99999999999999560e+000 );
00615     x[10] = lapack_make_complex_double( 3.00000000000000220e+000,
00616                                         4.99999999999999640e+000 );
00617     x[3] = lapack_make_complex_double( 5.99999999999999200e+000,
00618                                        -8.00000000000000710e+000 );
00619     x[11] = lapack_make_complex_double( -8.00000000000000530e+000,
00620                                         1.99999999999999380e+000 );
00621 }
00622 static void init_ferr( lapack_int size, double *ferr ) {
00623     lapack_int i;
00624     for( i = 0; i < size; i++ ) {
00625         ferr[i] = 0;
00626     }
00627 }
00628 static void init_berr( lapack_int size, double *berr ) {
00629     lapack_int i;
00630     for( i = 0; i < size; i++ ) {
00631         berr[i] = 0;
00632     }
00633 }
00634 static void init_work( lapack_int size, lapack_complex_double *work ) {
00635     lapack_int i;
00636     for( i = 0; i < size; i++ ) {
00637         work[i] = lapack_make_complex_double( 0.0, 0.0 );
00638     }
00639 }
00640 static void init_rwork( lapack_int size, double *rwork ) {
00641     lapack_int i;
00642     for( i = 0; i < size; i++ ) {
00643         rwork[i] = 0;
00644     }
00645 }
00646 
00647 /* Auxiliary function: C interface to zgbrfs results check */
00648 /* Return value: 0 - test is passed, non-zero - test is failed */
00649 static int compare_zgbrfs( lapack_complex_double *x, lapack_complex_double *x_i,
00650                            double *ferr, double *ferr_i, double *berr,
00651                            double *berr_i, lapack_int info, lapack_int info_i,
00652                            lapack_int ldx, lapack_int nrhs )
00653 {
00654     lapack_int i;
00655     int failed = 0;
00656     for( i = 0; i < ldx*nrhs; i++ ) {
00657         failed += compare_complex_doubles(x[i],x_i[i]);
00658     }
00659     for( i = 0; i < nrhs; i++ ) {
00660         failed += compare_doubles(ferr[i],ferr_i[i]);
00661     }
00662     for( i = 0; i < nrhs; i++ ) {
00663         failed += compare_doubles(berr[i],berr_i[i]);
00664     }
00665     failed += (info == info_i) ? 0 : 1;
00666     if( info != 0 || info_i != 0 ) {
00667         printf( "info=%d, info_i=%d\n",(int)info,(int)info_i );
00668     }
00669 
00670     return failed;
00671 }


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:30