zpbrfs_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 * zpbrfs_1 is the test program for the C interface to LAPACK
00036 * routine zpbrfs
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_zpbrfs( char *uplo, lapack_int *n, lapack_int *kd,
00055                                  lapack_int *nrhs, lapack_int *ldab,
00056                                  lapack_int *ldafb, lapack_int *ldb,
00057                                  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_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_zpbrfs( 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     /* Local scalars */
00074     char uplo, uplo_i;
00075     lapack_int n, n_i;
00076     lapack_int kd, kd_i;
00077     lapack_int nrhs, nrhs_i;
00078     lapack_int ldab, ldab_i;
00079     lapack_int ldab_r;
00080     lapack_int ldafb, ldafb_i;
00081     lapack_int ldafb_r;
00082     lapack_int ldb, ldb_i;
00083     lapack_int ldb_r;
00084     lapack_int ldx, ldx_i;
00085     lapack_int ldx_r;
00086     lapack_int info, info_i;
00087     lapack_int i;
00088     int failed;
00089 
00090     /* Local arrays */
00091     lapack_complex_double *ab = NULL, *ab_i = NULL;
00092     lapack_complex_double *afb = NULL, *afb_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 *ab_r = NULL;
00103     lapack_complex_double *afb_r = NULL;
00104     lapack_complex_double *b_r = NULL;
00105     lapack_complex_double *x_r = NULL;
00106 
00107     /* Iniitialize the scalar parameters */
00108     init_scalars_zpbrfs( &uplo, &n, &kd, &nrhs, &ldab, &ldafb, &ldb, &ldx );
00109     ldab_r = n+2;
00110     ldafb_r = n+2;
00111     ldb_r = nrhs+2;
00112     ldx_r = nrhs+2;
00113     uplo_i = uplo;
00114     n_i = n;
00115     kd_i = kd;
00116     nrhs_i = nrhs;
00117     ldab_i = ldab;
00118     ldafb_i = ldafb;
00119     ldb_i = ldb;
00120     ldx_i = ldx;
00121 
00122     /* Allocate memory for the LAPACK routine arrays */
00123     ab = (lapack_complex_double *)
00124         LAPACKE_malloc( ldab*n * sizeof(lapack_complex_double) );
00125     afb = (lapack_complex_double *)
00126         LAPACKE_malloc( ldafb*n * sizeof(lapack_complex_double) );
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     /* Allocate memory for the C interface function arrays */
00138     ab_i = (lapack_complex_double *)
00139         LAPACKE_malloc( ldab*n * sizeof(lapack_complex_double) );
00140     afb_i = (lapack_complex_double *)
00141         LAPACKE_malloc( ldafb*n * sizeof(lapack_complex_double) );
00142     b_i = (lapack_complex_double *)
00143         LAPACKE_malloc( ldb*nrhs * sizeof(lapack_complex_double) );
00144     x_i = (lapack_complex_double *)
00145         LAPACKE_malloc( ldx*nrhs * sizeof(lapack_complex_double) );
00146     ferr_i = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00147     berr_i = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00148     work_i = (lapack_complex_double *)
00149         LAPACKE_malloc( 2*n * sizeof(lapack_complex_double) );
00150     rwork_i = (double *)LAPACKE_malloc( n * sizeof(double) );
00151 
00152     /* Allocate memory for the backup arrays */
00153     x_save = (lapack_complex_double *)
00154         LAPACKE_malloc( ldx*nrhs * sizeof(lapack_complex_double) );
00155     ferr_save = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00156     berr_save = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00157 
00158     /* Allocate memory for the row-major arrays */
00159     ab_r = (lapack_complex_double *)
00160         LAPACKE_malloc( (kd+1)*(n+2) * sizeof(lapack_complex_double) );
00161     afb_r = (lapack_complex_double *)
00162         LAPACKE_malloc( (kd+1)*(n+2) * sizeof(lapack_complex_double) );
00163     b_r = (lapack_complex_double *)
00164         LAPACKE_malloc( n*(nrhs+2) * sizeof(lapack_complex_double) );
00165     x_r = (lapack_complex_double *)
00166         LAPACKE_malloc( n*(nrhs+2) * sizeof(lapack_complex_double) );
00167 
00168     /* Initialize input arrays */
00169     init_ab( ldab*n, ab );
00170     init_afb( ldafb*n, afb );
00171     init_b( ldb*nrhs, b );
00172     init_x( ldx*nrhs, x );
00173     init_ferr( nrhs, ferr );
00174     init_berr( nrhs, berr );
00175     init_work( 2*n, work );
00176     init_rwork( n, rwork );
00177 
00178     /* Backup the ouptut arrays */
00179     for( i = 0; i < ldx*nrhs; i++ ) {
00180         x_save[i] = x[i];
00181     }
00182     for( i = 0; i < nrhs; i++ ) {
00183         ferr_save[i] = ferr[i];
00184     }
00185     for( i = 0; i < nrhs; i++ ) {
00186         berr_save[i] = berr[i];
00187     }
00188 
00189     /* Call the LAPACK routine */
00190     zpbrfs_( &uplo, &n, &kd, &nrhs, ab, &ldab, afb, &ldafb, b, &ldb, x, &ldx,
00191              ferr, berr, work, rwork, &info );
00192 
00193     /* Initialize input data, call the column-major middle-level
00194      * interface to LAPACK routine and check the results */
00195     for( i = 0; i < ldab*n; i++ ) {
00196         ab_i[i] = ab[i];
00197     }
00198     for( i = 0; i < ldafb*n; i++ ) {
00199         afb_i[i] = afb[i];
00200     }
00201     for( i = 0; i < ldb*nrhs; i++ ) {
00202         b_i[i] = b[i];
00203     }
00204     for( i = 0; i < ldx*nrhs; i++ ) {
00205         x_i[i] = x_save[i];
00206     }
00207     for( i = 0; i < nrhs; i++ ) {
00208         ferr_i[i] = ferr_save[i];
00209     }
00210     for( i = 0; i < nrhs; i++ ) {
00211         berr_i[i] = berr_save[i];
00212     }
00213     for( i = 0; i < 2*n; i++ ) {
00214         work_i[i] = work[i];
00215     }
00216     for( i = 0; i < n; i++ ) {
00217         rwork_i[i] = rwork[i];
00218     }
00219     info_i = LAPACKE_zpbrfs_work( LAPACK_COL_MAJOR, uplo_i, n_i, kd_i, nrhs_i,
00220                                   ab_i, ldab_i, afb_i, ldafb_i, b_i, ldb_i, x_i,
00221                                   ldx_i, ferr_i, berr_i, work_i, rwork_i );
00222 
00223     failed = compare_zpbrfs( x, x_i, ferr, ferr_i, berr, berr_i, info, info_i,
00224                              ldx, nrhs );
00225     if( failed == 0 ) {
00226         printf( "PASSED: column-major middle-level interface to zpbrfs\n" );
00227     } else {
00228         printf( "FAILED: column-major middle-level interface to zpbrfs\n" );
00229     }
00230 
00231     /* Initialize input data, call the column-major high-level
00232      * interface to LAPACK routine and check the results */
00233     for( i = 0; i < ldab*n; i++ ) {
00234         ab_i[i] = ab[i];
00235     }
00236     for( i = 0; i < ldafb*n; i++ ) {
00237         afb_i[i] = afb[i];
00238     }
00239     for( i = 0; i < ldb*nrhs; i++ ) {
00240         b_i[i] = b[i];
00241     }
00242     for( i = 0; i < ldx*nrhs; i++ ) {
00243         x_i[i] = x_save[i];
00244     }
00245     for( i = 0; i < nrhs; i++ ) {
00246         ferr_i[i] = ferr_save[i];
00247     }
00248     for( i = 0; i < nrhs; i++ ) {
00249         berr_i[i] = berr_save[i];
00250     }
00251     for( i = 0; i < 2*n; i++ ) {
00252         work_i[i] = work[i];
00253     }
00254     for( i = 0; i < n; i++ ) {
00255         rwork_i[i] = rwork[i];
00256     }
00257     info_i = LAPACKE_zpbrfs( LAPACK_COL_MAJOR, uplo_i, n_i, kd_i, nrhs_i, ab_i,
00258                              ldab_i, afb_i, ldafb_i, b_i, ldb_i, x_i, ldx_i,
00259                              ferr_i, berr_i );
00260 
00261     failed = compare_zpbrfs( x, x_i, ferr, ferr_i, berr, berr_i, info, info_i,
00262                              ldx, nrhs );
00263     if( failed == 0 ) {
00264         printf( "PASSED: column-major high-level interface to zpbrfs\n" );
00265     } else {
00266         printf( "FAILED: column-major high-level interface to zpbrfs\n" );
00267     }
00268 
00269     /* Initialize input data, call the row-major middle-level
00270      * interface to LAPACK routine and check the results */
00271     for( i = 0; i < ldab*n; i++ ) {
00272         ab_i[i] = ab[i];
00273     }
00274     for( i = 0; i < ldafb*n; i++ ) {
00275         afb_i[i] = afb[i];
00276     }
00277     for( i = 0; i < ldb*nrhs; i++ ) {
00278         b_i[i] = b[i];
00279     }
00280     for( i = 0; i < ldx*nrhs; i++ ) {
00281         x_i[i] = x_save[i];
00282     }
00283     for( i = 0; i < nrhs; i++ ) {
00284         ferr_i[i] = ferr_save[i];
00285     }
00286     for( i = 0; i < nrhs; i++ ) {
00287         berr_i[i] = berr_save[i];
00288     }
00289     for( i = 0; i < 2*n; i++ ) {
00290         work_i[i] = work[i];
00291     }
00292     for( i = 0; i < n; i++ ) {
00293         rwork_i[i] = rwork[i];
00294     }
00295 
00296     LAPACKE_zge_trans( LAPACK_COL_MAJOR, kd+1, n, ab_i, ldab, ab_r, n+2 );
00297     LAPACKE_zge_trans( LAPACK_COL_MAJOR, kd+1, n, afb_i, ldafb, afb_r, n+2 );
00298     LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, b_i, ldb, b_r, nrhs+2 );
00299     LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, x_i, ldx, x_r, nrhs+2 );
00300     info_i = LAPACKE_zpbrfs_work( LAPACK_ROW_MAJOR, uplo_i, n_i, kd_i, nrhs_i,
00301                                   ab_r, ldab_r, afb_r, ldafb_r, b_r, ldb_r, x_r,
00302                                   ldx_r, ferr_i, berr_i, work_i, rwork_i );
00303 
00304     LAPACKE_zge_trans( LAPACK_ROW_MAJOR, n, nrhs, x_r, nrhs+2, x_i, ldx );
00305 
00306     failed = compare_zpbrfs( x, x_i, ferr, ferr_i, berr, berr_i, info, info_i,
00307                              ldx, nrhs );
00308     if( failed == 0 ) {
00309         printf( "PASSED: row-major middle-level interface to zpbrfs\n" );
00310     } else {
00311         printf( "FAILED: row-major middle-level interface to zpbrfs\n" );
00312     }
00313 
00314     /* Initialize input data, call the row-major high-level
00315      * interface to LAPACK routine and check the results */
00316     for( i = 0; i < ldab*n; i++ ) {
00317         ab_i[i] = ab[i];
00318     }
00319     for( i = 0; i < ldafb*n; i++ ) {
00320         afb_i[i] = afb[i];
00321     }
00322     for( i = 0; i < ldb*nrhs; i++ ) {
00323         b_i[i] = b[i];
00324     }
00325     for( i = 0; i < ldx*nrhs; i++ ) {
00326         x_i[i] = x_save[i];
00327     }
00328     for( i = 0; i < nrhs; i++ ) {
00329         ferr_i[i] = ferr_save[i];
00330     }
00331     for( i = 0; i < nrhs; i++ ) {
00332         berr_i[i] = berr_save[i];
00333     }
00334     for( i = 0; i < 2*n; i++ ) {
00335         work_i[i] = work[i];
00336     }
00337     for( i = 0; i < n; i++ ) {
00338         rwork_i[i] = rwork[i];
00339     }
00340 
00341     /* Init row_major arrays */
00342     LAPACKE_zge_trans( LAPACK_COL_MAJOR, kd+1, n, ab_i, ldab, ab_r, n+2 );
00343     LAPACKE_zge_trans( LAPACK_COL_MAJOR, kd+1, n, afb_i, ldafb, afb_r, n+2 );
00344     LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, b_i, ldb, b_r, nrhs+2 );
00345     LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, x_i, ldx, x_r, nrhs+2 );
00346     info_i = LAPACKE_zpbrfs( LAPACK_ROW_MAJOR, uplo_i, n_i, kd_i, nrhs_i, ab_r,
00347                              ldab_r, afb_r, ldafb_r, b_r, ldb_r, x_r, ldx_r,
00348                              ferr_i, berr_i );
00349 
00350     LAPACKE_zge_trans( LAPACK_ROW_MAJOR, n, nrhs, x_r, nrhs+2, x_i, ldx );
00351 
00352     failed = compare_zpbrfs( x, x_i, ferr, ferr_i, berr, berr_i, info, info_i,
00353                              ldx, nrhs );
00354     if( failed == 0 ) {
00355         printf( "PASSED: row-major high-level interface to zpbrfs\n" );
00356     } else {
00357         printf( "FAILED: row-major high-level interface to zpbrfs\n" );
00358     }
00359 
00360     /* Release memory */
00361     if( ab != NULL ) {
00362         LAPACKE_free( ab );
00363     }
00364     if( ab_i != NULL ) {
00365         LAPACKE_free( ab_i );
00366     }
00367     if( ab_r != NULL ) {
00368         LAPACKE_free( ab_r );
00369     }
00370     if( afb != NULL ) {
00371         LAPACKE_free( afb );
00372     }
00373     if( afb_i != NULL ) {
00374         LAPACKE_free( afb_i );
00375     }
00376     if( afb_r != NULL ) {
00377         LAPACKE_free( afb_r );
00378     }
00379     if( b != NULL ) {
00380         LAPACKE_free( b );
00381     }
00382     if( b_i != NULL ) {
00383         LAPACKE_free( b_i );
00384     }
00385     if( b_r != NULL ) {
00386         LAPACKE_free( b_r );
00387     }
00388     if( x != NULL ) {
00389         LAPACKE_free( x );
00390     }
00391     if( x_i != NULL ) {
00392         LAPACKE_free( x_i );
00393     }
00394     if( x_r != NULL ) {
00395         LAPACKE_free( x_r );
00396     }
00397     if( x_save != NULL ) {
00398         LAPACKE_free( x_save );
00399     }
00400     if( ferr != NULL ) {
00401         LAPACKE_free( ferr );
00402     }
00403     if( ferr_i != NULL ) {
00404         LAPACKE_free( ferr_i );
00405     }
00406     if( ferr_save != NULL ) {
00407         LAPACKE_free( ferr_save );
00408     }
00409     if( berr != NULL ) {
00410         LAPACKE_free( berr );
00411     }
00412     if( berr_i != NULL ) {
00413         LAPACKE_free( berr_i );
00414     }
00415     if( berr_save != NULL ) {
00416         LAPACKE_free( berr_save );
00417     }
00418     if( work != NULL ) {
00419         LAPACKE_free( work );
00420     }
00421     if( work_i != NULL ) {
00422         LAPACKE_free( work_i );
00423     }
00424     if( rwork != NULL ) {
00425         LAPACKE_free( rwork );
00426     }
00427     if( rwork_i != NULL ) {
00428         LAPACKE_free( rwork_i );
00429     }
00430 
00431     return 0;
00432 }
00433 
00434 /* Auxiliary function: zpbrfs scalar parameters initialization */
00435 static void init_scalars_zpbrfs( char *uplo, lapack_int *n, lapack_int *kd,
00436                                  lapack_int *nrhs, lapack_int *ldab,
00437                                  lapack_int *ldafb, lapack_int *ldb,
00438                                  lapack_int *ldx )
00439 {
00440     *uplo = 'L';
00441     *n = 4;
00442     *kd = 1;
00443     *nrhs = 2;
00444     *ldab = 9;
00445     *ldafb = 9;
00446     *ldb = 8;
00447     *ldx = 8;
00448 
00449     return;
00450 }
00451 
00452 /* Auxiliary functions: zpbrfs array parameters initialization */
00453 static void init_ab( lapack_int size, lapack_complex_double *ab ) {
00454     lapack_int i;
00455     for( i = 0; i < size; i++ ) {
00456         ab[i] = lapack_make_complex_double( 0.0, 0.0 );
00457     }
00458     ab[0] = lapack_make_complex_double( 9.39000000000000060e+000,
00459                                         0.00000000000000000e+000 );
00460     ab[9] = lapack_make_complex_double( 1.68999999999999990e+000,
00461                                         0.00000000000000000e+000 );
00462     ab[18] = lapack_make_complex_double( 2.64999999999999990e+000,
00463                                          0.00000000000000000e+000 );
00464     ab[27] = lapack_make_complex_double( 2.16999999999999990e+000,
00465                                          0.00000000000000000e+000 );
00466     ab[1] = lapack_make_complex_double( 1.08000000000000010e+000,
00467                                         1.73000000000000000e+000 );
00468     ab[10] = lapack_make_complex_double( -4.00000000000000010e-002,
00469                                          -2.89999999999999980e-001 );
00470     ab[19] = lapack_make_complex_double( -3.30000000000000020e-001,
00471                                          -2.24000000000000020e+000 );
00472     ab[28] = lapack_make_complex_double( 0.00000000000000000e+000,
00473                                          0.00000000000000000e+000 );
00474 }
00475 static void init_afb( lapack_int size, lapack_complex_double *afb ) {
00476     lapack_int i;
00477     for( i = 0; i < size; i++ ) {
00478         afb[i] = lapack_make_complex_double( 0.0, 0.0 );
00479     }
00480     afb[0] = lapack_make_complex_double( 3.06431068920891250e+000,
00481                                          0.00000000000000000e+000 );
00482     afb[9] = lapack_make_complex_double( 1.11671395318950690e+000,
00483                                          0.00000000000000000e+000 );
00484     afb[18] = lapack_make_complex_double( 1.60663555873113610e+000,
00485                                           0.00000000000000000e+000 );
00486     afb[27] = lapack_make_complex_double( 4.28915067402645010e-001,
00487                                           0.00000000000000000e+000 );
00488     afb[1] = lapack_make_complex_double( 3.52444679909012350e-001,
00489                                          5.64564163187584510e-001 );
00490     afb[10] = lapack_make_complex_double( -3.58193787099676180e-002,
00491                                           -2.59690495647265210e-001 );
00492     afb[19] = lapack_make_complex_double( -2.05398167746655840e-001,
00493                                           -1.39421786591669420e+000 );
00494     afb[28] = lapack_make_complex_double( 0.00000000000000000e+000,
00495                                           0.00000000000000000e+000 );
00496 }
00497 static void init_b( lapack_int size, lapack_complex_double *b ) {
00498     lapack_int i;
00499     for( i = 0; i < size; i++ ) {
00500         b[i] = lapack_make_complex_double( 0.0, 0.0 );
00501     }
00502     b[0] = lapack_make_complex_double( -1.24200000000000000e+001,
00503                                        6.84200000000000020e+001 );
00504     b[8] = lapack_make_complex_double( 5.42999999999999970e+001,
00505                                        -5.65600000000000020e+001 );
00506     b[1] = lapack_make_complex_double( -9.92999999999999970e+000,
00507                                        8.80000000000000000e-001 );
00508     b[9] = lapack_make_complex_double( 1.83200000000000000e+001,
00509                                        4.75999999999999980e+000 );
00510     b[2] = lapack_make_complex_double( -2.73000000000000010e+001,
00511                                        -1.00000000000000000e-002 );
00512     b[10] = lapack_make_complex_double( -4.40000000000000040e+000,
00513                                         9.97000000000000060e+000 );
00514     b[3] = lapack_make_complex_double( 5.30999999999999960e+000,
00515                                        2.36299999999999990e+001 );
00516     b[11] = lapack_make_complex_double( 9.42999999999999970e+000,
00517                                         1.40999999999999990e+000 );
00518 }
00519 static void init_x( lapack_int size, lapack_complex_double *x ) {
00520     lapack_int i;
00521     for( i = 0; i < size; i++ ) {
00522         x[i] = lapack_make_complex_double( 0.0, 0.0 );
00523     }
00524     x[0] = lapack_make_complex_double( -1.00000000000000020e+000,
00525                                        7.99999999999999820e+000 );
00526     x[8] = lapack_make_complex_double( 4.99999999999999730e+000,
00527                                        -5.99999999999999910e+000 );
00528     x[1] = lapack_make_complex_double( 1.99999999999999820e+000,
00529                                        -2.99999999999999870e+000 );
00530     x[9] = lapack_make_complex_double( 1.99999999999999930e+000,
00531                                        3.00000000000000440e+000 );
00532     x[2] = lapack_make_complex_double( -4.00000000000000800e+000,
00533                                        -5.00000000000000360e+000 );
00534     x[10] = lapack_make_complex_double( -8.00000000000000890e+000,
00535                                         3.99999999999999780e+000 );
00536     x[3] = lapack_make_complex_double( 7.00000000000000090e+000,
00537                                        5.99999999999999200e+000 );
00538     x[11] = lapack_make_complex_double( -9.99999999999998780e-001,
00539                                         -7.00000000000000890e+000 );
00540 }
00541 static void init_ferr( lapack_int size, double *ferr ) {
00542     lapack_int i;
00543     for( i = 0; i < size; i++ ) {
00544         ferr[i] = 0;
00545     }
00546 }
00547 static void init_berr( lapack_int size, double *berr ) {
00548     lapack_int i;
00549     for( i = 0; i < size; i++ ) {
00550         berr[i] = 0;
00551     }
00552 }
00553 static void init_work( lapack_int size, lapack_complex_double *work ) {
00554     lapack_int i;
00555     for( i = 0; i < size; i++ ) {
00556         work[i] = lapack_make_complex_double( 0.0, 0.0 );
00557     }
00558 }
00559 static void init_rwork( lapack_int size, double *rwork ) {
00560     lapack_int i;
00561     for( i = 0; i < size; i++ ) {
00562         rwork[i] = 0;
00563     }
00564 }
00565 
00566 /* Auxiliary function: C interface to zpbrfs results check */
00567 /* Return value: 0 - test is passed, non-zero - test is failed */
00568 static int compare_zpbrfs( lapack_complex_double *x, lapack_complex_double *x_i,
00569                            double *ferr, double *ferr_i, double *berr,
00570                            double *berr_i, lapack_int info, lapack_int info_i,
00571                            lapack_int ldx, lapack_int nrhs )
00572 {
00573     lapack_int i;
00574     int failed = 0;
00575     for( i = 0; i < ldx*nrhs; i++ ) {
00576         failed += compare_complex_doubles(x[i],x_i[i]);
00577     }
00578     for( i = 0; i < nrhs; i++ ) {
00579         failed += compare_doubles(ferr[i],ferr_i[i]);
00580     }
00581     for( i = 0; i < nrhs; i++ ) {
00582         failed += compare_doubles(berr[i],berr_i[i]);
00583     }
00584     failed += (info == info_i) ? 0 : 1;
00585     if( info != 0 || info_i != 0 ) {
00586         printf( "info=%d, info_i=%d\n",(int)info,(int)info_i );
00587     }
00588 
00589     return failed;
00590 }


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