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


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:34