dtrsna_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 * dtrsna_1 is the test program for the C interface to LAPACK
00036 * routine dtrsna
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_dtrsna( char *job, char *howmny, lapack_int *n,
00055                                  lapack_int *ldt, lapack_int *ldvl,
00056                                  lapack_int *ldvr, lapack_int *mm,
00057                                  lapack_int *ldwork );
00058 static void init_select( lapack_int size, lapack_int *select );
00059 static void init_t( lapack_int size, double *t );
00060 static void init_vl( lapack_int size, double *vl );
00061 static void init_vr( lapack_int size, double *vr );
00062 static void init_s( lapack_int size, double *s );
00063 static void init_sep( lapack_int size, double *sep );
00064 static void init_work( lapack_int size, double *work );
00065 static void init_iwork( lapack_int size, lapack_int *iwork );
00066 static int compare_dtrsna( double *s, double *s_i, double *sep, double *sep_i,
00067                            lapack_int m, lapack_int m_i, lapack_int info,
00068                            lapack_int info_i, char job, lapack_int mm );
00069 
00070 int main(void)
00071 {
00072     /* Local scalars */
00073     char job, job_i;
00074     char howmny, howmny_i;
00075     lapack_int n, n_i;
00076     lapack_int ldt, ldt_i;
00077     lapack_int ldt_r;
00078     lapack_int ldvl, ldvl_i;
00079     lapack_int ldvl_r;
00080     lapack_int ldvr, ldvr_i;
00081     lapack_int ldvr_r;
00082     lapack_int mm, mm_i;
00083     lapack_int m, m_i;
00084     lapack_int ldwork, ldwork_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     double *t = NULL, *t_i = NULL;
00092     double *vl = NULL, *vl_i = NULL;
00093     double *vr = NULL, *vr_i = NULL;
00094     double *s = NULL, *s_i = NULL;
00095     double *sep = NULL, *sep_i = NULL;
00096     double *work = NULL, *work_i = NULL;
00097     lapack_int *iwork = NULL, *iwork_i = NULL;
00098     double *s_save = NULL;
00099     double *sep_save = NULL;
00100     double *t_r = NULL;
00101     double *vl_r = NULL;
00102     double *vr_r = NULL;
00103 
00104     /* Iniitialize the scalar parameters */
00105     init_scalars_dtrsna( &job, &howmny, &n, &ldt, &ldvl, &ldvr, &mm, &ldwork );
00106     ldt_r = n+2;
00107     ldvl_r = mm+2;
00108     ldvr_r = mm+2;
00109     job_i = job;
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     ldwork_i = ldwork;
00117 
00118     /* Allocate memory for the LAPACK routine arrays */
00119     select = (lapack_int *)LAPACKE_malloc( n * sizeof(lapack_int) );
00120     t = (double *)LAPACKE_malloc( ldt*n * sizeof(double) );
00121     vl = (double *)LAPACKE_malloc( ldvl*mm * sizeof(double) );
00122     vr = (double *)LAPACKE_malloc( ldvr*mm * sizeof(double) );
00123     s = (double *)LAPACKE_malloc( mm * sizeof(double) );
00124     sep = (double *)LAPACKE_malloc( mm * sizeof(double) );
00125     work = (double *)LAPACKE_malloc( ldwork*(n+6) * sizeof(double) );
00126     iwork = (lapack_int *)LAPACKE_malloc( ((2*(n-1))) * sizeof(lapack_int) );
00127 
00128     /* Allocate memory for the C interface function arrays */
00129     select_i = (lapack_int *)LAPACKE_malloc( n * sizeof(lapack_int) );
00130     t_i = (double *)LAPACKE_malloc( ldt*n * sizeof(double) );
00131     vl_i = (double *)LAPACKE_malloc( ldvl*mm * sizeof(double) );
00132     vr_i = (double *)LAPACKE_malloc( ldvr*mm * sizeof(double) );
00133     s_i = (double *)LAPACKE_malloc( mm * sizeof(double) );
00134     sep_i = (double *)LAPACKE_malloc( mm * sizeof(double) );
00135     work_i = (double *)LAPACKE_malloc( ldwork*(n+6) * sizeof(double) );
00136     iwork_i = (lapack_int *)LAPACKE_malloc( ((2*(n-1))) * sizeof(lapack_int) );
00137 
00138     /* Allocate memory for the backup arrays */
00139     s_save = (double *)LAPACKE_malloc( mm * sizeof(double) );
00140     sep_save = (double *)LAPACKE_malloc( mm * sizeof(double) );
00141 
00142     /* Allocate memory for the row-major arrays */
00143     t_r = (double *)LAPACKE_malloc( n*(n+2) * sizeof(double) );
00144     vl_r = (double *)LAPACKE_malloc( n*(mm+2) * sizeof(double) );
00145     vr_r = (double *)LAPACKE_malloc( n*(mm+2) * sizeof(double) );
00146 
00147     /* Initialize input arrays */
00148     init_select( n, select );
00149     init_t( ldt*n, t );
00150     init_vl( ldvl*mm, vl );
00151     init_vr( ldvr*mm, vr );
00152     init_s( mm, s );
00153     init_sep( mm, sep );
00154     init_work( ldwork*(n+6), work );
00155     init_iwork( (2*(n-1)), iwork );
00156 
00157     /* Backup the ouptut arrays */
00158     for( i = 0; i < mm; i++ ) {
00159         s_save[i] = s[i];
00160     }
00161     for( i = 0; i < mm; i++ ) {
00162         sep_save[i] = sep[i];
00163     }
00164 
00165     /* Call the LAPACK routine */
00166     dtrsna_( &job, &howmny, select, &n, t, &ldt, vl, &ldvl, vr, &ldvr, s, sep,
00167              &mm, &m, work, &ldwork, iwork, &info );
00168 
00169     /* Initialize input data, call the column-major middle-level
00170      * interface to LAPACK routine and check the results */
00171     for( i = 0; i < n; i++ ) {
00172         select_i[i] = select[i];
00173     }
00174     for( i = 0; i < ldt*n; i++ ) {
00175         t_i[i] = t[i];
00176     }
00177     for( i = 0; i < ldvl*mm; i++ ) {
00178         vl_i[i] = vl[i];
00179     }
00180     for( i = 0; i < ldvr*mm; i++ ) {
00181         vr_i[i] = vr[i];
00182     }
00183     for( i = 0; i < mm; i++ ) {
00184         s_i[i] = s_save[i];
00185     }
00186     for( i = 0; i < mm; i++ ) {
00187         sep_i[i] = sep_save[i];
00188     }
00189     for( i = 0; i < ldwork*(n+6); i++ ) {
00190         work_i[i] = work[i];
00191     }
00192     for( i = 0; i < (2*(n-1)); i++ ) {
00193         iwork_i[i] = iwork[i];
00194     }
00195     info_i = LAPACKE_dtrsna_work( LAPACK_COL_MAJOR, job_i, howmny_i, select_i,
00196                                   n_i, t_i, ldt_i, vl_i, ldvl_i, vr_i, ldvr_i,
00197                                   s_i, sep_i, mm_i, &m_i, work_i, ldwork_i,
00198                                   iwork_i );
00199 
00200     failed = compare_dtrsna( s, s_i, sep, sep_i, m, m_i, info, info_i, job,
00201                              mm );
00202     if( failed == 0 ) {
00203         printf( "PASSED: column-major middle-level interface to dtrsna\n" );
00204     } else {
00205         printf( "FAILED: column-major middle-level interface to dtrsna\n" );
00206     }
00207 
00208     /* Initialize input data, call the column-major high-level
00209      * interface to LAPACK routine and check the results */
00210     for( i = 0; i < n; i++ ) {
00211         select_i[i] = select[i];
00212     }
00213     for( i = 0; i < ldt*n; i++ ) {
00214         t_i[i] = t[i];
00215     }
00216     for( i = 0; i < ldvl*mm; i++ ) {
00217         vl_i[i] = vl[i];
00218     }
00219     for( i = 0; i < ldvr*mm; i++ ) {
00220         vr_i[i] = vr[i];
00221     }
00222     for( i = 0; i < mm; i++ ) {
00223         s_i[i] = s_save[i];
00224     }
00225     for( i = 0; i < mm; i++ ) {
00226         sep_i[i] = sep_save[i];
00227     }
00228     for( i = 0; i < ldwork*(n+6); i++ ) {
00229         work_i[i] = work[i];
00230     }
00231     for( i = 0; i < (2*(n-1)); i++ ) {
00232         iwork_i[i] = iwork[i];
00233     }
00234     info_i = LAPACKE_dtrsna( LAPACK_COL_MAJOR, job_i, howmny_i, select_i, n_i,
00235                              t_i, ldt_i, vl_i, ldvl_i, vr_i, ldvr_i, s_i, sep_i,
00236                              mm_i, &m_i );
00237 
00238     failed = compare_dtrsna( s, s_i, sep, sep_i, m, m_i, info, info_i, job,
00239                              mm );
00240     if( failed == 0 ) {
00241         printf( "PASSED: column-major high-level interface to dtrsna\n" );
00242     } else {
00243         printf( "FAILED: column-major high-level interface to dtrsna\n" );
00244     }
00245 
00246     /* Initialize input data, call the row-major middle-level
00247      * interface to LAPACK routine and check the results */
00248     for( i = 0; i < n; i++ ) {
00249         select_i[i] = select[i];
00250     }
00251     for( i = 0; i < ldt*n; i++ ) {
00252         t_i[i] = t[i];
00253     }
00254     for( i = 0; i < ldvl*mm; i++ ) {
00255         vl_i[i] = vl[i];
00256     }
00257     for( i = 0; i < ldvr*mm; i++ ) {
00258         vr_i[i] = vr[i];
00259     }
00260     for( i = 0; i < mm; i++ ) {
00261         s_i[i] = s_save[i];
00262     }
00263     for( i = 0; i < mm; i++ ) {
00264         sep_i[i] = sep_save[i];
00265     }
00266     for( i = 0; i < ldwork*(n+6); i++ ) {
00267         work_i[i] = work[i];
00268     }
00269     for( i = 0; i < (2*(n-1)); i++ ) {
00270         iwork_i[i] = iwork[i];
00271     }
00272 
00273     LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, t_i, ldt, t_r, n+2 );
00274     if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'e' ) ) {
00275         LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, mm, vl_i, ldvl, vl_r, mm+2 );
00276     }
00277     if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'e' ) ) {
00278         LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, mm, vr_i, ldvr, vr_r, mm+2 );
00279     }
00280     info_i = LAPACKE_dtrsna_work( LAPACK_ROW_MAJOR, job_i, howmny_i, select_i,
00281                                   n_i, t_r, ldt_r, vl_r, ldvl_r, vr_r, ldvr_r,
00282                                   s_i, sep_i, mm_i, &m_i, work_i, ldwork_i,
00283                                   iwork_i );
00284 
00285     failed = compare_dtrsna( s, s_i, sep, sep_i, m, m_i, info, info_i, job,
00286                              mm );
00287     if( failed == 0 ) {
00288         printf( "PASSED: row-major middle-level interface to dtrsna\n" );
00289     } else {
00290         printf( "FAILED: row-major middle-level interface to dtrsna\n" );
00291     }
00292 
00293     /* Initialize input data, call the row-major high-level
00294      * interface to LAPACK routine and check the results */
00295     for( i = 0; i < n; i++ ) {
00296         select_i[i] = select[i];
00297     }
00298     for( i = 0; i < ldt*n; i++ ) {
00299         t_i[i] = t[i];
00300     }
00301     for( i = 0; i < ldvl*mm; i++ ) {
00302         vl_i[i] = vl[i];
00303     }
00304     for( i = 0; i < ldvr*mm; i++ ) {
00305         vr_i[i] = vr[i];
00306     }
00307     for( i = 0; i < mm; i++ ) {
00308         s_i[i] = s_save[i];
00309     }
00310     for( i = 0; i < mm; i++ ) {
00311         sep_i[i] = sep_save[i];
00312     }
00313     for( i = 0; i < ldwork*(n+6); i++ ) {
00314         work_i[i] = work[i];
00315     }
00316     for( i = 0; i < (2*(n-1)); i++ ) {
00317         iwork_i[i] = iwork[i];
00318     }
00319 
00320     /* Init row_major arrays */
00321     LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, n, t_i, ldt, t_r, n+2 );
00322     if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'e' ) ) {
00323         LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, mm, vl_i, ldvl, vl_r, mm+2 );
00324     }
00325     if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'e' ) ) {
00326         LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, mm, vr_i, ldvr, vr_r, mm+2 );
00327     }
00328     info_i = LAPACKE_dtrsna( LAPACK_ROW_MAJOR, job_i, howmny_i, select_i, n_i,
00329                              t_r, ldt_r, vl_r, ldvl_r, vr_r, ldvr_r, s_i, sep_i,
00330                              mm_i, &m_i );
00331 
00332     failed = compare_dtrsna( s, s_i, sep, sep_i, m, m_i, info, info_i, job,
00333                              mm );
00334     if( failed == 0 ) {
00335         printf( "PASSED: row-major high-level interface to dtrsna\n" );
00336     } else {
00337         printf( "FAILED: row-major high-level interface to dtrsna\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( vl != NULL ) {
00357         LAPACKE_free( vl );
00358     }
00359     if( vl_i != NULL ) {
00360         LAPACKE_free( vl_i );
00361     }
00362     if( vl_r != NULL ) {
00363         LAPACKE_free( vl_r );
00364     }
00365     if( vr != NULL ) {
00366         LAPACKE_free( vr );
00367     }
00368     if( vr_i != NULL ) {
00369         LAPACKE_free( vr_i );
00370     }
00371     if( vr_r != NULL ) {
00372         LAPACKE_free( vr_r );
00373     }
00374     if( s != NULL ) {
00375         LAPACKE_free( s );
00376     }
00377     if( s_i != NULL ) {
00378         LAPACKE_free( s_i );
00379     }
00380     if( s_save != NULL ) {
00381         LAPACKE_free( s_save );
00382     }
00383     if( sep != NULL ) {
00384         LAPACKE_free( sep );
00385     }
00386     if( sep_i != NULL ) {
00387         LAPACKE_free( sep_i );
00388     }
00389     if( sep_save != NULL ) {
00390         LAPACKE_free( sep_save );
00391     }
00392     if( work != NULL ) {
00393         LAPACKE_free( work );
00394     }
00395     if( work_i != NULL ) {
00396         LAPACKE_free( work_i );
00397     }
00398     if( iwork != NULL ) {
00399         LAPACKE_free( iwork );
00400     }
00401     if( iwork_i != NULL ) {
00402         LAPACKE_free( iwork_i );
00403     }
00404 
00405     return 0;
00406 }
00407 
00408 /* Auxiliary function: dtrsna scalar parameters initialization */
00409 static void init_scalars_dtrsna( char *job, char *howmny, lapack_int *n,
00410                                  lapack_int *ldt, lapack_int *ldvl,
00411                                  lapack_int *ldvr, lapack_int *mm,
00412                                  lapack_int *ldwork )
00413 {
00414     *job = 'B';
00415     *howmny = 'A';
00416     *n = 4;
00417     *ldt = 8;
00418     *ldvl = 8;
00419     *ldvr = 8;
00420     *mm = 4;
00421     *ldwork = 8;
00422 
00423     return;
00424 }
00425 
00426 /* Auxiliary functions: dtrsna array parameters initialization */
00427 static void init_select( lapack_int size, lapack_int *select ) {
00428     lapack_int i;
00429     for( i = 0; i < size; i++ ) {
00430         select[i] = 0;
00431     }
00432     select[0] = 0;
00433     select[1] = 0;
00434     select[2] = 0;
00435     select[3] = 0;
00436 }
00437 static void init_t( lapack_int size, double *t ) {
00438     lapack_int i;
00439     for( i = 0; i < size; i++ ) {
00440         t[i] = 0;
00441     }
00442     t[0] = 7.99499999999999990e-001;  /* t[0,0] */
00443     t[8] = -1.14400000000000000e-001;  /* t[0,1] */
00444     t[16] = 6.00000000000000010e-003;  /* t[0,2] */
00445     t[24] = 3.35999999999999980e-002;  /* t[0,3] */
00446     t[1] = 0.00000000000000000e+000;  /* t[1,0] */
00447     t[9] = -9.94000000000000020e-002;  /* t[1,1] */
00448     t[17] = 2.47799999999999990e-001;  /* t[1,2] */
00449     t[25] = 3.47399999999999990e-001;  /* t[1,3] */
00450     t[2] = 0.00000000000000000e+000;  /* t[2,0] */
00451     t[10] = -6.48299999999999990e-001;  /* t[2,1] */
00452     t[18] = -9.94000000000000020e-002;  /* t[2,2] */
00453     t[26] = 2.02600000000000000e-001;  /* t[2,3] */
00454     t[3] = 0.00000000000000000e+000;  /* t[3,0] */
00455     t[11] = 0.00000000000000000e+000;  /* t[3,1] */
00456     t[19] = 0.00000000000000000e+000;  /* t[3,2] */
00457     t[27] = -1.00700000000000000e-001;  /* t[3,3] */
00458 }
00459 static void init_vl( lapack_int size, double *vl ) {
00460     lapack_int i;
00461     for( i = 0; i < size; i++ ) {
00462         vl[i] = 0;
00463     }
00464     vl[0] = 1.00000000000000000e+000;  /* vl[0,0] */
00465     vl[8] = 0.00000000000000000e+000;  /* vl[0,1] */
00466     vl[16] = 0.00000000000000000e+000;  /* vl[0,2] */
00467     vl[24] = 0.00000000000000000e+000;  /* vl[0,3] */
00468     vl[1] = -1.10175772459959130e-001;  /* vl[1,0] */
00469     vl[9] = 8.49297113677700110e-001;  /* vl[1,1] */
00470     vl[17] = 0.00000000000000000e+000;  /* vl[1,2] */
00471     vl[25] = 0.00000000000000000e+000;  /* vl[1,3] */
00472     vl[2] = -2.36973594566446470e-002;  /* vl[2,0] */
00473     vl[10] = 0.00000000000000000e+000;  /* vl[2,1] */
00474     vl[18] = 5.25076145338855160e-001;  /* vl[2,2] */
00475     vl[26] = 0.00000000000000000e+000;  /* vl[2,3] */
00476     vl[3] = -1.05267144840102290e-002;  /* vl[3,0] */
00477     vl[11] = -2.63023202214821120e-001;  /* vl[3,1] */
00478     vl[19] = 7.36976797785178770e-001;  /* vl[3,2] */
00479     vl[27] = 1.00000000000000000e+000;  /* vl[3,3] */
00480 }
00481 static void init_vr( lapack_int size, double *vr ) {
00482     lapack_int i;
00483     for( i = 0; i < size; i++ ) {
00484         vr[i] = 0;
00485     }
00486     vr[0] = 1.00000000000000000e+000;  /* vr[0,0] */
00487     vr[8] = 6.81159384405489730e-002;  /* vr[0,1] */
00488     vr[16] = 2.36973594566446470e-002;  /* vr[0,2] */
00489     vr[24] = 8.11286711399037890e-003;  /* vr[0,3] */
00490     vr[1] = 0.00000000000000000e+000;  /* vr[1,0] */
00491     vr[9] = 6.18247886261057530e-001;  /* vr[1,1] */
00492     vr[17] = 0.00000000000000000e+000;  /* vr[1,2] */
00493     vr[25] = 2.20649468606918140e-001;  /* vr[1,3] */
00494     vr[2] = 0.00000000000000000e+000;  /* vr[2,0] */
00495     vr[10] = 0.00000000000000000e+000;  /* vr[2,1] */
00496     vr[18] = 1.00000000000000000e+000;  /* vr[2,2] */
00497     vr[26] = -1.00000000000000000e+000;  /* vr[2,3] */
00498     vr[3] = 0.00000000000000000e+000;  /* vr[3,0] */
00499     vr[11] = 0.00000000000000000e+000;  /* vr[3,1] */
00500     vr[19] = 0.00000000000000000e+000;  /* vr[3,2] */
00501     vr[27] = 7.12473102161229170e-001;  /* vr[3,3] */
00502 }
00503 static void init_s( lapack_int size, double *s ) {
00504     lapack_int i;
00505     for( i = 0; i < size; i++ ) {
00506         s[i] = 0;
00507     }
00508 }
00509 static void init_sep( lapack_int size, double *sep ) {
00510     lapack_int i;
00511     for( i = 0; i < size; i++ ) {
00512         sep[i] = 0;
00513     }
00514 }
00515 static void init_work( lapack_int size, double *work ) {
00516     lapack_int i;
00517     for( i = 0; i < size; i++ ) {
00518         work[i] = 0;
00519     }
00520 }
00521 static void init_iwork( lapack_int size, lapack_int *iwork ) {
00522     lapack_int i;
00523     for( i = 0; i < size; i++ ) {
00524         iwork[i] = 0;
00525     }
00526 }
00527 
00528 /* Auxiliary function: C interface to dtrsna results check */
00529 /* Return value: 0 - test is passed, non-zero - test is failed */
00530 static int compare_dtrsna( double *s, double *s_i, double *sep, double *sep_i,
00531                            lapack_int m, lapack_int m_i, lapack_int info,
00532                            lapack_int info_i, char job, lapack_int mm )
00533 {
00534     lapack_int i;
00535     int failed = 0;
00536     if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'e' ) ) {
00537         for( i = 0; i < mm; i++ ) {
00538             failed += compare_doubles(s[i],s_i[i]);
00539         }
00540     }
00541     if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'v' ) ) {
00542         for( i = 0; i < mm; i++ ) {
00543             failed += compare_doubles(sep[i],sep_i[i]);
00544         }
00545     }
00546     failed += (m == m_i) ? 0 : 1;
00547     failed += (info == info_i) ? 0 : 1;
00548     if( info != 0 || info_i != 0 ) {
00549         printf( "info=%d, info_i=%d\n",(int)info,(int)info_i );
00550     }
00551 
00552     return failed;
00553 }


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