sbdsqr_3.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 * sbdsqr_3 is the test program for the C interface to LAPACK
00036 * routine sbdsqr
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_sbdsqr( char *uplo, lapack_int *n, lapack_int *ncvt,
00055                                  lapack_int *nru, lapack_int *ncc,
00056                                  lapack_int *ldvt, lapack_int *ldu,
00057                                  lapack_int *ldc );
00058 static void init_d( lapack_int size, float *d );
00059 static void init_e( lapack_int size, float *e );
00060 static void init_vt( lapack_int size, float *vt );
00061 static void init_u( lapack_int size, float *u );
00062 static void init_c( lapack_int size, float *c );
00063 static void init_work( lapack_int size, float *work );
00064 static int compare_sbdsqr( float *d, float *d_i, float *e, float *e_i,
00065                            float *vt, float *vt_i, float *u, float *u_i,
00066                            float *c, float *c_i, lapack_int info,
00067                            lapack_int info_i, lapack_int ldc, lapack_int ldu,
00068                            lapack_int ldvt, lapack_int n, lapack_int ncc,
00069                            lapack_int ncvt, lapack_int nru );
00070 
00071 int main(void)
00072 {
00073     /* Local scalars */
00074     char uplo, uplo_i;
00075     lapack_int n, n_i;
00076     lapack_int ncvt, ncvt_i;
00077     lapack_int nru, nru_i;
00078     lapack_int ncc, ncc_i;
00079     lapack_int ldvt, ldvt_i;
00080     lapack_int ldvt_r;
00081     lapack_int ldu, ldu_i;
00082     lapack_int ldu_r;
00083     lapack_int ldc, ldc_i;
00084     lapack_int ldc_r;
00085     lapack_int info, info_i;
00086     lapack_int i;
00087     int failed;
00088 
00089     /* Local arrays */
00090     float *d = NULL, *d_i = NULL;
00091     float *e = NULL, *e_i = NULL;
00092     float *vt = NULL, *vt_i = NULL;
00093     float *u = NULL, *u_i = NULL;
00094     float *c = NULL, *c_i = NULL;
00095     float *work = NULL, *work_i = NULL;
00096     float *d_save = NULL;
00097     float *e_save = NULL;
00098     float *vt_save = NULL;
00099     float *u_save = NULL;
00100     float *c_save = NULL;
00101     float *vt_r = NULL;
00102     float *u_r = NULL;
00103     float *c_r = NULL;
00104 
00105     /* Iniitialize the scalar parameters */
00106     init_scalars_sbdsqr( &uplo, &n, &ncvt, &nru, &ncc, &ldvt, &ldu, &ldc );
00107     ldvt_r = ncvt+2;
00108     ldu_r = n+2;
00109     ldc_r = ncc+2;
00110     uplo_i = uplo;
00111     n_i = n;
00112     ncvt_i = ncvt;
00113     nru_i = nru;
00114     ncc_i = ncc;
00115     ldvt_i = ldvt;
00116     ldu_i = ldu;
00117     ldc_i = ldc;
00118 
00119     /* Allocate memory for the LAPACK routine arrays */
00120     d = (float *)LAPACKE_malloc( n * sizeof(float) );
00121     e = (float *)LAPACKE_malloc( n * sizeof(float) );
00122     vt = (float *)LAPACKE_malloc( ldvt*ncvt * sizeof(float) );
00123     u = (float *)LAPACKE_malloc( ldu*n * sizeof(float) );
00124     c = (float *)LAPACKE_malloc( ldc*ncc * sizeof(float) );
00125     work = (float *)LAPACKE_malloc( 4*n * sizeof(float) );
00126 
00127     /* Allocate memory for the C interface function arrays */
00128     d_i = (float *)LAPACKE_malloc( n * sizeof(float) );
00129     e_i = (float *)LAPACKE_malloc( n * sizeof(float) );
00130     vt_i = (float *)LAPACKE_malloc( ldvt*ncvt * sizeof(float) );
00131     u_i = (float *)LAPACKE_malloc( ldu*n * sizeof(float) );
00132     c_i = (float *)LAPACKE_malloc( ldc*ncc * sizeof(float) );
00133     work_i = (float *)LAPACKE_malloc( 4*n * sizeof(float) );
00134 
00135     /* Allocate memory for the backup arrays */
00136     d_save = (float *)LAPACKE_malloc( n * sizeof(float) );
00137     e_save = (float *)LAPACKE_malloc( n * sizeof(float) );
00138     vt_save = (float *)LAPACKE_malloc( ldvt*ncvt * sizeof(float) );
00139     u_save = (float *)LAPACKE_malloc( ldu*n * sizeof(float) );
00140     c_save = (float *)LAPACKE_malloc( ldc*ncc * sizeof(float) );
00141 
00142     /* Allocate memory for the row-major arrays */
00143     vt_r = (float *)LAPACKE_malloc( n*(ncvt+2) * sizeof(float) );
00144     u_r = (float *)LAPACKE_malloc( nru*(n+2) * sizeof(float) );
00145     c_r = (float *)LAPACKE_malloc( n*(ncc+2) * sizeof(float) );
00146 
00147     /* Initialize input arrays */
00148     init_d( n, d );
00149     init_e( n, e );
00150     init_vt( ldvt*ncvt, vt );
00151     init_u( ldu*n, u );
00152     init_c( ldc*ncc, c );
00153     init_work( 4*n, work );
00154 
00155     /* Backup the ouptut arrays */
00156     for( i = 0; i < n; i++ ) {
00157         d_save[i] = d[i];
00158     }
00159     for( i = 0; i < n; i++ ) {
00160         e_save[i] = e[i];
00161     }
00162     for( i = 0; i < ldvt*ncvt; i++ ) {
00163         vt_save[i] = vt[i];
00164     }
00165     for( i = 0; i < ldu*n; i++ ) {
00166         u_save[i] = u[i];
00167     }
00168     for( i = 0; i < ldc*ncc; i++ ) {
00169         c_save[i] = c[i];
00170     }
00171 
00172     /* Call the LAPACK routine */
00173     sbdsqr_( &uplo, &n, &ncvt, &nru, &ncc, d, e, vt, &ldvt, u, &ldu, c, &ldc,
00174              work, &info );
00175 
00176     /* Initialize input data, call the column-major middle-level
00177      * interface to LAPACK routine and check the results */
00178     for( i = 0; i < n; i++ ) {
00179         d_i[i] = d_save[i];
00180     }
00181     for( i = 0; i < n; i++ ) {
00182         e_i[i] = e_save[i];
00183     }
00184     for( i = 0; i < ldvt*ncvt; i++ ) {
00185         vt_i[i] = vt_save[i];
00186     }
00187     for( i = 0; i < ldu*n; i++ ) {
00188         u_i[i] = u_save[i];
00189     }
00190     for( i = 0; i < ldc*ncc; i++ ) {
00191         c_i[i] = c_save[i];
00192     }
00193     for( i = 0; i < 4*n; i++ ) {
00194         work_i[i] = work[i];
00195     }
00196     info_i = LAPACKE_sbdsqr_work( LAPACK_COL_MAJOR, uplo_i, n_i, ncvt_i, nru_i,
00197                                   ncc_i, d_i, e_i, vt_i, ldvt_i, u_i, ldu_i,
00198                                   c_i, ldc_i, work_i );
00199 
00200     failed = compare_sbdsqr( d, d_i, e, e_i, vt, vt_i, u, u_i, c, c_i, info,
00201                              info_i, ldc, ldu, ldvt, n, ncc, ncvt, nru );
00202     if( failed == 0 ) {
00203         printf( "PASSED: column-major middle-level interface to sbdsqr\n" );
00204     } else {
00205         printf( "FAILED: column-major middle-level interface to sbdsqr\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         d_i[i] = d_save[i];
00212     }
00213     for( i = 0; i < n; i++ ) {
00214         e_i[i] = e_save[i];
00215     }
00216     for( i = 0; i < ldvt*ncvt; i++ ) {
00217         vt_i[i] = vt_save[i];
00218     }
00219     for( i = 0; i < ldu*n; i++ ) {
00220         u_i[i] = u_save[i];
00221     }
00222     for( i = 0; i < ldc*ncc; i++ ) {
00223         c_i[i] = c_save[i];
00224     }
00225     for( i = 0; i < 4*n; i++ ) {
00226         work_i[i] = work[i];
00227     }
00228     info_i = LAPACKE_sbdsqr( LAPACK_COL_MAJOR, uplo_i, n_i, ncvt_i, nru_i,
00229                              ncc_i, d_i, e_i, vt_i, ldvt_i, u_i, ldu_i, c_i,
00230                              ldc_i );
00231 
00232     failed = compare_sbdsqr( d, d_i, e, e_i, vt, vt_i, u, u_i, c, c_i, info,
00233                              info_i, ldc, ldu, ldvt, n, ncc, ncvt, nru );
00234     if( failed == 0 ) {
00235         printf( "PASSED: column-major high-level interface to sbdsqr\n" );
00236     } else {
00237         printf( "FAILED: column-major high-level interface to sbdsqr\n" );
00238     }
00239 
00240     /* Initialize input data, call the row-major middle-level
00241      * interface to LAPACK routine and check the results */
00242     for( i = 0; i < n; i++ ) {
00243         d_i[i] = d_save[i];
00244     }
00245     for( i = 0; i < n; i++ ) {
00246         e_i[i] = e_save[i];
00247     }
00248     for( i = 0; i < ldvt*ncvt; i++ ) {
00249         vt_i[i] = vt_save[i];
00250     }
00251     for( i = 0; i < ldu*n; i++ ) {
00252         u_i[i] = u_save[i];
00253     }
00254     for( i = 0; i < ldc*ncc; i++ ) {
00255         c_i[i] = c_save[i];
00256     }
00257     for( i = 0; i < 4*n; i++ ) {
00258         work_i[i] = work[i];
00259     }
00260 
00261     if( ncvt != 0 ) {
00262         LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, ncvt, vt_i, ldvt, vt_r,
00263                            ncvt+2 );
00264     }
00265     if( nru != 0 ) {
00266         LAPACKE_sge_trans( LAPACK_COL_MAJOR, nru, n, u_i, ldu, u_r, n+2 );
00267     }
00268     if( ncc != 0 ) {
00269         LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, ncc, c_i, ldc, c_r, ncc+2 );
00270     }
00271     info_i = LAPACKE_sbdsqr_work( LAPACK_ROW_MAJOR, uplo_i, n_i, ncvt_i, nru_i,
00272                                   ncc_i, d_i, e_i, vt_r, ldvt_r, u_r, ldu_r,
00273                                   c_r, ldc_r, work_i );
00274 
00275     if( ncvt != 0 ) {
00276         LAPACKE_sge_trans( LAPACK_ROW_MAJOR, n, ncvt, vt_r, ncvt+2, vt_i,
00277                            ldvt );
00278     }
00279     if( nru != 0 ) {
00280         LAPACKE_sge_trans( LAPACK_ROW_MAJOR, nru, n, u_r, n+2, u_i, ldu );
00281     }
00282     if( ncc != 0 ) {
00283         LAPACKE_sge_trans( LAPACK_ROW_MAJOR, n, ncc, c_r, ncc+2, c_i, ldc );
00284     }
00285 
00286     failed = compare_sbdsqr( d, d_i, e, e_i, vt, vt_i, u, u_i, c, c_i, info,
00287                              info_i, ldc, ldu, ldvt, n, ncc, ncvt, nru );
00288     if( failed == 0 ) {
00289         printf( "PASSED: row-major middle-level interface to sbdsqr\n" );
00290     } else {
00291         printf( "FAILED: row-major middle-level interface to sbdsqr\n" );
00292     }
00293 
00294     /* Initialize input data, call the row-major high-level
00295      * interface to LAPACK routine and check the results */
00296     for( i = 0; i < n; i++ ) {
00297         d_i[i] = d_save[i];
00298     }
00299     for( i = 0; i < n; i++ ) {
00300         e_i[i] = e_save[i];
00301     }
00302     for( i = 0; i < ldvt*ncvt; i++ ) {
00303         vt_i[i] = vt_save[i];
00304     }
00305     for( i = 0; i < ldu*n; i++ ) {
00306         u_i[i] = u_save[i];
00307     }
00308     for( i = 0; i < ldc*ncc; i++ ) {
00309         c_i[i] = c_save[i];
00310     }
00311     for( i = 0; i < 4*n; i++ ) {
00312         work_i[i] = work[i];
00313     }
00314 
00315     /* Init row_major arrays */
00316     if( ncvt != 0 ) {
00317         LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, ncvt, vt_i, ldvt, vt_r,
00318                            ncvt+2 );
00319     }
00320     if( nru != 0 ) {
00321         LAPACKE_sge_trans( LAPACK_COL_MAJOR, nru, n, u_i, ldu, u_r, n+2 );
00322     }
00323     if( ncc != 0 ) {
00324         LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, ncc, c_i, ldc, c_r, ncc+2 );
00325     }
00326     info_i = LAPACKE_sbdsqr( LAPACK_ROW_MAJOR, uplo_i, n_i, ncvt_i, nru_i,
00327                              ncc_i, d_i, e_i, vt_r, ldvt_r, u_r, ldu_r, c_r,
00328                              ldc_r );
00329 
00330     if( ncvt != 0 ) {
00331         LAPACKE_sge_trans( LAPACK_ROW_MAJOR, n, ncvt, vt_r, ncvt+2, vt_i,
00332                            ldvt );
00333     }
00334     if( nru != 0 ) {
00335         LAPACKE_sge_trans( LAPACK_ROW_MAJOR, nru, n, u_r, n+2, u_i, ldu );
00336     }
00337     if( ncc != 0 ) {
00338         LAPACKE_sge_trans( LAPACK_ROW_MAJOR, n, ncc, c_r, ncc+2, c_i, ldc );
00339     }
00340 
00341     failed = compare_sbdsqr( d, d_i, e, e_i, vt, vt_i, u, u_i, c, c_i, info,
00342                              info_i, ldc, ldu, ldvt, n, ncc, ncvt, nru );
00343     if( failed == 0 ) {
00344         printf( "PASSED: row-major high-level interface to sbdsqr\n" );
00345     } else {
00346         printf( "FAILED: row-major high-level interface to sbdsqr\n" );
00347     }
00348 
00349     /* Release memory */
00350     if( d != NULL ) {
00351         LAPACKE_free( d );
00352     }
00353     if( d_i != NULL ) {
00354         LAPACKE_free( d_i );
00355     }
00356     if( d_save != NULL ) {
00357         LAPACKE_free( d_save );
00358     }
00359     if( e != NULL ) {
00360         LAPACKE_free( e );
00361     }
00362     if( e_i != NULL ) {
00363         LAPACKE_free( e_i );
00364     }
00365     if( e_save != NULL ) {
00366         LAPACKE_free( e_save );
00367     }
00368     if( vt != NULL ) {
00369         LAPACKE_free( vt );
00370     }
00371     if( vt_i != NULL ) {
00372         LAPACKE_free( vt_i );
00373     }
00374     if( vt_r != NULL ) {
00375         LAPACKE_free( vt_r );
00376     }
00377     if( vt_save != NULL ) {
00378         LAPACKE_free( vt_save );
00379     }
00380     if( u != NULL ) {
00381         LAPACKE_free( u );
00382     }
00383     if( u_i != NULL ) {
00384         LAPACKE_free( u_i );
00385     }
00386     if( u_r != NULL ) {
00387         LAPACKE_free( u_r );
00388     }
00389     if( u_save != NULL ) {
00390         LAPACKE_free( u_save );
00391     }
00392     if( c != NULL ) {
00393         LAPACKE_free( c );
00394     }
00395     if( c_i != NULL ) {
00396         LAPACKE_free( c_i );
00397     }
00398     if( c_r != NULL ) {
00399         LAPACKE_free( c_r );
00400     }
00401     if( c_save != NULL ) {
00402         LAPACKE_free( c_save );
00403     }
00404     if( work != NULL ) {
00405         LAPACKE_free( work );
00406     }
00407     if( work_i != NULL ) {
00408         LAPACKE_free( work_i );
00409     }
00410 
00411     return 0;
00412 }
00413 
00414 /* Auxiliary function: sbdsqr scalar parameters initialization */
00415 static void init_scalars_sbdsqr( char *uplo, lapack_int *n, lapack_int *ncvt,
00416                                  lapack_int *nru, lapack_int *ncc,
00417                                  lapack_int *ldvt, lapack_int *ldu,
00418                                  lapack_int *ldc )
00419 {
00420     *uplo = 'L';
00421     *n = 4;
00422     *ncvt = 6;
00423     *nru = 4;
00424     *ncc = 0;
00425     *ldvt = 8;
00426     *ldu = 8;
00427     *ldc = 8;
00428 
00429     return;
00430 }
00431 
00432 /* Auxiliary functions: sbdsqr array parameters initialization */
00433 static void init_d( lapack_int size, float *d ) {
00434     lapack_int i;
00435     for( i = 0; i < size; i++ ) {
00436         d[i] = 0;
00437     }
00438     d[0] = 7.629240036e+000;
00439     d[1] = -6.241923332e+000;
00440     d[2] = 5.780192375e+000;
00441     d[3] = 6.101348877e+000;
00442 }
00443 static void init_e( lapack_int size, float *e ) {
00444     lapack_int i;
00445     for( i = 0; i < size; i++ ) {
00446         e[i] = 0;
00447     }
00448     e[0] = -1.485074878e+000;
00449     e[1] = 6.107655168e-001;
00450     e[2] = -1.900582910e+000;
00451     e[3] = 0.000000000e+000;
00452 }
00453 static void init_vt( lapack_int size, float *vt ) {
00454     lapack_int i;
00455     for( i = 0; i < size; i++ ) {
00456         vt[i] = 0;
00457     }
00458     vt[0] = -7.104246616e-001;  /* vt[0,0] */
00459     vt[8] = 4.299248457e-001;  /* vt[0,1] */
00460     vt[16] = -4.823547602e-001;  /* vt[0,2] */
00461     vt[24] = 3.539015725e-002;  /* vt[0,3] */
00462     vt[32] = 2.700137794e-001;  /* vt[0,4] */
00463     vt[40] = 6.029434502e-002;  /* vt[0,5] */
00464     vt[1] = -3.583182693e-001;  /* vt[1,0] */
00465     vt[9] = -1.381785125e-001;  /* vt[1,1] */
00466     vt[17] = 4.110382795e-001;  /* vt[1,2] */
00467     vt[25] = -4.044364393e-001;  /* vt[1,3] */
00468     vt[33] = -9.507472068e-002;  /* vt[1,4] */
00469     vt[41] = 7.148106694e-001;  /* vt[1,5] */
00470     vt[2] = 5.070817843e-002;  /* vt[2,0] */
00471     vt[10] = -4.243623018e-001;  /* vt[2,1] */
00472     vt[18] = -3.795116246e-001;  /* vt[2,2] */
00473     vt[26] = -7.401832938e-001;  /* vt[2,3] */
00474     vt[34] = 2.773422897e-001;  /* vt[2,4] */
00475     vt[42] = -2.202864289e-001;  /* vt[2,5] */
00476     vt[3] = 2.441712618e-001;  /* vt[3,0] */
00477     vt[11] = 4.015893340e-001;  /* vt[3,1] */
00478     vt[19] = 4.158065021e-001;  /* vt[3,2] */
00479     vt[27] = -1.353821754e-001;  /* vt[3,3] */
00480     vt[35] = 7.666127682e-001;  /* vt[3,4] */
00481     vt[43] = -1.370760892e-002;  /* vt[3,5] */
00482 }
00483 static void init_u( lapack_int size, float *u ) {
00484     lapack_int i;
00485     for( i = 0; i < size; i++ ) {
00486         u[i] = 0;
00487     }
00488     u[0] = 1.000000000e+000;  /* u[0,0] */
00489     u[8] = 0.000000000e+000;  /* u[0,1] */
00490     u[16] = 0.000000000e+000;  /* u[0,2] */
00491     u[24] = 0.000000000e+000;  /* u[0,3] */
00492     u[1] = 0.000000000e+000;  /* u[1,0] */
00493     u[9] = -8.126223087e-002;  /* u[1,1] */
00494     u[17] = 5.550414696e-002;  /* u[1,2] */
00495     u[25] = -9.951459169e-001;  /* u[1,3] */
00496     u[2] = 0.000000000e+000;  /* u[2,0] */
00497     u[10] = -6.878196448e-002;  /* u[2,1] */
00498     u[18] = -9.963802099e-001;  /* u[2,2] */
00499     u[26] = -4.995632172e-002;  /* u[2,3] */
00500     u[3] = 0.000000000e+000;  /* u[3,0] */
00501     u[11] = -9.943164587e-001;  /* u[3,1] */
00502     u[19] = 6.438853592e-002;  /* u[3,2] */
00503     u[27] = 8.478602767e-002;  /* u[3,3] */
00504 }
00505 static void init_c( lapack_int size, float *c ) {
00506     lapack_int i;
00507     for( i = 0; i < size; i++ ) {
00508         c[i] = 0;
00509     }
00510 }
00511 static void init_work( lapack_int size, float *work ) {
00512     lapack_int i;
00513     for( i = 0; i < size; i++ ) {
00514         work[i] = 0;
00515     }
00516 }
00517 
00518 /* Auxiliary function: C interface to sbdsqr results check */
00519 /* Return value: 0 - test is passed, non-zero - test is failed */
00520 static int compare_sbdsqr( float *d, float *d_i, float *e, float *e_i,
00521                            float *vt, float *vt_i, float *u, float *u_i,
00522                            float *c, float *c_i, lapack_int info,
00523                            lapack_int info_i, lapack_int ldc, lapack_int ldu,
00524                            lapack_int ldvt, lapack_int n, lapack_int ncc,
00525                            lapack_int ncvt, lapack_int nru )
00526 {
00527     lapack_int i;
00528     int failed = 0;
00529     for( i = 0; i < n; i++ ) {
00530         failed += compare_floats(d[i],d_i[i]);
00531     }
00532     for( i = 0; i < n; i++ ) {
00533         failed += compare_floats(e[i],e_i[i]);
00534     }
00535     if( ncvt != 0 ) {
00536         for( i = 0; i < ldvt*ncvt; i++ ) {
00537             failed += compare_floats(vt[i],vt_i[i]);
00538         }
00539     }
00540     if( nru != 0 ) {
00541         for( i = 0; i < ldu*n; i++ ) {
00542             failed += compare_floats(u[i],u_i[i]);
00543         }
00544     }
00545     if( ncc != 0 ) {
00546         for( i = 0; i < ldc*ncc; i++ ) {
00547             failed += compare_floats(c[i],c_i[i]);
00548         }
00549     }
00550     failed += (info == info_i) ? 0 : 1;
00551     if( info != 0 || info_i != 0 ) {
00552         printf( "info=%d, info_i=%d\n",(int)info,(int)info_i );
00553     }
00554 
00555     return failed;
00556 }


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