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_csyrk.c 2.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. *
  3. * cblas_csyrk.c
  4. * This program is a C interface to csyrk.
  5. * Written by Keita Teranishi
  6. * 4/8/1998
  7. *
  8. */
  9. #include "cblas.h"
  10. #include "cblas_f77.h"
  11. void cblas_csyrk(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo,
  12. const CBLAS_TRANSPOSE Trans, const int N, const int K,
  13. const void *alpha, const void *A, const int lda,
  14. const void *beta, void *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_csyrk", "Illegal Uplo setting, %d\n", Uplo);
  43. CBLAS_CallFromC = 0;
  44. RowMajorStrg = 0;
  45. return;
  46. }
  47. if( Trans == CblasTrans) TR ='T';
  48. else if ( Trans == CblasConjTrans ) TR='C';
  49. else if ( Trans == CblasNoTrans ) TR='N';
  50. else
  51. {
  52. cblas_xerbla(3, "cblas_csyrk", "Illegal Trans setting, %d\n", Trans);
  53. CBLAS_CallFromC = 0;
  54. RowMajorStrg = 0;
  55. return;
  56. }
  57. #ifdef F77_CHAR
  58. F77_UL = C2F_CHAR(&UL);
  59. F77_TR = C2F_CHAR(&TR);
  60. #endif
  61. F77_csyrk(F77_UL, F77_TR, &F77_N, &F77_K, alpha, A, &F77_lda,
  62. beta, C, &F77_ldc);
  63. } else if (layout == CblasRowMajor)
  64. {
  65. RowMajorStrg = 1;
  66. if( Uplo == CblasUpper) UL='L';
  67. else if ( Uplo == CblasLower ) UL='U';
  68. else
  69. {
  70. cblas_xerbla(3, "cblas_csyrk", "Illegal Uplo setting, %d\n", Uplo);
  71. CBLAS_CallFromC = 0;
  72. RowMajorStrg = 0;
  73. return;
  74. }
  75. if( Trans == CblasTrans) TR ='N';
  76. else if ( Trans == CblasConjTrans ) TR='N';
  77. else if ( Trans == CblasNoTrans ) TR='T';
  78. else
  79. {
  80. cblas_xerbla(3, "cblas_csyrk", "Illegal Trans setting, %d\n", Trans);
  81. CBLAS_CallFromC = 0;
  82. RowMajorStrg = 0;
  83. return;
  84. }
  85. #ifdef F77_CHAR
  86. F77_UL = C2F_CHAR(&UL);
  87. F77_TR = C2F_CHAR(&TR);
  88. #endif
  89. F77_csyrk(F77_UL, F77_TR, &F77_N, &F77_K, alpha, A, &F77_lda,
  90. beta, C, &F77_ldc);
  91. }
  92. else cblas_xerbla(1, "cblas_csyrk", "Illegal layout setting, %d\n", layout);
  93. CBLAS_CallFromC = 0;
  94. RowMajorStrg = 0;
  95. return;
  96. }