1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
#include <flens/blas/interface/blas/config.h>
using namespace flens; extern "C" { void BLAS(cherk)(const char *UPLO, const char *TRANS, const INTEGER *N, const INTEGER *K, const float *ALPHA, const cfloat *_A, const INTEGER *LDA, const float *BETA, cfloat *_C, const INTEGER *LDC) { using std::abs; using std::max; INTEGER info = 0; char _UPLO = toupper(*UPLO); char _TRANS = toupper(*TRANS); INTEGER nRowA = (_TRANS=='N') ? *N : *K; if (_UPLO!='U' && _UPLO!='L') { info = 1; } else if (_TRANS!='N' && _TRANS!='C') { info = 2; } else if (*N<0) { info = 3; } else if (*K<0) { info = 4; } else if (*LDA<max(INTEGER(1),nRowA)) { info = 7; } else if (*LDC<max(INTEGER(1),*N)) { info = 10; } if (info!=0) { BLAS(xerbla)("CHERK ", &info); return; } StorageUpLo upLo = StorageUpLo(_UPLO); Transpose trans = convertTo<Transpose>(_TRANS); const bool noTrans = (trans==NoTrans || trans==Conj); CGeMatrixConstView A = CFullConstView(noTrans ? *N : *K, noTrans ? *K : *N, _A, *LDA); CHeMatrixView C(CFullView(*N, *N, _C, *LDC), upLo); # ifdef TEST_OVERLOADED_OPERATORS const auto alpha = *ALPHA; const auto beta = *BETA; if (beta==float(1)) { if (trans==NoTrans) { C += alpha*A*conjTrans(A); } else if (trans==ConjTrans) { C += alpha*conjTrans(A)*A; } } else if (beta==float(0)) { if (trans==NoTrans) { C = alpha*A*conjTrans(A); } else if (trans==ConjTrans) { C = alpha*conjTrans(A)*A; } } else { if (trans==NoTrans) { C = beta*C + alpha*A*conjTrans(A); } else if (trans==ConjTrans) { C = beta*C + alpha*conjTrans(A)*A; } } # else blas::rk(trans, *ALPHA, A, *BETA, C); # endif } void BLAS(zherk)(const char *UPLO, const char *TRANS, const INTEGER *N, const INTEGER *K, const double *ALPHA, const cdouble *_A, const INTEGER *LDA, const double *BETA, cdouble *_C, const INTEGER *LDC) { using std::abs; using std::max; INTEGER info = 0; char _UPLO = toupper(*UPLO); char _TRANS = toupper(*TRANS); INTEGER nRowA = (_TRANS=='N') ? *N : *K; if (_UPLO!='U' && _UPLO!='L') { info = 1; } else if (_TRANS!='N' && _TRANS!='C') { info = 2; } else if (*N<0) { info = 3; } else if (*K<0) { info = 4; } else if (*LDA<max(INTEGER(1),nRowA)) { info = 7; } else if (*LDC<max(INTEGER(1),*N)) { info = 10; } if (info!=0) { BLAS(xerbla)("ZHERK ", &info); return; } StorageUpLo upLo = StorageUpLo(_UPLO); Transpose trans = convertTo<Transpose>(_TRANS); const bool noTrans = (trans==NoTrans || trans==Conj); ZGeMatrixConstView A = ZFullConstView(noTrans ? *N : *K, noTrans ? *K : *N, _A, *LDA); ZHeMatrixView C(ZFullView(*N, *N, _C, *LDC), upLo); # ifdef TEST_OVERLOADED_OPERATORS const auto alpha = *ALPHA; const auto beta = *BETA; if (beta==double(1)) { if (trans==NoTrans) { C += alpha*A*conjTrans(A); } else if (trans==ConjTrans) { C += alpha*conjTrans(A)*A; } } else if (beta==double(0)) { if (trans==NoTrans) { C = alpha*A*conjTrans(A); } else if (trans==ConjTrans) { C = alpha*conjTrans(A)*A; } } else { if (trans==NoTrans) { C = beta*C + alpha*A*conjTrans(A); } else if (trans==ConjTrans) { C = beta*C + alpha*conjTrans(A)*A; } } # else blas::rk(trans, *ALPHA, A, *BETA, C); # endif } } // extern "C" |