ztrevc_2.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 * ztrevc_2 is the test program for the C interface to LAPACK
00036 * routine ztrevc
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_ztrevc( char *side, char *howmny, lapack_int *n,
00055                                  lapack_int *ldt, lapack_int *ldvl,
00056                                  lapack_int *ldvr, lapack_int *mm );
00057 static void init_select( lapack_int size, lapack_int *select );
00058 static void init_t( lapack_int size, lapack_complex_double *t );
00059 static void init_vl( lapack_int size, lapack_complex_double *vl );
00060 static void init_vr( lapack_int size, lapack_complex_double *vr );
00061 static void init_work( lapack_int size, lapack_complex_double *work );
00062 static void init_rwork( lapack_int size, double *rwork );
00063 static int compare_ztrevc( lapack_complex_double *t, lapack_complex_double *t_i,
00064                            lapack_complex_double *vl,
00065                            lapack_complex_double *vl_i,
00066                            lapack_complex_double *vr,
00067                            lapack_complex_double *vr_i, lapack_int m,
00068                            lapack_int m_i, lapack_int info, lapack_int info_i,
00069                            lapack_int ldt, lapack_int ldvl, lapack_int ldvr,
00070                            lapack_int mm, lapack_int n, char side );
00071 
00072 int main(void)
00073 {
00074     /* Local scalars */
00075     char side, side_i;
00076     char howmny, howmny_i;
00077     lapack_int n, n_i;
00078     lapack_int ldt, ldt_i;
00079     lapack_int ldt_r;
00080     lapack_int ldvl, ldvl_i;
00081     lapack_int ldvl_r;
00082     lapack_int ldvr, ldvr_i;
00083     lapack_int ldvr_r;
00084     lapack_int mm, mm_i;
00085     lapack_int m, m_i;
00086     lapack_int info, info_i;
00087     lapack_int i;
00088     int failed;
00089 
00090     /* Local arrays */
00091     lapack_int *select = NULL, *select_i = NULL;
00092     lapack_complex_double *t = NULL, *t_i = NULL;
00093     lapack_complex_double *vl = NULL, *vl_i = NULL;
00094     lapack_complex_double *vr = NULL, *vr_i = NULL;
00095     lapack_complex_double *work = NULL, *work_i = NULL;
00096     double *rwork = NULL, *rwork_i = NULL;
00097     lapack_complex_double *t_save = NULL;
00098     lapack_complex_double *vl_save = NULL;
00099     lapack_complex_double *vr_save = NULL;
00100     lapack_complex_double *t_r = NULL;
00101     lapack_complex_double *vl_r = NULL;
00102     lapack_complex_double *vr_r = NULL;
00103 
00104     /* Iniitialize the scalar parameters */
00105     init_scalars_ztrevc( &side, &howmny, &n, &ldt, &ldvl, &ldvr, &mm );
00106     ldt_r = n+2;
00107     ldvl_r = mm+2;
00108     ldvr_r = mm+2;
00109     side_i = side;
00110     howmny_i = howmny;
00111     n_i = n;
00112     ldt_i = ldt;
00113     ldvl_i = ldvl;
00114     ldvr_i = ldvr;
00115     mm_i = mm;
00116 
00117     /* Allocate memory for the LAPACK routine arrays */
00118     select = (lapack_int *)LAPACKE_malloc( n * sizeof(lapack_int) );
00119     t = (lapack_complex_double *)
00120         LAPACKE_malloc( ldt*n * sizeof(lapack_complex_double) );
00121     vl = (lapack_complex_double *)
00122         LAPACKE_malloc( ldvl*mm * sizeof(lapack_complex_double) );
00123     vr = (lapack_complex_double *)
00124         LAPACKE_malloc( ldvr*mm * sizeof(lapack_complex_double) );
00125     work = (lapack_complex_double *)
00126         LAPACKE_malloc( 2*n * sizeof(lapack_complex_double) );
00127     rwork = (double *)LAPACKE_malloc( n * sizeof(double) );
00128 
00129     /* Allocate memory for the C interface function arrays */
00130     select_i = (lapack_int *)LAPACKE_malloc( n * sizeof(lapack_int) );
00131     t_i = (lapack_complex_double *)
00132         LAPACKE_malloc( ldt*n * sizeof(lapack_complex_double) );
00133     vl_i = (lapack_complex_double *)
00134         LAPACKE_malloc( ldvl*mm * sizeof(lapack_complex_double) );
00135     vr_i = (lapack_complex_double *)
00136         LAPACKE_malloc( ldvr*mm * sizeof(lapack_complex_double) );
00137     work_i = (lapack_complex_double *)
00138         LAPACKE_malloc( 2*n * sizeof(lapack_complex_double) );
00139     rwork_i = (double *)LAPACKE_malloc( n * sizeof(double) );
00140 
00141     /* Allocate memory for the backup arrays */
00142     t_save = (lapack_complex_double *)
00143         LAPACKE_malloc( ldt*n * sizeof(lapack_complex_double) );
00144     vl_save = (lapack_complex_double *)
00145         LAPACKE_malloc( ldvl*mm * sizeof(lapack_complex_double) );
00146     vr_save = (lapack_complex_double *)
00147         LAPACKE_malloc( ldvr*mm * sizeof(lapack_complex_double) );
00148 
00149     /* Allocate memory for the row-major arrays */
00150     t_r = (lapack_complex_double *)
00151         LAPACKE_malloc( n*(n+2) * sizeof(lapack_complex_double) );
00152     vl_r = (lapack_complex_double *)
00153         LAPACKE_malloc( n*(mm+2) * sizeof(lapack_complex_double) );
00154     vr_r = (lapack_complex_double *)
00155         LAPACKE_malloc( n*(mm+2) * sizeof(lapack_complex_double) );
00156 
00157     /* Initialize input arrays */
00158     init_select( n, select );
00159     init_t( ldt*n, t );
00160     init_vl( ldvl*mm, vl );
00161     init_vr( ldvr*mm, vr );
00162     init_work( 2*n, work );
00163     init_rwork( n, rwork );
00164 
00165     /* Backup the ouptut arrays */
00166     for( i = 0; i < ldt*n; i++ ) {
00167         t_save[i] = t[i];
00168     }
00169     for( i = 0; i < ldvl*mm; i++ ) {
00170         vl_save[i] = vl[i];
00171     }
00172     for( i = 0; i < ldvr*mm; i++ ) {
00173         vr_save[i] = vr[i];
00174     }
00175 
00176     /* Call the LAPACK routine */
00177     ztrevc_( &side, &howmny, select, &n, t, &ldt, vl, &ldvl, vr, &ldvr, &mm, &m,
00178              work, rwork, &info );
00179 
00180     /* Initialize input data, call the column-major middle-level
00181      * interface to LAPACK routine and check the results */
00182     for( i = 0; i < n; i++ ) {
00183         select_i[i] = select[i];
00184     }
00185     for( i = 0; i < ldt*n; i++ ) {
00186         t_i[i] = t_save[i];
00187     }
00188     for( i = 0; i < ldvl*mm; i++ ) {
00189         vl_i[i] = vl_save[i];
00190     }
00191     for( i = 0; i < ldvr*mm; i++ ) {
00192         vr_i[i] = vr_save[i];
00193     }
00194     for( i = 0; i < 2*n; i++ ) {
00195         work_i[i] = work[i];
00196     }
00197     for( i = 0; i < n; i++ ) {
00198         rwork_i[i] = rwork[i];
00199     }
00200     info_i = LAPACKE_ztrevc_work( LAPACK_COL_MAJOR, side_i, howmny_i, select_i,
00201                                   n_i, t_i, ldt_i, vl_i, ldvl_i, vr_i, ldvr_i,
00202                                   mm_i, &m_i, work_i, rwork_i );
00203 
00204     failed = compare_ztrevc( t, t_i, vl, vl_i, vr, vr_i, m, m_i, info, info_i,
00205                              ldt, ldvl, ldvr, mm, n, side );
00206     if( failed == 0 ) {
00207         printf( "PASSED: column-major middle-level interface to ztrevc\n" );
00208     } else {
00209         printf( "FAILED: column-major middle-level interface to ztrevc\n" );
00210     }
00211 
00212     /* Initialize input data, call the column-major high-level
00213      * interface to LAPACK routine and check the results */
00214     for( i = 0; i < n; i++ ) {
00215         select_i[i] = select[i];
00216     }
00217     for( i = 0; i < ldt*n; i++ ) {
00218         t_i[i] = t_save[i];
00219     }
00220     for( i = 0; i < ldvl*mm; i++ ) {
00221         vl_i[i] = vl_save[i];
00222     }
00223     for( i = 0; i < ldvr*mm; i++ ) {
00224         vr_i[i] = vr_save[i];
00225     }
00226     for( i = 0; i < 2*n; i++ ) {
00227         work_i[i] = work[i];
00228     }
00229     for( i = 0; i < n; i++ ) {
00230         rwork_i[i] = rwork[i];
00231     }
00232     info_i = LAPACKE_ztrevc( LAPACK_COL_MAJOR, side_i, howmny_i, select_i, n_i,
00233                              t_i, ldt_i, vl_i, ldvl_i, vr_i, ldvr_i, mm_i,
00234                              &m_i );
00235 
00236     failed = compare_ztrevc( t, t_i, vl, vl_i, vr, vr_i, m, m_i, info, info_i,
00237                              ldt, ldvl, ldvr, mm, n, side );
00238     if( failed == 0 ) {
00239         printf( "PASSED: column-major high-level interface to ztrevc\n" );
00240     } else {
00241         printf( "FAILED: column-major high-level interface to ztrevc\n" );
00242     }
00243 
00244     /* Initialize input data, call the row-major middle-level
00245      * interface to LAPACK routine and check the results */
00246     for( i = 0; i < n; i++ ) {
00247         select_i[i] = select[i];
00248     }
00249     for( i = 0; i < ldt*n; i++ ) {
00250         t_i[i] = t_save[i];
00251     }
00252     for( i = 0; i < ldvl*mm; i++ ) {
00253         vl_i[i] = vl_save[i];
00254     }
00255     for( i = 0; i < ldvr*mm; i++ ) {
00256         vr_i[i] = vr_save[i];
00257     }
00258     for( i = 0; i < 2*n; i++ ) {
00259         work_i[i] = work[i];
00260     }
00261     for( i = 0; i < n; i++ ) {
00262         rwork_i[i] = rwork[i];
00263     }
00264 
00265     LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, t_i, ldt, t_r, n+2 );
00266     if( LAPACKE_lsame( side, 'b' ) || LAPACKE_lsame( side, 'l' ) ) {
00267         LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, mm, vl_i, ldvl, vl_r, mm+2 );
00268     }
00269     if( LAPACKE_lsame( side, 'b' ) || LAPACKE_lsame( side, 'r' ) ) {
00270         LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, mm, vr_i, ldvr, vr_r, mm+2 );
00271     }
00272     info_i = LAPACKE_ztrevc_work( LAPACK_ROW_MAJOR, side_i, howmny_i, select_i,
00273                                   n_i, t_r, ldt_r, vl_r, ldvl_r, vr_r, ldvr_r,
00274                                   mm_i, &m_i, work_i, rwork_i );
00275 
00276     LAPACKE_zge_trans( LAPACK_ROW_MAJOR, n, n, t_r, n+2, t_i, ldt );
00277     if( LAPACKE_lsame( side, 'b' ) || LAPACKE_lsame( side, 'l' ) ) {
00278         LAPACKE_zge_trans( LAPACK_ROW_MAJOR, n, mm, vl_r, mm+2, vl_i, ldvl );
00279     }
00280     if( LAPACKE_lsame( side, 'b' ) || LAPACKE_lsame( side, 'r' ) ) {
00281         LAPACKE_zge_trans( LAPACK_ROW_MAJOR, n, mm, vr_r, mm+2, vr_i, ldvr );
00282     }
00283 
00284     failed = compare_ztrevc( t, t_i, vl, vl_i, vr, vr_i, m, m_i, info, info_i,
00285                              ldt, ldvl, ldvr, mm, n, side );
00286     if( failed == 0 ) {
00287         printf( "PASSED: row-major middle-level interface to ztrevc\n" );
00288     } else {
00289         printf( "FAILED: row-major middle-level interface to ztrevc\n" );
00290     }
00291 
00292     /* Initialize input data, call the row-major high-level
00293      * interface to LAPACK routine and check the results */
00294     for( i = 0; i < n; i++ ) {
00295         select_i[i] = select[i];
00296     }
00297     for( i = 0; i < ldt*n; i++ ) {
00298         t_i[i] = t_save[i];
00299     }
00300     for( i = 0; i < ldvl*mm; i++ ) {
00301         vl_i[i] = vl_save[i];
00302     }
00303     for( i = 0; i < ldvr*mm; i++ ) {
00304         vr_i[i] = vr_save[i];
00305     }
00306     for( i = 0; i < 2*n; i++ ) {
00307         work_i[i] = work[i];
00308     }
00309     for( i = 0; i < n; i++ ) {
00310         rwork_i[i] = rwork[i];
00311     }
00312 
00313     /* Init row_major arrays */
00314     LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, t_i, ldt, t_r, n+2 );
00315     if( LAPACKE_lsame( side, 'b' ) || LAPACKE_lsame( side, 'l' ) ) {
00316         LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, mm, vl_i, ldvl, vl_r, mm+2 );
00317     }
00318     if( LAPACKE_lsame( side, 'b' ) || LAPACKE_lsame( side, 'r' ) ) {
00319         LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, mm, vr_i, ldvr, vr_r, mm+2 );
00320     }
00321     info_i = LAPACKE_ztrevc( LAPACK_ROW_MAJOR, side_i, howmny_i, select_i, n_i,
00322                              t_r, ldt_r, vl_r, ldvl_r, vr_r, ldvr_r, mm_i,
00323                              &m_i );
00324 
00325     LAPACKE_zge_trans( LAPACK_ROW_MAJOR, n, n, t_r, n+2, t_i, ldt );
00326     if( LAPACKE_lsame( side, 'b' ) || LAPACKE_lsame( side, 'l' ) ) {
00327         LAPACKE_zge_trans( LAPACK_ROW_MAJOR, n, mm, vl_r, mm+2, vl_i, ldvl );
00328     }
00329     if( LAPACKE_lsame( side, 'b' ) || LAPACKE_lsame( side, 'r' ) ) {
00330         LAPACKE_zge_trans( LAPACK_ROW_MAJOR, n, mm, vr_r, mm+2, vr_i, ldvr );
00331     }
00332 
00333     failed = compare_ztrevc( t, t_i, vl, vl_i, vr, vr_i, m, m_i, info, info_i,
00334                              ldt, ldvl, ldvr, mm, n, side );
00335     if( failed == 0 ) {
00336         printf( "PASSED: row-major high-level interface to ztrevc\n" );
00337     } else {
00338         printf( "FAILED: row-major high-level interface to ztrevc\n" );
00339     }
00340 
00341     /* Release memory */
00342     if( select != NULL ) {
00343         LAPACKE_free( select );
00344     }
00345     if( select_i != NULL ) {
00346         LAPACKE_free( select_i );
00347     }
00348     if( t != NULL ) {
00349         LAPACKE_free( t );
00350     }
00351     if( t_i != NULL ) {
00352         LAPACKE_free( t_i );
00353     }
00354     if( t_r != NULL ) {
00355         LAPACKE_free( t_r );
00356     }
00357     if( t_save != NULL ) {
00358         LAPACKE_free( t_save );
00359     }
00360     if( vl != NULL ) {
00361         LAPACKE_free( vl );
00362     }
00363     if( vl_i != NULL ) {
00364         LAPACKE_free( vl_i );
00365     }
00366     if( vl_r != NULL ) {
00367         LAPACKE_free( vl_r );
00368     }
00369     if( vl_save != NULL ) {
00370         LAPACKE_free( vl_save );
00371     }
00372     if( vr != NULL ) {
00373         LAPACKE_free( vr );
00374     }
00375     if( vr_i != NULL ) {
00376         LAPACKE_free( vr_i );
00377     }
00378     if( vr_r != NULL ) {
00379         LAPACKE_free( vr_r );
00380     }
00381     if( vr_save != NULL ) {
00382         LAPACKE_free( vr_save );
00383     }
00384     if( work != NULL ) {
00385         LAPACKE_free( work );
00386     }
00387     if( work_i != NULL ) {
00388         LAPACKE_free( work_i );
00389     }
00390     if( rwork != NULL ) {
00391         LAPACKE_free( rwork );
00392     }
00393     if( rwork_i != NULL ) {
00394         LAPACKE_free( rwork_i );
00395     }
00396 
00397     return 0;
00398 }
00399 
00400 /* Auxiliary function: ztrevc scalar parameters initialization */
00401 static void init_scalars_ztrevc( char *side, char *howmny, lapack_int *n,
00402                                  lapack_int *ldt, lapack_int *ldvl,
00403                                  lapack_int *ldvr, lapack_int *mm )
00404 {
00405     *side = 'B';
00406     *howmny = 'A';
00407     *n = 4;
00408     *ldt = 8;
00409     *ldvl = 8;
00410     *ldvr = 8;
00411     *mm = 4;
00412 
00413     return;
00414 }
00415 
00416 /* Auxiliary functions: ztrevc array parameters initialization */
00417 static void init_select( lapack_int size, lapack_int *select ) {
00418     lapack_int i;
00419     for( i = 0; i < size; i++ ) {
00420         select[i] = 0;
00421     }
00422     select[0] = 0;
00423     select[1] = 0;
00424     select[2] = 0;
00425     select[3] = 0;
00426 }
00427 static void init_t( lapack_int size, lapack_complex_double *t ) {
00428     lapack_int i;
00429     for( i = 0; i < size; i++ ) {
00430         t[i] = lapack_make_complex_double( 0.0, 0.0 );
00431     }
00432     t[0] = lapack_make_complex_double( -6.00040000000000000e+000,
00433                                        -6.99990000000000020e+000 );
00434     t[8] = lapack_make_complex_double( 3.63700000000000020e-001,
00435                                        -3.65599999999999980e-001 );
00436     t[16] = lapack_make_complex_double( -1.88000000000000000e-001,
00437                                         4.78700000000000010e-001 );
00438     t[24] = lapack_make_complex_double( 8.78499999999999950e-001,
00439                                         -2.53900000000000010e-001 );
00440     t[1] = lapack_make_complex_double( 0.00000000000000000e+000,
00441                                        0.00000000000000000e+000 );
00442     t[9] = lapack_make_complex_double( -5.00000000000000000e+000,
00443                                        2.00599999999999980e+000 );
00444     t[17] = lapack_make_complex_double( -3.07000000000000020e-002,
00445                                         -7.21700000000000010e-001 );
00446     t[25] = lapack_make_complex_double( -2.29000000000000010e-001,
00447                                         1.31300000000000000e-001 );
00448     t[2] = lapack_make_complex_double( 0.00000000000000000e+000,
00449                                        0.00000000000000000e+000 );
00450     t[10] = lapack_make_complex_double( 0.00000000000000000e+000,
00451                                         0.00000000000000000e+000 );
00452     t[18] = lapack_make_complex_double( 7.99819999999999980e+000,
00453                                         -9.96399999999999950e-001 );
00454     t[26] = lapack_make_complex_double( 9.35699999999999980e-001,
00455                                         5.35900000000000040e-001 );
00456     t[3] = lapack_make_complex_double( 0.00000000000000000e+000,
00457                                        0.00000000000000000e+000 );
00458     t[11] = lapack_make_complex_double( 0.00000000000000000e+000,
00459                                         0.00000000000000000e+000 );
00460     t[19] = lapack_make_complex_double( 0.00000000000000000e+000,
00461                                         0.00000000000000000e+000 );
00462     t[27] = lapack_make_complex_double( 3.00230000000000000e+000,
00463                                         -3.99980000000000000e+000 );
00464 }
00465 static void init_vl( lapack_int size, lapack_complex_double *vl ) {
00466     lapack_int i;
00467     for( i = 0; i < size; i++ ) {
00468         vl[i] = lapack_make_complex_double( 0.0, 0.0 );
00469     }
00470     vl[0] = lapack_make_complex_double( 0.00000000000000000e+000,
00471                                         0.00000000000000000e+000 );
00472     vl[8] = lapack_make_complex_double( 0.00000000000000000e+000,
00473                                         0.00000000000000000e+000 );
00474     vl[16] = lapack_make_complex_double( 0.00000000000000000e+000,
00475                                          0.00000000000000000e+000 );
00476     vl[24] = lapack_make_complex_double( 0.00000000000000000e+000,
00477                                          0.00000000000000000e+000 );
00478     vl[1] = lapack_make_complex_double( 0.00000000000000000e+000,
00479                                         0.00000000000000000e+000 );
00480     vl[9] = lapack_make_complex_double( 0.00000000000000000e+000,
00481                                         0.00000000000000000e+000 );
00482     vl[17] = lapack_make_complex_double( 0.00000000000000000e+000,
00483                                          0.00000000000000000e+000 );
00484     vl[25] = lapack_make_complex_double( 0.00000000000000000e+000,
00485                                          0.00000000000000000e+000 );
00486     vl[2] = lapack_make_complex_double( 0.00000000000000000e+000,
00487                                         0.00000000000000000e+000 );
00488     vl[10] = lapack_make_complex_double( 0.00000000000000000e+000,
00489                                          0.00000000000000000e+000 );
00490     vl[18] = lapack_make_complex_double( 0.00000000000000000e+000,
00491                                          0.00000000000000000e+000 );
00492     vl[26] = lapack_make_complex_double( 0.00000000000000000e+000,
00493                                          0.00000000000000000e+000 );
00494     vl[3] = lapack_make_complex_double( 0.00000000000000000e+000,
00495                                         0.00000000000000000e+000 );
00496     vl[11] = lapack_make_complex_double( 0.00000000000000000e+000,
00497                                          0.00000000000000000e+000 );
00498     vl[19] = lapack_make_complex_double( 0.00000000000000000e+000,
00499                                          0.00000000000000000e+000 );
00500     vl[27] = lapack_make_complex_double( 0.00000000000000000e+000,
00501                                          0.00000000000000000e+000 );
00502 }
00503 static void init_vr( lapack_int size, lapack_complex_double *vr ) {
00504     lapack_int i;
00505     for( i = 0; i < size; i++ ) {
00506         vr[i] = lapack_make_complex_double( 0.0, 0.0 );
00507     }
00508     vr[0] = lapack_make_complex_double( 0.00000000000000000e+000,
00509                                         0.00000000000000000e+000 );
00510     vr[8] = lapack_make_complex_double( 0.00000000000000000e+000,
00511                                         0.00000000000000000e+000 );
00512     vr[16] = lapack_make_complex_double( 0.00000000000000000e+000,
00513                                          0.00000000000000000e+000 );
00514     vr[24] = lapack_make_complex_double( 0.00000000000000000e+000,
00515                                          0.00000000000000000e+000 );
00516     vr[1] = lapack_make_complex_double( 0.00000000000000000e+000,
00517                                         0.00000000000000000e+000 );
00518     vr[9] = lapack_make_complex_double( 0.00000000000000000e+000,
00519                                         0.00000000000000000e+000 );
00520     vr[17] = lapack_make_complex_double( 0.00000000000000000e+000,
00521                                          0.00000000000000000e+000 );
00522     vr[25] = lapack_make_complex_double( 0.00000000000000000e+000,
00523                                          0.00000000000000000e+000 );
00524     vr[2] = lapack_make_complex_double( 0.00000000000000000e+000,
00525                                         0.00000000000000000e+000 );
00526     vr[10] = lapack_make_complex_double( 0.00000000000000000e+000,
00527                                          0.00000000000000000e+000 );
00528     vr[18] = lapack_make_complex_double( 0.00000000000000000e+000,
00529                                          0.00000000000000000e+000 );
00530     vr[26] = lapack_make_complex_double( 0.00000000000000000e+000,
00531                                          0.00000000000000000e+000 );
00532     vr[3] = lapack_make_complex_double( 0.00000000000000000e+000,
00533                                         0.00000000000000000e+000 );
00534     vr[11] = lapack_make_complex_double( 0.00000000000000000e+000,
00535                                          0.00000000000000000e+000 );
00536     vr[19] = lapack_make_complex_double( 0.00000000000000000e+000,
00537                                          0.00000000000000000e+000 );
00538     vr[27] = lapack_make_complex_double( 0.00000000000000000e+000,
00539                                          0.00000000000000000e+000 );
00540 }
00541 static void init_work( lapack_int size, lapack_complex_double *work ) {
00542     lapack_int i;
00543     for( i = 0; i < size; i++ ) {
00544         work[i] = lapack_make_complex_double( 0.0, 0.0 );
00545     }
00546 }
00547 static void init_rwork( lapack_int size, double *rwork ) {
00548     lapack_int i;
00549     for( i = 0; i < size; i++ ) {
00550         rwork[i] = 0;
00551     }
00552 }
00553 
00554 /* Auxiliary function: C interface to ztrevc results check */
00555 /* Return value: 0 - test is passed, non-zero - test is failed */
00556 static int compare_ztrevc( lapack_complex_double *t, lapack_complex_double *t_i,
00557                            lapack_complex_double *vl,
00558                            lapack_complex_double *vl_i,
00559                            lapack_complex_double *vr,
00560                            lapack_complex_double *vr_i, lapack_int m,
00561                            lapack_int m_i, lapack_int info, lapack_int info_i,
00562                            lapack_int ldt, lapack_int ldvl, lapack_int ldvr,
00563                            lapack_int mm, lapack_int n, char side )
00564 {
00565     lapack_int i;
00566     int failed = 0;
00567     for( i = 0; i < ldt*n; i++ ) {
00568         failed += compare_complex_doubles(t[i],t_i[i]);
00569     }
00570     if( LAPACKE_lsame( side, 'b' ) || LAPACKE_lsame( side, 'l' ) ) {
00571         for( i = 0; i < ldvl*mm; i++ ) {
00572             failed += compare_complex_doubles(vl[i],vl_i[i]);
00573         }
00574     }
00575     if( LAPACKE_lsame( side, 'b' ) || LAPACKE_lsame( side, 'r' ) ) {
00576         for( i = 0; i < ldvr*mm; i++ ) {
00577             failed += compare_complex_doubles(vr[i],vr_i[i]);
00578         }
00579     }
00580     failed += (m == m_i) ? 0 : 1;
00581     failed += (info == info_i) ? 0 : 1;
00582     if( info != 0 || info_i != 0 ) {
00583         printf( "info=%d, info_i=%d\n",(int)info,(int)info_i );
00584     }
00585 
00586     return failed;
00587 }


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