LAPACK
3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
c_xerbla.c
Go to the documentation of this file.
1
#include <stdio.h>
2
#include <ctype.h>
3
#include <stdarg.h>
4
#include <string.h>
5
#include "
cblas.h
"
6
#include "
cblas_test.h
"
7
8
void
cblas_xerbla
(
CBLAS_INT
info,
const
char
*rout,
const
char
*form, ...)
9
{
10
extern
CBLAS_INT
cblas_lerr
,
cblas_info
,
cblas_ok
;
11
extern
CBLAS_INT
link_xerbla
;
12
extern
int
RowMajorStrg
;
13
extern
char
*
cblas_rout
;
14
15
/* Initially, c__3chke may call this routine with
16
* global variable link_xerbla=1, and F77_xerbla will set link_xerbla=0.
17
* This is done to fool the linker into loading these subroutines first
18
* instead of ones in the CBLAS or the legacy BLAS library.
19
*/
20
if
(
link_xerbla
)
return
;
21
22
if
(
cblas_rout
!= NULL && strcmp(
cblas_rout
, rout) != 0){
23
printf(
"***** XERBLA WAS CALLED WITH SRNAME = <%s> INSTEAD OF <%s> *******\n"
, rout,
cblas_rout
);
24
cblas_ok
=
FALSE
;
25
}
26
27
if
(
RowMajorStrg
)
28
{
29
/* To properly check leading dimension problems in cblas__gemm, we
30
* need to do the following trick. When cblas__gemm is called with
31
* CblasRowMajor, the arguments A and B switch places in the call to
32
* f77__gemm. Thus when we test for bad leading dimension problems
33
* for A and B, lda is in position 11 instead of 9, and ldb is in
34
* position 9 instead of 11.
35
*/
36
if
(strstr(rout,
"gemm"
) != 0 && strstr(rout,
"gemmtr"
) == 0)
37
{
38
if
(info == 5 ) info = 4;
39
else
if
(info == 4 ) info = 5;
40
else
if
(info == 11) info = 9;
41
else
if
(info == 9 ) info = 11;
42
}
else
if
(strstr(rout,
"gemmtr"
) != 0)
43
{
44
if
(info == 11) info = 9;
45
else
if
(info == 9 ) info = 11;
46
}
47
48
else
if
(strstr(rout,
"symm"
) != 0 || strstr(rout,
"hemm"
) != 0)
49
{
50
if
(info == 5 ) info = 4;
51
else
if
(info == 4 ) info = 5;
52
}
53
else
if
(strstr(rout,
"trmm"
) != 0 || strstr(rout,
"trsm"
) != 0)
54
{
55
if
(info == 7 ) info = 6;
56
else
if
(info == 6 ) info = 7;
57
}
58
else
if
(strstr(rout,
"gemv"
) != 0)
59
{
60
if
(info == 4) info = 3;
61
else
if
(info == 3) info = 4;
62
}
63
else
if
(strstr(rout,
"gbmv"
) != 0)
64
{
65
if
(info == 4) info = 3;
66
else
if
(info == 3) info = 4;
67
else
if
(info == 6) info = 5;
68
else
if
(info == 5) info = 6;
69
}
70
else
if
(strstr(rout,
"ger"
) != 0)
71
{
72
if
(info == 3) info = 2;
73
else
if
(info == 2) info = 3;
74
else
if
(info == 8) info = 6;
75
else
if
(info == 6) info = 8;
76
}
77
else
if
( ( strstr(rout,
"her2"
) != 0 || strstr(rout,
"hpr2"
) != 0 )
78
&& strstr(rout,
"her2k"
) == 0 )
79
{
80
if
(info == 8) info = 6;
81
else
if
(info == 6) info = 8;
82
}
83
}
84
85
if
(info !=
cblas_info
){
86
printf(
"***** XERBLA WAS CALLED WITH INFO = %"
CBLAS_IFMT
" INSTEAD OF %d in %s *******\n"
,info,
cblas_info
, rout);
87
cblas_lerr
=
PASSED
;
88
cblas_ok
=
FALSE
;
89
}
else
cblas_lerr
=
FAILED
;
90
}
91
92
#ifdef F77_Char
93
void
F77_xerbla
(F77_Char F77_srname,
void
*vinfo
94
#
else
95
void
F77_xerbla
(
char
*srname,
void
*vinfo
96
#endif
97
#ifdef
BLAS_FORTRAN_STRLEN_END
98
,
FORTRAN_STRLEN
srname_len
99
#endif
100
)
101
{
102
#ifdef F77_Char
103
char
*srname;
104
#endif
105
106
char
rout[] = {
'c'
,
'b'
,
'l'
,
'a'
,
's'
,
'_'
,
'\0'
,
'\0'
,
'\0'
,
'\0'
,
'\0'
,
'\0'
,
'\0'
,
'\0'
};
107
108
#ifdef F77_Integer
109
F77_Integer *info=vinfo;
110
F77_Integer i;
111
extern
F77_Integer
link_xerbla
;
112
#else
113
CBLAS_INT
*info=vinfo;
114
CBLAS_INT
i;
115
extern
CBLAS_INT
link_xerbla
;
116
#endif
117
#ifdef F77_Char
118
srname = F2C_STR(F77_srname,
XerblaStrLen
);
119
#endif
120
121
/* See the comment in cblas_xerbla() above */
122
if
(
link_xerbla
)
123
{
124
link_xerbla
= 0;
125
return
;
126
}
127
for
(i=0; i < 7; i++) rout[i+6] = tolower(srname[i]);
128
for
(i=12; i >= 9; i--)
if
(rout[i] ==
' '
) rout[i] =
'\0'
;
129
130
/* We increment *info by 1 since the CBLAS interface adds one more
131
* argument to all level 2 and 3 routines.
132
*/
133
cblas_xerbla
(*info+1,rout,
""
);
134
}
cblas_lerr
CBLAS_INT cblas_lerr
Definition
c_c2chke.c:6
cblas_ok
CBLAS_INT cblas_ok
Definition
c_c2chke.c:6
cblas_info
CBLAS_INT cblas_info
Definition
c_c2chke.c:6
cblas_rout
char * cblas_rout
Definition
c_c2chke.c:8
link_xerbla
CBLAS_INT link_xerbla
Definition
c_c2chke.c:7
cblas_xerbla
void cblas_xerbla(CBLAS_INT info, const char *rout, const char *form,...)
Definition
c_xerbla.c:8
CBLAS_IFMT
#define CBLAS_IFMT
Definition
cblas.h:35
CBLAS_INT
#define CBLAS_INT
Definition
cblas.h:24
cblas.h
BLAS_FORTRAN_STRLEN_END
#define BLAS_FORTRAN_STRLEN_END
Definition
cblas_f77.h:18
FORTRAN_STRLEN
#define FORTRAN_STRLEN
Definition
cblas_f77.h:21
F77_xerbla
#define F77_xerbla(...)
Definition
cblas_f77.h:578
RowMajorStrg
int RowMajorStrg
Definition
cblas_globals.c:2
FAILED
#define FAILED
Definition
cblas_test.h:24
FALSE
#define FALSE
Definition
cblas_test.h:23
PASSED
#define PASSED
Definition
cblas_test.h:20
cblas_test.h
XerblaStrLen
#define XerblaStrLen
Definition
xerbla.c:6
CBLAS
testing
c_xerbla.c
Generated on Mon Jan 20 2025 17:18:07 for LAPACK by
1.11.0