You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

cblas_ssyrk.c 2.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. *
  3. * cblas_ssyrk.c
  4. * This program is a C interface to ssyrk.
  5. * Written by Keita Teranishi
  6. * 4/8/1998
  7. *
  8. */
  9. #include "cblas.h"
  10. #include "cblas_f77.h"
  11. void cblas_ssyrk(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo,
  12. const CBLAS_TRANSPOSE Trans, const int N, const int K,
  13. const float alpha, const float *A, const int lda,
  14. const float beta, float *C, const int ldc)
  15. {
  16. char UL, TR;
  17. #ifdef F77_CHAR
  18. F77_CHAR F77_TR, F77_UL;
  19. #else
  20. #define F77_TR &TR
  21. #define F77_UL &UL
  22. #endif
  23. #ifdef F77_INT
  24. F77_INT F77_N=N, F77_K=K, F77_lda=lda;
  25. F77_INT F77_ldc=ldc;
  26. #else
  27. #define F77_N N
  28. #define F77_K K
  29. #define F77_lda lda
  30. #define F77_ldc ldc
  31. #endif
  32. extern int CBLAS_CallFromC;
  33. extern int RowMajorStrg;
  34. RowMajorStrg = 0;
  35. CBLAS_CallFromC = 1;
  36. if( layout == CblasColMajor )
  37. {
  38. if( Uplo == CblasUpper) UL='U';
  39. else if ( Uplo == CblasLower ) UL='L';
  40. else
  41. {
  42. cblas_xerbla(2, "cblas_ssyrk",
  43. "Illegal Uplo setting, %d\n", Uplo);
  44. CBLAS_CallFromC = 0;
  45. RowMajorStrg = 0;
  46. return;
  47. }
  48. if( Trans == CblasTrans) TR ='T';
  49. else if ( Trans == CblasConjTrans ) TR='C';
  50. else if ( Trans == CblasNoTrans ) TR='N';
  51. else
  52. {
  53. cblas_xerbla(3, "cblas_ssyrk",
  54. "Illegal Trans setting, %d\n", Trans);
  55. CBLAS_CallFromC = 0;
  56. RowMajorStrg = 0;
  57. return;
  58. }
  59. #ifdef F77_CHAR
  60. F77_UL = C2F_CHAR(&UL);
  61. F77_TR = C2F_CHAR(&TR);
  62. #endif
  63. F77_ssyrk(F77_UL, F77_TR, &F77_N, &F77_K, &alpha, A, &F77_lda, &beta, C, &F77_ldc);
  64. } else if (layout == CblasRowMajor)
  65. {
  66. RowMajorStrg = 1;
  67. if( Uplo == CblasUpper) UL='L';
  68. else if ( Uplo == CblasLower ) UL='U';
  69. else
  70. {
  71. cblas_xerbla(3, "cblas_ssyrk",
  72. "Illegal Uplo setting, %d\n", Uplo);
  73. CBLAS_CallFromC = 0;
  74. RowMajorStrg = 0;
  75. return;
  76. }
  77. if( Trans == CblasTrans) TR ='N';
  78. else if ( Trans == CblasConjTrans ) TR='N';
  79. else if ( Trans == CblasNoTrans ) TR='T';
  80. else
  81. {
  82. cblas_xerbla(3, "cblas_ssyrk",
  83. "Illegal Trans setting, %d\n", Trans);
  84. CBLAS_CallFromC = 0;
  85. RowMajorStrg = 0;
  86. return;
  87. }
  88. #ifdef F77_CHAR
  89. F77_UL = C2F_CHAR(&UL);
  90. F77_TR = C2F_CHAR(&TR);
  91. #endif
  92. F77_ssyrk(F77_UL, F77_TR, &F77_N, &F77_K, &alpha, A, &F77_lda, &beta, C, &F77_ldc);
  93. } else cblas_xerbla(1, "cblas_ssyrk",
  94. "Illegal layout setting, %d\n", layout);
  95. CBLAS_CallFromC = 0;
  96. RowMajorStrg = 0;
  97. return;
  98. }