cblas_csyr2k.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. *
  3. * cblas_csyr2k.c
  4. * This program is a C interface to csyr2k.
  5. * Written by Keita Teranishi
  6. * 4/8/1998
  7. *
  8. */
  9. #include "cblas.h"
  10. #include "cblas_f77.h"
  11. void cblas_csyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
  12. const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
  13. const void *alpha, const void *A, const int lda,
  14. const void *B, const int ldb, const void *beta,
  15. void *C, const int ldc)
  16. {
  17. char UL, TR;
  18. #ifdef F77_CHAR
  19. F77_CHAR F77_TR, F77_UL;
  20. #else
  21. #define F77_TR &TR
  22. #define F77_UL &UL
  23. #endif
  24. #ifdef F77_INT
  25. F77_INT F77_N=N, F77_K=K, F77_lda=lda, F77_ldb=ldb;
  26. F77_INT F77_ldc=ldc;
  27. #else
  28. #define F77_N N
  29. #define F77_K K
  30. #define F77_lda lda
  31. #define F77_ldb ldb
  32. #define F77_ldc ldc
  33. #endif
  34. extern int CBLAS_CallFromC;
  35. extern int RowMajorStrg;
  36. RowMajorStrg = 0;
  37. CBLAS_CallFromC = 1;
  38. if( Order == CblasColMajor )
  39. {
  40. if( Uplo == CblasUpper) UL='U';
  41. else if ( Uplo == CblasLower ) UL='L';
  42. else
  43. {
  44. cblas_xerbla(2, "cblas_csyr2k", "Illegal Uplo setting, %d\n", Uplo);
  45. CBLAS_CallFromC = 0;
  46. RowMajorStrg = 0;
  47. return;
  48. }
  49. if( Trans == CblasTrans) TR ='T';
  50. else if ( Trans == CblasConjTrans ) TR='C';
  51. else if ( Trans == CblasNoTrans ) TR='N';
  52. else
  53. {
  54. cblas_xerbla(3, "cblas_csyr2k", "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_csyr2k(F77_UL, F77_TR, &F77_N, &F77_K, alpha, A, &F77_lda,
  64. B, &F77_ldb, beta, C, &F77_ldc);
  65. } else if (Order == CblasRowMajor)
  66. {
  67. RowMajorStrg = 1;
  68. if( Uplo == CblasUpper) UL='L';
  69. else if ( Uplo == CblasLower ) UL='U';
  70. else
  71. {
  72. cblas_xerbla(3, "cblas_csyr2k", "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_csyr2k", "Illegal Trans setting, %d\n", Trans);
  83. CBLAS_CallFromC = 0;
  84. RowMajorStrg = 0;
  85. return;
  86. }
  87. #ifdef F77_CHAR
  88. F77_UL = C2F_CHAR(&UL);
  89. F77_TR = C2F_CHAR(&TR);
  90. #endif
  91. F77_csyr2k(F77_UL, F77_TR, &F77_N, &F77_K, alpha, A, &F77_lda, B, &F77_ldb, beta, C, &F77_ldc);
  92. }
  93. else cblas_xerbla(1, "cblas_csyr2k", "Illegal Order setting, %d\n", Order);
  94. CBLAS_CallFromC = 0;
  95. RowMajorStrg = 0;
  96. return;
  97. }