zporfs_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 * zporfs_1 is the test program for the C interface to LAPACK
00036 * routine zporfs
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_zporfs( 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_b( lapack_int size, lapack_complex_double *b );
00060 static void init_x( lapack_int size, lapack_complex_double *x );
00061 static void init_ferr( lapack_int size, double *ferr );
00062 static void init_berr( lapack_int size, double *berr );
00063 static void init_work( lapack_int size, lapack_complex_double *work );
00064 static void init_rwork( lapack_int size, double *rwork );
00065 static int compare_zporfs( lapack_complex_double *x, lapack_complex_double *x_i,
00066                            double *ferr, double *ferr_i, double *berr,
00067                            double *berr_i, lapack_int info, lapack_int info_i,
00068                            lapack_int ldx, lapack_int nrhs );
00069 
00070 int main(void)
00071 {
00072     /* Local scalars */
00073     char uplo, uplo_i;
00074     lapack_int n, n_i;
00075     lapack_int nrhs, nrhs_i;
00076     lapack_int lda, lda_i;
00077     lapack_int lda_r;
00078     lapack_int ldaf, ldaf_i;
00079     lapack_int ldaf_r;
00080     lapack_int ldb, ldb_i;
00081     lapack_int ldb_r;
00082     lapack_int ldx, ldx_i;
00083     lapack_int ldx_r;
00084     lapack_int info, info_i;
00085     lapack_int i;
00086     int failed;
00087 
00088     /* Local arrays */
00089     lapack_complex_double *a = NULL, *a_i = NULL;
00090     lapack_complex_double *af = NULL, *af_i = NULL;
00091     lapack_complex_double *b = NULL, *b_i = NULL;
00092     lapack_complex_double *x = NULL, *x_i = NULL;
00093     double *ferr = NULL, *ferr_i = NULL;
00094     double *berr = NULL, *berr_i = NULL;
00095     lapack_complex_double *work = NULL, *work_i = NULL;
00096     double *rwork = NULL, *rwork_i = NULL;
00097     lapack_complex_double *x_save = NULL;
00098     double *ferr_save = NULL;
00099     double *berr_save = NULL;
00100     lapack_complex_double *a_r = NULL;
00101     lapack_complex_double *af_r = NULL;
00102     lapack_complex_double *b_r = NULL;
00103     lapack_complex_double *x_r = NULL;
00104 
00105     /* Iniitialize the scalar parameters */
00106     init_scalars_zporfs( &uplo, &n, &nrhs, &lda, &ldaf, &ldb, &ldx );
00107     lda_r = n+2;
00108     ldaf_r = n+2;
00109     ldb_r = nrhs+2;
00110     ldx_r = nrhs+2;
00111     uplo_i = uplo;
00112     n_i = n;
00113     nrhs_i = nrhs;
00114     lda_i = lda;
00115     ldaf_i = ldaf;
00116     ldb_i = ldb;
00117     ldx_i = ldx;
00118 
00119     /* Allocate memory for the LAPACK routine arrays */
00120     a = (lapack_complex_double *)
00121         LAPACKE_malloc( lda*n * sizeof(lapack_complex_double) );
00122     af = (lapack_complex_double *)
00123         LAPACKE_malloc( ldaf*n * sizeof(lapack_complex_double) );
00124     b = (lapack_complex_double *)
00125         LAPACKE_malloc( ldb*nrhs * sizeof(lapack_complex_double) );
00126     x = (lapack_complex_double *)
00127         LAPACKE_malloc( ldx*nrhs * sizeof(lapack_complex_double) );
00128     ferr = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00129     berr = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00130     work = (lapack_complex_double *)
00131         LAPACKE_malloc( 2*n * sizeof(lapack_complex_double) );
00132     rwork = (double *)LAPACKE_malloc( n * sizeof(double) );
00133 
00134     /* Allocate memory for the C interface function arrays */
00135     a_i = (lapack_complex_double *)
00136         LAPACKE_malloc( lda*n * sizeof(lapack_complex_double) );
00137     af_i = (lapack_complex_double *)
00138         LAPACKE_malloc( ldaf*n * sizeof(lapack_complex_double) );
00139     b_i = (lapack_complex_double *)
00140         LAPACKE_malloc( ldb*nrhs * sizeof(lapack_complex_double) );
00141     x_i = (lapack_complex_double *)
00142         LAPACKE_malloc( ldx*nrhs * sizeof(lapack_complex_double) );
00143     ferr_i = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00144     berr_i = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00145     work_i = (lapack_complex_double *)
00146         LAPACKE_malloc( 2*n * sizeof(lapack_complex_double) );
00147     rwork_i = (double *)LAPACKE_malloc( n * sizeof(double) );
00148 
00149     /* Allocate memory for the backup arrays */
00150     x_save = (lapack_complex_double *)
00151         LAPACKE_malloc( ldx*nrhs * sizeof(lapack_complex_double) );
00152     ferr_save = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00153     berr_save = (double *)LAPACKE_malloc( nrhs * sizeof(double) );
00154 
00155     /* Allocate memory for the row-major arrays */
00156     a_r = (lapack_complex_double *)
00157         LAPACKE_malloc( n*(n+2) * sizeof(lapack_complex_double) );
00158     af_r = (lapack_complex_double *)
00159         LAPACKE_malloc( n*(n+2) * sizeof(lapack_complex_double) );
00160     b_r = (lapack_complex_double *)
00161         LAPACKE_malloc( n*(nrhs+2) * sizeof(lapack_complex_double) );
00162     x_r = (lapack_complex_double *)
00163         LAPACKE_malloc( n*(nrhs+2) * sizeof(lapack_complex_double) );
00164 
00165     /* Initialize input arrays */
00166     init_a( lda*n, a );
00167     init_af( ldaf*n, af );
00168     init_b( ldb*nrhs, b );
00169     init_x( ldx*nrhs, x );
00170     init_ferr( nrhs, ferr );
00171     init_berr( nrhs, berr );
00172     init_work( 2*n, work );
00173     init_rwork( n, rwork );
00174 
00175     /* Backup the ouptut arrays */
00176     for( i = 0; i < ldx*nrhs; i++ ) {
00177         x_save[i] = x[i];
00178     }
00179     for( i = 0; i < nrhs; i++ ) {
00180         ferr_save[i] = ferr[i];
00181     }
00182     for( i = 0; i < nrhs; i++ ) {
00183         berr_save[i] = berr[i];
00184     }
00185 
00186     /* Call the LAPACK routine */
00187     zporfs_( &uplo, &n, &nrhs, a, &lda, af, &ldaf, b, &ldb, x, &ldx, ferr, berr,
00188              work, rwork, &info );
00189 
00190     /* Initialize input data, call the column-major middle-level
00191      * interface to LAPACK routine and check the results */
00192     for( i = 0; i < lda*n; i++ ) {
00193         a_i[i] = a[i];
00194     }
00195     for( i = 0; i < ldaf*n; i++ ) {
00196         af_i[i] = af[i];
00197     }
00198     for( i = 0; i < ldb*nrhs; i++ ) {
00199         b_i[i] = b[i];
00200     }
00201     for( i = 0; i < ldx*nrhs; i++ ) {
00202         x_i[i] = x_save[i];
00203     }
00204     for( i = 0; i < nrhs; i++ ) {
00205         ferr_i[i] = ferr_save[i];
00206     }
00207     for( i = 0; i < nrhs; i++ ) {
00208         berr_i[i] = berr_save[i];
00209     }
00210     for( i = 0; i < 2*n; i++ ) {
00211         work_i[i] = work[i];
00212     }
00213     for( i = 0; i < n; i++ ) {
00214         rwork_i[i] = rwork[i];
00215     }
00216     info_i = LAPACKE_zporfs_work( LAPACK_COL_MAJOR, uplo_i, n_i, nrhs_i, a_i,
00217                                   lda_i, af_i, ldaf_i, b_i, ldb_i, x_i, ldx_i,
00218                                   ferr_i, berr_i, work_i, rwork_i );
00219 
00220     failed = compare_zporfs( x, x_i, ferr, ferr_i, berr, berr_i, info, info_i,
00221                              ldx, nrhs );
00222     if( failed == 0 ) {
00223         printf( "PASSED: column-major middle-level interface to zporfs\n" );
00224     } else {
00225         printf( "FAILED: column-major middle-level interface to zporfs\n" );
00226     }
00227 
00228     /* Initialize input data, call the column-major high-level
00229      * interface to LAPACK routine and check the results */
00230     for( i = 0; i < lda*n; i++ ) {
00231         a_i[i] = a[i];
00232     }
00233     for( i = 0; i < ldaf*n; i++ ) {
00234         af_i[i] = af[i];
00235     }
00236     for( i = 0; i < ldb*nrhs; i++ ) {
00237         b_i[i] = b[i];
00238     }
00239     for( i = 0; i < ldx*nrhs; i++ ) {
00240         x_i[i] = x_save[i];
00241     }
00242     for( i = 0; i < nrhs; i++ ) {
00243         ferr_i[i] = ferr_save[i];
00244     }
00245     for( i = 0; i < nrhs; i++ ) {
00246         berr_i[i] = berr_save[i];
00247     }
00248     for( i = 0; i < 2*n; i++ ) {
00249         work_i[i] = work[i];
00250     }
00251     for( i = 0; i < n; i++ ) {
00252         rwork_i[i] = rwork[i];
00253     }
00254     info_i = LAPACKE_zporfs( LAPACK_COL_MAJOR, uplo_i, n_i, nrhs_i, a_i, lda_i,
00255                              af_i, ldaf_i, b_i, ldb_i, x_i, ldx_i, ferr_i,
00256                              berr_i );
00257 
00258     failed = compare_zporfs( x, x_i, ferr, ferr_i, berr, berr_i, info, info_i,
00259                              ldx, nrhs );
00260     if( failed == 0 ) {
00261         printf( "PASSED: column-major high-level interface to zporfs\n" );
00262     } else {
00263         printf( "FAILED: column-major high-level interface to zporfs\n" );
00264     }
00265 
00266     /* Initialize input data, call the row-major middle-level
00267      * interface to LAPACK routine and check the results */
00268     for( i = 0; i < lda*n; i++ ) {
00269         a_i[i] = a[i];
00270     }
00271     for( i = 0; i < ldaf*n; i++ ) {
00272         af_i[i] = af[i];
00273     }
00274     for( i = 0; i < ldb*nrhs; i++ ) {
00275         b_i[i] = b[i];
00276     }
00277     for( i = 0; i < ldx*nrhs; i++ ) {
00278         x_i[i] = x_save[i];
00279     }
00280     for( i = 0; i < nrhs; i++ ) {
00281         ferr_i[i] = ferr_save[i];
00282     }
00283     for( i = 0; i < nrhs; i++ ) {
00284         berr_i[i] = berr_save[i];
00285     }
00286     for( i = 0; i < 2*n; i++ ) {
00287         work_i[i] = work[i];
00288     }
00289     for( i = 0; i < n; i++ ) {
00290         rwork_i[i] = rwork[i];
00291     }
00292 
00293     LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, a_i, lda, a_r, n+2 );
00294     LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, af_i, ldaf, af_r, n+2 );
00295     LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, b_i, ldb, b_r, nrhs+2 );
00296     LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, x_i, ldx, x_r, nrhs+2 );
00297     info_i = LAPACKE_zporfs_work( LAPACK_ROW_MAJOR, uplo_i, n_i, nrhs_i, a_r,
00298                                   lda_r, af_r, ldaf_r, b_r, ldb_r, x_r, ldx_r,
00299                                   ferr_i, berr_i, work_i, rwork_i );
00300 
00301     LAPACKE_zge_trans( LAPACK_ROW_MAJOR, n, nrhs, x_r, nrhs+2, x_i, ldx );
00302 
00303     failed = compare_zporfs( x, x_i, ferr, ferr_i, berr, berr_i, info, info_i,
00304                              ldx, nrhs );
00305     if( failed == 0 ) {
00306         printf( "PASSED: row-major middle-level interface to zporfs\n" );
00307     } else {
00308         printf( "FAILED: row-major middle-level interface to zporfs\n" );
00309     }
00310 
00311     /* Initialize input data, call the row-major high-level
00312      * interface to LAPACK routine and check the results */
00313     for( i = 0; i < lda*n; i++ ) {
00314         a_i[i] = a[i];
00315     }
00316     for( i = 0; i < ldaf*n; i++ ) {
00317         af_i[i] = af[i];
00318     }
00319     for( i = 0; i < ldb*nrhs; i++ ) {
00320         b_i[i] = b[i];
00321     }
00322     for( i = 0; i < ldx*nrhs; i++ ) {
00323         x_i[i] = x_save[i];
00324     }
00325     for( i = 0; i < nrhs; i++ ) {
00326         ferr_i[i] = ferr_save[i];
00327     }
00328     for( i = 0; i < nrhs; i++ ) {
00329         berr_i[i] = berr_save[i];
00330     }
00331     for( i = 0; i < 2*n; i++ ) {
00332         work_i[i] = work[i];
00333     }
00334     for( i = 0; i < n; i++ ) {
00335         rwork_i[i] = rwork[i];
00336     }
00337 
00338     /* Init row_major arrays */
00339     LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, a_i, lda, a_r, n+2 );
00340     LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, af_i, ldaf, af_r, n+2 );
00341     LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, b_i, ldb, b_r, nrhs+2 );
00342     LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, nrhs, x_i, ldx, x_r, nrhs+2 );
00343     info_i = LAPACKE_zporfs( LAPACK_ROW_MAJOR, uplo_i, n_i, nrhs_i, a_r, lda_r,
00344                              af_r, ldaf_r, b_r, ldb_r, x_r, ldx_r, ferr_i,
00345                              berr_i );
00346 
00347     LAPACKE_zge_trans( LAPACK_ROW_MAJOR, n, nrhs, x_r, nrhs+2, x_i, ldx );
00348 
00349     failed = compare_zporfs( x, x_i, ferr, ferr_i, berr, berr_i, info, info_i,
00350                              ldx, nrhs );
00351     if( failed == 0 ) {
00352         printf( "PASSED: row-major high-level interface to zporfs\n" );
00353     } else {
00354         printf( "FAILED: row-major high-level interface to zporfs\n" );
00355     }
00356 
00357     /* Release memory */
00358     if( a != NULL ) {
00359         LAPACKE_free( a );
00360     }
00361     if( a_i != NULL ) {
00362         LAPACKE_free( a_i );
00363     }
00364     if( a_r != NULL ) {
00365         LAPACKE_free( a_r );
00366     }
00367     if( af != NULL ) {
00368         LAPACKE_free( af );
00369     }
00370     if( af_i != NULL ) {
00371         LAPACKE_free( af_i );
00372     }
00373     if( af_r != NULL ) {
00374         LAPACKE_free( af_r );
00375     }
00376     if( b != NULL ) {
00377         LAPACKE_free( b );
00378     }
00379     if( b_i != NULL ) {
00380         LAPACKE_free( b_i );
00381     }
00382     if( b_r != NULL ) {
00383         LAPACKE_free( b_r );
00384     }
00385     if( x != NULL ) {
00386         LAPACKE_free( x );
00387     }
00388     if( x_i != NULL ) {
00389         LAPACKE_free( x_i );
00390     }
00391     if( x_r != NULL ) {
00392         LAPACKE_free( x_r );
00393     }
00394     if( x_save != NULL ) {
00395         LAPACKE_free( x_save );
00396     }
00397     if( ferr != NULL ) {
00398         LAPACKE_free( ferr );
00399     }
00400     if( ferr_i != NULL ) {
00401         LAPACKE_free( ferr_i );
00402     }
00403     if( ferr_save != NULL ) {
00404         LAPACKE_free( ferr_save );
00405     }
00406     if( berr != NULL ) {
00407         LAPACKE_free( berr );
00408     }
00409     if( berr_i != NULL ) {
00410         LAPACKE_free( berr_i );
00411     }
00412     if( berr_save != NULL ) {
00413         LAPACKE_free( berr_save );
00414     }
00415     if( work != NULL ) {
00416         LAPACKE_free( work );
00417     }
00418     if( work_i != NULL ) {
00419         LAPACKE_free( work_i );
00420     }
00421     if( rwork != NULL ) {
00422         LAPACKE_free( rwork );
00423     }
00424     if( rwork_i != NULL ) {
00425         LAPACKE_free( rwork_i );
00426     }
00427 
00428     return 0;
00429 }
00430 
00431 /* Auxiliary function: zporfs scalar parameters initialization */
00432 static void init_scalars_zporfs( char *uplo, lapack_int *n, lapack_int *nrhs,
00433                                  lapack_int *lda, lapack_int *ldaf,
00434                                  lapack_int *ldb, lapack_int *ldx )
00435 {
00436     *uplo = 'L';
00437     *n = 4;
00438     *nrhs = 2;
00439     *lda = 8;
00440     *ldaf = 8;
00441     *ldb = 8;
00442     *ldx = 8;
00443 
00444     return;
00445 }
00446 
00447 /* Auxiliary functions: zporfs array parameters initialization */
00448 static void init_a( lapack_int size, lapack_complex_double *a ) {
00449     lapack_int i;
00450     for( i = 0; i < size; i++ ) {
00451         a[i] = lapack_make_complex_double( 0.0, 0.0 );
00452     }
00453     a[0] = lapack_make_complex_double( 3.23000000000000000e+000,
00454                                        0.00000000000000000e+000 );
00455     a[8] = lapack_make_complex_double( 0.00000000000000000e+000,
00456                                        0.00000000000000000e+000 );
00457     a[16] = lapack_make_complex_double( 0.00000000000000000e+000,
00458                                         0.00000000000000000e+000 );
00459     a[24] = lapack_make_complex_double( 0.00000000000000000e+000,
00460                                         0.00000000000000000e+000 );
00461     a[1] = lapack_make_complex_double( 1.51000000000000000e+000,
00462                                        1.91999999999999990e+000 );
00463     a[9] = lapack_make_complex_double( 3.58000000000000010e+000,
00464                                        0.00000000000000000e+000 );
00465     a[17] = lapack_make_complex_double( 0.00000000000000000e+000,
00466                                         0.00000000000000000e+000 );
00467     a[25] = lapack_make_complex_double( 0.00000000000000000e+000,
00468                                         0.00000000000000000e+000 );
00469     a[2] = lapack_make_complex_double( 1.89999999999999990e+000,
00470                                        -8.39999999999999970e-001 );
00471     a[10] = lapack_make_complex_double( -2.30000000000000010e-001,
00472                                         -1.11000000000000010e+000 );
00473     a[18] = lapack_make_complex_double( 4.08999999999999990e+000,
00474                                         0.00000000000000000e+000 );
00475     a[26] = lapack_make_complex_double( 0.00000000000000000e+000,
00476                                         0.00000000000000000e+000 );
00477     a[3] = lapack_make_complex_double( 4.19999999999999980e-001,
00478                                        -2.50000000000000000e+000 );
00479     a[11] = lapack_make_complex_double( -1.17999999999999990e+000,
00480                                         -1.37000000000000010e+000 );
00481     a[19] = lapack_make_complex_double( 2.33000000000000010e+000,
00482                                         1.40000000000000010e-001 );
00483     a[27] = lapack_make_complex_double( 4.29000000000000000e+000,
00484                                         0.00000000000000000e+000 );
00485 }
00486 static void init_af( lapack_int size, lapack_complex_double *af ) {
00487     lapack_int i;
00488     for( i = 0; i < size; i++ ) {
00489         af[i] = lapack_make_complex_double( 0.0, 0.0 );
00490     }
00491     af[0] = lapack_make_complex_double( 1.79722007556114290e+000,
00492                                         0.00000000000000000e+000 );
00493     af[8] = lapack_make_complex_double( 0.00000000000000000e+000,
00494                                         0.00000000000000000e+000 );
00495     af[16] = lapack_make_complex_double( 0.00000000000000000e+000,
00496                                          0.00000000000000000e+000 );
00497     af[24] = lapack_make_complex_double( 0.00000000000000000e+000,
00498                                          0.00000000000000000e+000 );
00499     af[1] = lapack_make_complex_double( 8.40186474952732460e-001,
00500                                         1.06831657742334190e+000 );
00501     af[9] = lapack_make_complex_double( 1.31635343950968520e+000,
00502                                         0.00000000000000000e+000 );
00503     af[17] = lapack_make_complex_double( 0.00000000000000000e+000,
00504                                          0.00000000000000000e+000 );
00505     af[25] = lapack_make_complex_double( 0.00000000000000000e+000,
00506                                          0.00000000000000000e+000 );
00507     af[2] = lapack_make_complex_double( 1.05718827974184860e+000,
00508                                         -4.67388502622712030e-001 );
00509     af[10] = lapack_make_complex_double( -4.70174947010632950e-001,
00510                                          3.13065815599946400e-001 );
00511     af[18] = lapack_make_complex_double( 1.56039297713712430e+000,
00512                                          0.00000000000000000e+000 );
00513     af[26] = lapack_make_complex_double( 0.00000000000000000e+000,
00514                                          0.00000000000000000e+000 );
00515     af[3] = lapack_make_complex_double( 2.33694251311356020e-001,
00516                                         -1.39103721018664310e+000 );
00517     af[11] = lapack_make_complex_double( 8.33525092394419580e-002,
00518                                          3.67607144303747430e-002 );
00519     af[19] = lapack_make_complex_double( 9.35961733792340160e-001,
00520                                          9.89969219281573660e-001 );
00521     af[27] = lapack_make_complex_double( 6.60333297365589100e-001,
00522                                          0.00000000000000000e+000 );
00523 }
00524 static void init_b( lapack_int size, lapack_complex_double *b ) {
00525     lapack_int i;
00526     for( i = 0; i < size; i++ ) {
00527         b[i] = lapack_make_complex_double( 0.0, 0.0 );
00528     }
00529     b[0] = lapack_make_complex_double( 3.93000000000000020e+000,
00530                                        -6.13999999999999970e+000 );
00531     b[8] = lapack_make_complex_double( 1.48000000000000000e+000,
00532                                        6.58000000000000010e+000 );
00533     b[1] = lapack_make_complex_double( 6.16999999999999990e+000,
00534                                        9.41999999999999990e+000 );
00535     b[9] = lapack_make_complex_double( 4.65000000000000040e+000,
00536                                        -4.75000000000000000e+000 );
00537     b[2] = lapack_make_complex_double( -7.16999999999999990e+000,
00538                                        -2.18299999999999980e+001 );
00539     b[10] = lapack_make_complex_double( -4.91000000000000010e+000,
00540                                         2.29000000000000000e+000 );
00541     b[3] = lapack_make_complex_double( 1.99000000000000000e+000,
00542                                        -1.43800000000000010e+001 );
00543     b[11] = lapack_make_complex_double( 7.63999999999999970e+000,
00544                                         -1.07899999999999990e+001 );
00545 }
00546 static void init_x( lapack_int size, lapack_complex_double *x ) {
00547     lapack_int i;
00548     for( i = 0; i < size; i++ ) {
00549         x[i] = lapack_make_complex_double( 0.0, 0.0 );
00550     }
00551     x[0] = lapack_make_complex_double( 1.00000000000000380e+000,
00552                                        -1.00000000000001200e+000 );
00553     x[8] = lapack_make_complex_double( -1.00000000000000490e+000,
00554                                        2.00000000000000930e+000 );
00555     x[1] = lapack_make_complex_double( -4.55440321195874030e-015,
00556                                        3.00000000000000220e+000 );
00557     x[9] = lapack_make_complex_double( 3.00000000000000440e+000,
00558                                        -3.99999999999999960e+000 );
00559     x[2] = lapack_make_complex_double( -4.00000000000000440e+000,
00560                                        -4.99999999999999470e+000 );
00561     x[10] = lapack_make_complex_double( -1.99999999999999530e+000,
00562                                         2.99999999999999600e+000 );
00563     x[3] = lapack_make_complex_double( 2.00000000000000710e+000,
00564                                        9.99999999999999780e-001 );
00565     x[11] = lapack_make_complex_double( 3.99999999999999290e+000,
00566                                         -4.99999999999999910e+000 );
00567 }
00568 static void init_ferr( lapack_int size, double *ferr ) {
00569     lapack_int i;
00570     for( i = 0; i < size; i++ ) {
00571         ferr[i] = 0;
00572     }
00573 }
00574 static void init_berr( lapack_int size, double *berr ) {
00575     lapack_int i;
00576     for( i = 0; i < size; i++ ) {
00577         berr[i] = 0;
00578     }
00579 }
00580 static void init_work( lapack_int size, lapack_complex_double *work ) {
00581     lapack_int i;
00582     for( i = 0; i < size; i++ ) {
00583         work[i] = lapack_make_complex_double( 0.0, 0.0 );
00584     }
00585 }
00586 static void init_rwork( lapack_int size, double *rwork ) {
00587     lapack_int i;
00588     for( i = 0; i < size; i++ ) {
00589         rwork[i] = 0;
00590     }
00591 }
00592 
00593 /* Auxiliary function: C interface to zporfs results check */
00594 /* Return value: 0 - test is passed, non-zero - test is failed */
00595 static int compare_zporfs( lapack_complex_double *x, lapack_complex_double *x_i,
00596                            double *ferr, double *ferr_i, double *berr,
00597                            double *berr_i, lapack_int info, lapack_int info_i,
00598                            lapack_int ldx, lapack_int nrhs )
00599 {
00600     lapack_int i;
00601     int failed = 0;
00602     for( i = 0; i < ldx*nrhs; i++ ) {
00603         failed += compare_complex_doubles(x[i],x_i[i]);
00604     }
00605     for( i = 0; i < nrhs; i++ ) {
00606         failed += compare_doubles(ferr[i],ferr_i[i]);
00607     }
00608     for( i = 0; i < nrhs; i++ ) {
00609         failed += compare_doubles(berr[i],berr_i[i]);
00610     }
00611     failed += (info == info_i) ? 0 : 1;
00612     if( info != 0 || info_i != 0 ) {
00613         printf( "info=%d, info_i=%d\n",(int)info,(int)info_i );
00614     }
00615 
00616     return failed;
00617 }


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