c_xerbla.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <ctype.h>
00003 #include <stdarg.h>
00004 #include <string.h>
00005 #include "cblas.h"
00006 #include "cblas_test.h"
00007 
00008 void cblas_xerbla(int info, const char *rout, const char *form, ...)
00009 {
00010    extern int cblas_lerr, cblas_info, cblas_ok;
00011    extern int link_xerbla;
00012    extern int RowMajorStrg;
00013    extern char *cblas_rout;
00014    
00015    /* Initially, c__3chke will call this routine with 
00016     * global variable link_xerbla=1, and F77_xerbla will set link_xerbla=0. 
00017     * This is done to fool the linker into loading these subroutines first 
00018     * instead of ones in the CBLAS or the legacy BLAS library.
00019     */
00020    if (link_xerbla) return;
00021 
00022    if (cblas_rout != NULL && strcmp(cblas_rout, rout) != 0){
00023       printf("***** XERBLA WAS CALLED WITH SRNAME = <%s> INSTEAD OF <%s> *******\n", rout, cblas_rout);
00024       cblas_ok = FALSE;
00025    }
00026 
00027    if (RowMajorStrg)
00028    {
00029       /* To properly check leading dimension problems in cblas__gemm, we 
00030        * need to do the following trick. When cblas__gemm is called with 
00031        * CblasRowMajor, the arguments A and B switch places in the call to 
00032        * f77__gemm. Thus when we test for bad leading dimension problems 
00033        * for A and B, lda is in position 11 instead of 9, and ldb is in 
00034        * position 9 instead of 11.
00035        */
00036       if (strstr(rout,"gemm") != 0)
00037       {
00038          if      (info == 5 ) info =  4;
00039          else if (info == 4 ) info =  5;
00040          else if (info == 11) info =  9;
00041          else if (info == 9 ) info = 11;
00042       }
00043       else if (strstr(rout,"symm") != 0 || strstr(rout,"hemm") != 0)
00044       {
00045          if      (info == 5 ) info =  4;
00046          else if (info == 4 ) info =  5;
00047       }
00048       else if (strstr(rout,"trmm") != 0 || strstr(rout,"trsm") != 0)
00049       {
00050          if      (info == 7 ) info =  6;
00051          else if (info == 6 ) info =  7;
00052       }
00053       else if (strstr(rout,"gemv") != 0)
00054       {
00055          if      (info == 4)  info = 3;
00056          else if (info == 3)  info = 4;
00057       }
00058       else if (strstr(rout,"gbmv") != 0)
00059       {
00060          if      (info == 4)  info = 3;
00061          else if (info == 3)  info = 4;
00062          else if (info == 6)  info = 5;
00063          else if (info == 5)  info = 6;
00064       }
00065       else if (strstr(rout,"ger") != 0)
00066       {
00067          if      (info == 3) info = 2;
00068          else if (info == 2) info = 3;
00069          else if (info == 8) info = 6;
00070          else if (info == 6) info = 8;
00071       }
00072       else if ( ( strstr(rout,"her2") != 0 || strstr(rout,"hpr2") != 0 )
00073                && strstr(rout,"her2k") == 0 )
00074       {
00075          if      (info == 8) info = 6;
00076          else if (info == 6) info = 8;
00077       }
00078    }
00079 
00080    if (info != cblas_info){
00081       printf("***** XERBLA WAS CALLED WITH INFO = %d INSTEAD OF %d in %s *******\n",info, cblas_info, rout);
00082       cblas_lerr = PASSED;
00083       cblas_ok = FALSE;
00084    } else cblas_lerr = FAILED;
00085 }
00086 
00087 #ifdef F77_Char
00088 void F77_xerbla(F77_Char F77_srname, void *vinfo)
00089 #else
00090 void F77_xerbla(char *srname, void *vinfo)
00091 #endif
00092 {
00093 #ifdef F77_Char
00094    char *srname;
00095 #endif
00096 
00097    char rout[] = {'c','b','l','a','s','_','\0','\0','\0','\0','\0','\0','\0'};
00098 
00099 #ifdef F77_Integer
00100    F77_Integer *info=vinfo;
00101    F77_Integer i;
00102    extern F77_Integer link_xerbla;
00103 #else
00104    int *info=vinfo;
00105    int i;
00106    extern int link_xerbla;
00107 #endif
00108 #ifdef F77_Char
00109    srname = F2C_STR(F77_srname, XerblaStrLen);
00110 #endif
00111 
00112    /* See the comment in cblas_xerbla() above */
00113    if (link_xerbla)
00114    {
00115       link_xerbla = 0;
00116       return;
00117    }
00118    for(i=0;  i  < 6; i++) rout[i+6] = tolower(srname[i]);
00119    for(i=11; i >= 9; i--) if (rout[i] == ' ') rout[i] = '\0';
00120    
00121    /* We increment *info by 1 since the CBLAS interface adds one more
00122     * argument to all level 2 and 3 routines.
00123     */
00124    cblas_xerbla(*info+1,rout,"");
00125 }


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