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