v0.9.0
cblas_ssyr2k.c
Go to the documentation of this file.
1 /*
2  *
3  * cblas_ssyr2k.c
4  * This program is a C interface to ssyr2k.
5  * Written by Keita Teranishi
6  * 4/6/1998
7  *
8  */
9 
10 #include "cblas.h"
11 #include "cblas_f77.h"
12 void cblas_ssyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
13  const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
14  const float alpha, const float *A, const int lda,
15  const float *B, const int ldb, const float beta,
16  float *C, const int ldc)
17 {
18  char UL, TR;
19 #ifdef F77_CHAR
20  F77_CHAR F77_TA, F77_UL;
21 #else
22  #define F77_TR &TR
23  #define F77_UL &UL
24 #endif
25 
26 #ifdef F77_INT
27  F77_INT F77_N=N, F77_K=K, F77_lda=lda, F77_ldb=ldb;
28  F77_INT F77_ldc=ldc;
29 #else
30  #define F77_N N
31  #define F77_K K
32  #define F77_lda lda
33  #define F77_ldb ldb
34  #define F77_ldc ldc
35 #endif
36 
37  extern int CBLAS_CallFromC;
38  extern int RowMajorStrg;
39  RowMajorStrg = 0;
40  CBLAS_CallFromC = 1;
41 
42  if( Order == CblasColMajor )
43  {
44 
45  if( Uplo == CblasUpper) UL='U';
46  else if ( Uplo == CblasLower ) UL='L';
47  else
48  {
49  cblas_xerbla(2, "cblas_ssyr2k",
50  "Illegal Uplo setting, %d\n", Uplo);
51  CBLAS_CallFromC = 0;
52  RowMajorStrg = 0;
53  return;
54  }
55 
56  if( Trans == CblasTrans) TR ='T';
57  else if ( Trans == CblasConjTrans ) TR='C';
58  else if ( Trans == CblasNoTrans ) TR='N';
59  else
60  {
61  cblas_xerbla(3, "cblas_ssyr2k",
62  "Illegal Trans setting, %d\n", Trans);
63  CBLAS_CallFromC = 0;
64  RowMajorStrg = 0;
65  return;
66  }
67 
68 
69  #ifdef F77_CHAR
70  F77_UL = C2F_CHAR(&UL);
71  F77_TR = C2F_CHAR(&TR);
72  #endif
73 
74  F77_ssyr2k(F77_UL, F77_TR, &F77_N, &F77_K, &alpha, A, &F77_lda, B, &F77_ldb, &beta, C, &F77_ldc);
75  } else if (Order == CblasRowMajor)
76  {
77  RowMajorStrg = 1;
78  if( Uplo == CblasUpper) UL='L';
79  else if ( Uplo == CblasLower ) UL='U';
80  else
81  {
82  cblas_xerbla(3, "cblas_ssyr2k",
83  "Illegal Uplo setting, %d\n", Uplo);
84  CBLAS_CallFromC = 0;
85  RowMajorStrg = 0;
86  return;
87  }
88  if( Trans == CblasTrans) TR ='N';
89  else if ( Trans == CblasConjTrans ) TR='N';
90  else if ( Trans == CblasNoTrans ) TR='T';
91  else
92  {
93  cblas_xerbla(3, "cblas_ssyr2k",
94  "Illegal Trans setting, %d\n", Trans);
95  CBLAS_CallFromC = 0;
96  RowMajorStrg = 0;
97  return;
98  }
99 
100  #ifdef F77_CHAR
101  F77_UL = C2F_CHAR(&UL);
102  F77_TR = C2F_CHAR(&TR);
103  #endif
104 
105  F77_ssyr2k(F77_UL, F77_TR, &F77_N, &F77_K, &alpha, A, &F77_lda, B, &F77_ldb, &beta, C, &F77_ldc);
106  } else cblas_xerbla(1, "cblas_ssyr2k",
107  "Illegal Order setting, %d\n", Order);
108  CBLAS_CallFromC = 0;
109  RowMajorStrg = 0;
110  return;
111 }
#define F77_ldc
#define F77_lda
#define F77_K
CBLAS_UPLO
Definition: cblas.h:12
#define F77_ldb
CBLAS_TRANSPOSE
Definition: cblas.h:11
#define F77_TA
void F77_ssyr2k(FCHAR, FCHAR, FINT, FINT, const float *, const float *, FINT, const float *, FINT, const float *, float *, FINT)
int CBLAS_CallFromC
Definition: cblas_globals.c:1
CBLAS_ORDER
Definition: cblas.h:10
void cblas_xerbla(int p, const char *rout, const char *form,...)
Definition: cblas_xerbla.c:8
#define F77_UL
const int N
Definition: speed_test.cpp:3
#define F77_N
#define F77_TR
void cblas_ssyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, const int K, const float alpha, const float *A, const int lda, const float *B, const int ldb, const float beta, float *C, const int ldc)
Definition: cblas_ssyr2k.c:12
int RowMajorStrg
Definition: cblas_globals.c:2