Debian Codegraph @

CBLAS/src/cblas_dgemmtr.c

raw
1 /*
2 *
3 * cblas_dgemmtr.c
4 * This program is a C interface to dgemmtr.
5 * Written by Martin Koehler, MPI Magdeburg
6 * 06/24/2024
7 *
8 */
9
10 #include "cblas.h"
11 #include "cblas_f77.h"
12 void API_SUFFIX(cblas_dgemmtr)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo, const CBLAS_TRANSPOSE TransA,
13 const CBLAS_TRANSPOSE TransB, const CBLAS_INT N,
14 const CBLAS_INT K, const double alpha, const double *A,
15 const CBLAS_INT lda, const double *B, const CBLAS_INT ldb,
16 const double beta, double *C, const CBLAS_INT ldc)
17 {
18 char TA, TB, UL;
19 #ifdef F77_CHAR
20 F77_CHAR F77_TA, F77_TB. F77_UL;
21 #else
22 #define F77_TA &TA
23 #define F77_TB &TB
24 #define F77_UL &UL
25 #endif
26
27 #ifdef F77_INT
28 F77_INT F77_N=N, F77_K=K, F77_lda=lda, F77_ldb=ldb;
29 F77_INT F77_ldc=ldc;
30 #else
31 #define F77_N N
32 #define F77_K K
33 #define F77_lda lda
34 #define F77_ldb ldb
35 #define F77_ldc ldc
36 #endif
37
38 extern int CBLAS_CallFromC;
39 extern int RowMajorStrg;
40 RowMajorStrg = 0;
41 CBLAS_CallFromC = 1;
42
43
44 if( layout == CblasColMajor )
45 {
46 if ( Uplo == CblasUpper ) UL = 'U';
47 else if (Uplo == CblasLower) UL= 'L';
48 else {
49 API_SUFFIX(cblas_xerbla)(2, "cblas_dgemmtr", "Illegal Uplo setting, %d\n", Uplo);
50 CBLAS_CallFromC = 0;
51 RowMajorStrg = 0;
52 return;
53 }
54
55
56
57 if(TransA == CblasTrans) TA='T';
58 else if ( TransA == CblasConjTrans ) TA='C';
59 else if ( TransA == CblasNoTrans ) TA='N';
60 else
61 {
62 API_SUFFIX(cblas_xerbla)(3, "cblas_dgemmtr","Illegal TransA setting, %d\n", TransA);
63 CBLAS_CallFromC = 0;
64 RowMajorStrg = 0;
65 return;
66 }
67
68 if(TransB == CblasTrans) TB='T';
69 else if ( TransB == CblasConjTrans ) TB='C';
70 else if ( TransB == CblasNoTrans ) TB='N';
71 else
72 {
73 API_SUFFIX(cblas_xerbla)(4, "cblas_dgemmtr","Illegal TransB setting, %d\n", TransB);
74 CBLAS_CallFromC = 0;
75 RowMajorStrg = 0;
76 return;
77 }
78
79 #ifdef F77_CHAR
80 F77_TA = C2F_CHAR(&TA);
81 F77_TB = C2F_CHAR(&TB);
82 F77_UL = C2F_CHAR(&UL);
83 #endif
84
85 F77_dgemmtr(F77_UL, F77_TA, F77_TB, &F77_N, &F77_K, &alpha, A,
86 &F77_lda, B, &F77_ldb, &beta, C, &F77_ldc);
87 }
88 else if (layout == CblasRowMajor)
89 {
90 if ( Uplo == CblasUpper ) UL = 'L';
91 else if (Uplo == CblasLower) UL= 'U';
92 else {
93 API_SUFFIX(cblas_xerbla)(2, "cblas_dgemmtr", "Illegal Uplo setting, %d\n", Uplo);
94 CBLAS_CallFromC = 0;
95 RowMajorStrg = 0;
96 return;
97 }
98
99
100 RowMajorStrg = 1;
101 if(TransA == CblasTrans) TB='T';
102 else if ( TransA == CblasConjTrans ) TB='C';
103 else if ( TransA == CblasNoTrans ) TB='N';
104 else
105 {
106 API_SUFFIX(cblas_xerbla)(3, "cblas_dgemmtr","Illegal TransA setting, %d\n", TransA);
107 CBLAS_CallFromC = 0;
108 RowMajorStrg = 0;
109 return;
110 }
111 if(TransB == CblasTrans) TA='T';
112 else if ( TransB == CblasConjTrans ) TA='C';
113 else if ( TransB == CblasNoTrans ) TA='N';
114 else
115 {
116 API_SUFFIX(cblas_xerbla)(4, "cblas_dgemmtr","Illegal TransB setting, %d\n", TransB);
117 CBLAS_CallFromC = 0;
118 RowMajorStrg = 0;
119 return;
120 }
121 #ifdef F77_CHAR
122 F77_TA = C2F_CHAR(&TA);
123 F77_TB = C2F_CHAR(&TB);
124 F77_UL = C2F_CHAR(&UL);
125 #endif
126
127 F77_dgemmtr( F77_UL, F77_TA, F77_TB, &F77_N, &F77_K, &alpha, B,
128 &F77_ldb, A, &F77_lda, &beta, C, &F77_ldc);
129 }
130 else API_SUFFIX(cblas_xerbla)(1, "cblas_dgemmtr", "Illegal layout setting, %d\n", layout);
131 CBLAS_CallFromC = 0;
132 RowMajorStrg = 0;
133 return;
134 }