59 #ifndef _TEUCHOS_BLAS_HPP_
60 #define _TEUCHOS_BLAS_HPP_
121 template<
typename OrdinalType,
typename ScalarType>
145 void ROTG(ScalarType* da, ScalarType* db,
MagnitudeType* c, ScalarType* s)
const;
148 void ROT(
const OrdinalType
n, ScalarType* dx,
const OrdinalType incx, ScalarType* dy,
const OrdinalType incy,
MagnitudeType* c, ScalarType* s)
const;
151 void SCAL(
const OrdinalType
n,
const ScalarType alpha, ScalarType* x,
const OrdinalType incx)
const;
154 void COPY(
const OrdinalType
n,
const ScalarType* x,
const OrdinalType incx, ScalarType* y,
const OrdinalType incy)
const;
157 template <
typename alpha_type,
typename x_type>
158 void AXPY(
const OrdinalType
n,
const alpha_type alpha,
const x_type* x,
const OrdinalType incx, ScalarType* y,
const OrdinalType incy)
const;
164 template <
typename x_type,
typename y_type>
165 ScalarType
DOT(
const OrdinalType
n,
const x_type* x,
const OrdinalType incx,
const y_type* y,
const OrdinalType incy)
const;
171 OrdinalType
IAMAX(
const OrdinalType
n,
const ScalarType* x,
const OrdinalType incx)
const;
178 template <
typename alpha_type,
typename A_type,
typename x_type,
typename beta_type>
179 void GEMV(
ETransp trans,
const OrdinalType m,
const OrdinalType
n,
const alpha_type alpha,
const A_type*
A,
180 const OrdinalType lda,
const x_type* x,
const OrdinalType incx,
const beta_type beta, ScalarType* y,
const OrdinalType incy)
const;
183 template <
typename A_type>
185 const OrdinalType lda, ScalarType* x,
const OrdinalType incx)
const;
189 template <
typename alpha_type,
typename x_type,
typename y_type>
190 void GER(
const OrdinalType m,
const OrdinalType
n,
const alpha_type alpha,
const x_type* x,
const OrdinalType incx,
191 const y_type* y,
const OrdinalType incy, ScalarType*
A,
const OrdinalType lda)
const;
203 template <
typename alpha_type,
typename A_type,
typename B_type,
typename beta_type>
204 void GEMM(
ETransp transa,
ETransp transb,
const OrdinalType m,
const OrdinalType
n,
const OrdinalType k,
const alpha_type alpha,
const A_type*
A,
const OrdinalType lda,
const B_type*
B,
const OrdinalType ldb,
const beta_type beta, ScalarType*
C,
const OrdinalType ldc)
const;
207 template <
typename alpha_type,
typename A_type,
typename B_type,
typename beta_type>
208 void SYMM(
ESide side,
EUplo uplo,
const OrdinalType m,
const OrdinalType
n,
const alpha_type alpha,
const A_type*
A,
const OrdinalType lda,
const B_type*
B,
const OrdinalType ldb,
const beta_type beta, ScalarType*
C,
const OrdinalType ldc)
const;
211 template <
typename alpha_type,
typename A_type,
typename beta_type>
212 void SYRK(
EUplo uplo,
ETransp trans,
const OrdinalType
n,
const OrdinalType k,
const alpha_type alpha,
const A_type*
A,
const OrdinalType lda,
const beta_type beta, ScalarType*
C,
const OrdinalType ldc)
const;
215 template <
typename alpha_type,
typename A_type>
217 const alpha_type alpha,
const A_type*
A,
const OrdinalType lda, ScalarType*
B,
const OrdinalType ldb)
const;
220 template <
typename alpha_type,
typename A_type>
222 const alpha_type alpha,
const A_type*
A,
const OrdinalType lda, ScalarType*
B,
const OrdinalType ldb)
const;
226 template<
typename OrdinalType,
typename ScalarType>
261 template<
typename ScalarType,
bool isComplex>
269 template<
typename ScalarType>
277 template<
typename ScalarType>
281 blas_dabs1(
const ScalarType* a, ScalarType* ret)
const;
284 template<
typename ScalarType,
bool isComplex>
291 ScalarType* s)
const;
295 template<
typename ScalarType>
299 ROTG (ScalarType* ca,
302 ScalarType* s)
const;
306 template<
typename ScalarType>
310 ROTG (ScalarType* da,
313 ScalarType* s)
const;
327 ScalarType
SIGN (ScalarType x, ScalarType y)
const {
330 if (y > STS::zero()) {
331 return STS::magnitude (x);
332 }
else if (y < STS::zero()) {
333 return -STS::magnitude (x);
346 ScalarType signedInfinity = STS::one() / y;
347 if (signedInfinity > STS::zero()) {
348 return STS::magnitude (x);
353 return -STS::magnitude (x);
360 template<
typename ScalarType>
369 typedef typename STS::magnitudeType MagnitudeType;
389 MagnitudeType norm, scale;
391 if (STS::magnitude (*ca) == STM::zero()) {
396 scale = STS::magnitude (*ca) + STS::magnitude (*cb);
400 const MagnitudeType ca_scaled =
401 STS::magnitude (*ca / ScalarType(scale, STM::zero()));
402 const MagnitudeType cb_scaled =
403 STS::magnitude (*cb / ScalarType(scale, STM::zero()));
405 STM::squareroot (ca_scaled*ca_scaled + cb_scaled*cb_scaled);
407 alpha = *ca / STS::magnitude (*ca);
408 *c = STS::magnitude (*ca) / norm;
409 *s = alpha * STS::conjugate (*cb) / norm;
415 template<
typename ScalarType>
446 ScalarType r, roe, scale, z;
449 if (STS::magnitude (*da) > STS::magnitude (*db)) {
452 scale = STS::magnitude (*da) + STS::magnitude (*db);
453 if (scale == STS::zero()) {
462 const ScalarType da_scaled = *da / scale;
463 const ScalarType db_scaled = *db / scale;
464 r = scale * STS::squareroot (da_scaled*da_scaled + db_scaled*db_scaled);
465 r = SIGN (STS::one(), roe) * r;
469 if (STS::magnitude (*da) > STS::magnitude (*db)) {
472 if (STS::magnitude (*db) >= STS::magnitude (*da) && *c != STS::zero()) {
482 template<
typename ScalarType>
491 template<
typename ScalarType>
502 template<
typename OrdinalType,
typename ScalarType>
512 rotator.
ROTG (da, db, c, s);
515 template<
typename OrdinalType,
typename ScalarType>
521 if (incx==1 && incy==1) {
522 for(OrdinalType i=0; i<
n; ++i) {
523 ScalarType temp = *c*dx[i] + sconj*dy[i];
524 dy[i] = *c*dy[i] - sconj*dx[i];
529 OrdinalType ix = 0, iy = 0;
530 if (incx < izero) ix = (-n+1)*incx;
531 if (incy < izero) iy = (-n+1)*incy;
532 for(OrdinalType i=0; i<
n; ++i) {
533 ScalarType temp = *c*dx[ix] + sconj*dy[iy];
534 dy[iy] = *c*dy[iy] - sconj*dx[ix];
542 template<
typename OrdinalType,
typename ScalarType>
547 OrdinalType i, ix = izero;
549 if ( n < ione || incx < ione )
553 for(i = izero; i <
n; i++)
560 template<
typename OrdinalType,
typename ScalarType>
565 OrdinalType i, ix = izero, iy = izero;
568 if (incx < izero) { ix = (-n+ione)*incx; }
569 if (incy < izero) { iy = (-n+ione)*incy; }
571 for(i = izero; i <
n; i++)
580 template<
typename OrdinalType,
typename ScalarType>
581 template <
typename alpha_type,
typename x_type>
586 OrdinalType i, ix = izero, iy = izero;
590 if (incx < izero) { ix = (-n+ione)*incx; }
591 if (incy < izero) { iy = (-n+ione)*incy; }
593 for(i = izero; i <
n; i++)
595 y[iy] += alpha * x[ix];
602 template<
typename OrdinalType,
typename ScalarType>
609 OrdinalType i, ix = izero;
611 if ( n < ione || incx < ione )
615 for (i = izero; i <
n; i++)
625 template<
typename OrdinalType,
typename ScalarType>
626 template <
typename x_type,
typename y_type>
632 OrdinalType i, ix = izero, iy = izero;
636 if (incx < izero) { ix = (-n+ione)*incx; }
637 if (incy < izero) { iy = (-n+ione)*incy; }
639 for(i = izero; i <
n; i++)
649 template<
typename OrdinalType,
typename ScalarType>
656 OrdinalType i, ix = izero;
658 if ( n < ione || incx < ione )
661 for(i = izero; i <
n; i++)
670 template<
typename OrdinalType,
typename ScalarType>
675 OrdinalType result = izero, ix = izero, i;
681 if ( n < ione || incx < ione )
688 for(i = ione; i <
n; i++)
705 template<
typename OrdinalType,
typename ScalarType>
706 template <
typename alpha_type,
typename A_type,
typename x_type,
typename beta_type>
707 void DefaultBLASImpl<OrdinalType, ScalarType>::GEMV(
ETransp trans,
const OrdinalType m,
const OrdinalType
n,
const alpha_type alpha,
const A_type*
A,
const OrdinalType lda,
const x_type* x,
const OrdinalType incx,
const beta_type beta, ScalarType* y,
const OrdinalType incy)
const
717 bool BadArgument =
false;
720 if( m == izero || n == izero || ( alpha == alpha_zero && beta == beta_one ) ){
return; }
724 std::cout <<
"BLAS::GEMV Error: M == " << m << std::endl;
728 std::cout <<
"BLAS::GEMV Error: N == " << n << std::endl;
732 std::cout <<
"BLAS::GEMV Error: LDA < MAX(1,M)"<< std::endl;
735 if( incx == izero ) {
736 std::cout <<
"BLAS::GEMV Error: INCX == 0"<< std::endl;
739 if( incy == izero ) {
740 std::cout <<
"BLAS::GEMV Error: INCY == 0"<< std::endl;
745 OrdinalType i, j, lenx, leny, ix, iy, jx, jy;
746 OrdinalType kx = izero, ky = izero;
762 if (incx < izero ) { kx = (ione - lenx)*incx; }
763 if (incy < izero ) { ky = (ione - leny)*incy; }
767 if(beta != beta_one) {
769 if (beta == beta_zero) {
770 for(i = izero; i < leny; i++) { y[i] = y_zero; }
772 for(i = izero; i < leny; i++) { y[i] *= beta; }
775 if (beta == beta_zero) {
776 for(i = izero; i < leny; i++) {
781 for(i = izero; i < leny; i++) {
790 if(alpha == alpha_zero) {
return; }
796 for(j = izero; j <
n; j++) {
797 if (x[jx] != x_zero) {
799 for(i = izero; i < m; i++) {
800 y[i] += temp*A[j*lda + i];
806 for(j = izero; j <
n; j++) {
807 if (x[jx] != x_zero) {
810 for(i = izero; i < m; i++) {
811 y[iy] += temp*A[j*lda + i];
821 for(j = izero; j <
n; j++) {
824 for(i = izero; i < m; i++) {
825 temp += A[j*lda + i]*x[i];
828 for(i = izero; i < m; i++) {
836 for(j = izero; j <
n; j++) {
840 for (i = izero; i < m; i++) {
841 temp += A[j*lda + i]*x[ix];
845 for (i = izero; i < m; i++) {
858 template<
typename OrdinalType,
typename ScalarType>
859 template <
typename A_type>
865 bool BadArgument =
false;
869 if( n == izero ){
return; }
873 std::cout <<
"BLAS::TRMV Error: N == " << n << std::endl;
877 std::cout <<
"BLAS::TRMV Error: LDA < MAX(1,N)"<< std::endl;
880 if( incx == izero ) {
881 std::cout <<
"BLAS::TRMV Error: INCX == 0"<< std::endl;
886 OrdinalType i, j, ix, jx, kx = izero;
894 if (incx < izero) { kx = (-n+ione)*incx; }
902 for (j=izero; j<
n; j++) {
905 for (i=izero; i<j; i++) {
906 x[i] += temp*A[j*lda + i];
909 x[j] *= A[j*lda + j];
914 for (j=izero; j<
n; j++) {
918 for (i=izero; i<j; i++) {
919 x[ix] += temp*A[j*lda + i];
923 x[jx] *= A[j*lda + j];
930 for (j=n-ione; j>-ione; j--) {
933 for (i=n-ione; i>j; i--) {
934 x[i] += temp*A[j*lda + i];
937 x[j] *= A[j*lda + j];
943 for (j=n-ione; j>-ione; j--) {
947 for (i=n-ione; i>j; i--) {
948 x[ix] += temp*A[j*lda + i];
952 x[jx] *= A[j*lda + j];
963 for (j=n-ione; j>-ione; j--) {
967 temp *= A[j*lda + j];
968 for (i=j-ione; i>-ione; i--) {
969 temp += A[j*lda + i]*x[i];
974 for (i=j-ione; i>-ione; i--) {
981 jx = kx + (n-ione)*incx;
982 for (j=n-ione; j>-ione; j--) {
987 temp *= A[j*lda + j];
988 for (i=j-ione; i>-ione; i--) {
990 temp += A[j*lda + i]*x[ix];
995 for (i=j-ione; i>-ione; i--) {
1007 for (j=izero; j<
n; j++) {
1011 temp *= A[j*lda + j];
1012 for (i=j+ione; i<
n; i++) {
1013 temp += A[j*lda + i]*x[i];
1018 for (i=j+ione; i<
n; i++) {
1026 for (j=izero; j<
n; j++) {
1031 temp *= A[j*lda + j];
1032 for (i=j+ione; i<
n; i++) {
1034 temp += A[j*lda + i]*x[ix];
1039 for (i=j+ione; i<
n; i++) {
1053 template<
typename OrdinalType,
typename ScalarType>
1054 template <
typename alpha_type,
typename x_type,
typename y_type>
1061 bool BadArgument =
false;
1064 if( m == izero || n == izero || alpha == alpha_zero ){
return; }
1068 std::cout <<
"BLAS::GER Error: M == " << m << std::endl;
1072 std::cout <<
"BLAS::GER Error: N == " << n << std::endl;
1076 std::cout <<
"BLAS::GER Error: LDA < MAX(1,M)"<< std::endl;
1080 std::cout <<
"BLAS::GER Error: INCX == 0"<< std::endl;
1084 std::cout <<
"BLAS::GER Error: INCY == 0"<< std::endl;
1089 OrdinalType i, j, ix, jy = izero, kx = izero;
1093 if (incx < izero) { kx = (-m+ione)*incx; }
1094 if (incy < izero) { jy = (-n+ione)*incy; }
1097 if( incx == ione ) {
1098 for( j=izero; j<
n; j++ ) {
1099 if ( y[jy] != y_zero ) {
1101 for ( i=izero; i<m; i++ ) {
1102 A[j*lda + i] += x[i]*temp;
1109 for( j=izero; j<
n; j++ ) {
1110 if ( y[jy] != y_zero ) {
1113 for( i=izero; i<m; i++ ) {
1114 A[j*lda + i] += x[ix]*temp;
1128 template<
typename OrdinalType,
typename ScalarType>
1129 template <
typename alpha_type,
typename A_type,
typename B_type,
typename beta_type>
1130 void DefaultBLASImpl<OrdinalType, ScalarType>::GEMM(
ETransp transa,
ETransp transb,
const OrdinalType m,
const OrdinalType
n,
const OrdinalType k,
const alpha_type alpha,
const A_type*
A,
const OrdinalType lda,
const B_type*
B,
const OrdinalType ldb,
const beta_type beta, ScalarType*
C,
const OrdinalType ldc)
const
1139 OrdinalType i, j, p;
1140 OrdinalType NRowA = m, NRowB = k;
1142 bool BadArgument =
false;
1143 bool conjA =
false, conjB =
false;
1154 if( (m==izero) || (n==izero) || (((alpha==alpha_zero)||(k==izero)) && (beta==beta_one)) ){
return; }
1156 std::cout <<
"BLAS::GEMM Error: M == " << m << std::endl;
1160 std::cout <<
"BLAS::GEMM Error: N == " << n << std::endl;
1164 std::cout <<
"BLAS::GEMM Error: K == " << k << std::endl;
1168 std::cout <<
"BLAS::GEMM Error: LDA < "<<NRowA<<std::endl;
1172 std::cout <<
"BLAS::GEMM Error: LDB < "<<NRowB<<std::endl;
1176 std::cout <<
"BLAS::GEMM Error: LDC < MAX(1,M)"<< std::endl;
1187 if( alpha == alpha_zero ) {
1188 if( beta == beta_zero ) {
1189 for (j=izero; j<
n; j++) {
1190 for (i=izero; i<m; i++) {
1191 C[j*ldc + i] = C_zero;
1195 for (j=izero; j<
n; j++) {
1196 for (i=izero; i<m; i++) {
1197 C[j*ldc + i] *= beta;
1209 for (j=izero; j<
n; j++) {
1210 if( beta == beta_zero ) {
1211 for (i=izero; i<m; i++){
1212 C[j*ldc + i] = C_zero;
1214 }
else if( beta != beta_one ) {
1215 for (i=izero; i<m; i++){
1216 C[j*ldc + i] *= beta;
1219 for (p=izero; p<k; p++){
1220 if (B[j*ldb + p] != B_zero ){
1221 temp = alpha*B[j*ldb + p];
1222 for (i=izero; i<m; i++) {
1223 C[j*ldc + i] += temp*A[p*lda + i];
1228 }
else if ( conjA ) {
1230 for (j=izero; j<
n; j++) {
1231 for (i=izero; i<m; i++) {
1233 for (p=izero; p<k; p++) {
1236 if (beta == beta_zero) {
1237 C[j*ldc + i] = alpha*temp;
1239 C[j*ldc + i] = alpha*temp + beta*C[j*ldc + i];
1245 for (j=izero; j<
n; j++) {
1246 for (i=izero; i<m; i++) {
1248 for (p=izero; p<k; p++) {
1249 temp += A[i*lda + p]*B[j*ldb + p];
1251 if (beta == beta_zero) {
1252 C[j*ldc + i] = alpha*temp;
1254 C[j*ldc + i] = alpha*temp + beta*C[j*ldc + i];
1262 for (j=izero; j<
n; j++) {
1263 if (beta == beta_zero) {
1264 for (i=izero; i<m; i++) {
1265 C[j*ldc + i] = C_zero;
1267 }
else if ( beta != beta_one ) {
1268 for (i=izero; i<m; i++) {
1269 C[j*ldc + i] *= beta;
1272 for (p=izero; p<k; p++) {
1273 if (B[p*ldb + j] != B_zero) {
1275 for (i=izero; i<m; i++) {
1276 C[j*ldc + i] += temp*A[p*lda + i];
1283 for (j=izero; j<
n; j++) {
1284 if (beta == beta_zero) {
1285 for (i=izero; i<m; i++) {
1286 C[j*ldc + i] = C_zero;
1288 }
else if ( beta != beta_one ) {
1289 for (i=izero; i<m; i++) {
1290 C[j*ldc + i] *= beta;
1293 for (p=izero; p<k; p++) {
1294 if (B[p*ldb + j] != B_zero) {
1295 temp = alpha*B[p*ldb + j];
1296 for (i=izero; i<m; i++) {
1297 C[j*ldc + i] += temp*A[p*lda + i];
1303 }
else if ( conjA ) {
1306 for (j=izero; j<
n; j++) {
1307 for (i=izero; i<m; i++) {
1309 for (p=izero; p<k; p++) {
1313 if (beta == beta_zero) {
1314 C[j*ldc + i] = alpha*temp;
1316 C[j*ldc + i] = alpha*temp + beta*C[j*ldc + i];
1322 for (j=izero; j<
n; j++) {
1323 for (i=izero; i<m; i++) {
1325 for (p=izero; p<k; p++) {
1329 if (beta == beta_zero) {
1330 C[j*ldc + i] = alpha*temp;
1332 C[j*ldc + i] = alpha*temp + beta*C[j*ldc + i];
1340 for (j=izero; j<
n; j++) {
1341 for (i=izero; i<m; i++) {
1343 for (p=izero; p<k; p++) {
1344 temp += A[i*lda + p]
1347 if (beta == beta_zero) {
1348 C[j*ldc + i] = alpha*temp;
1350 C[j*ldc + i] = alpha*temp + beta*C[j*ldc + i];
1356 for (j=izero; j<
n; j++) {
1357 for (i=izero; i<m; i++) {
1359 for (p=izero; p<k; p++) {
1360 temp += A[i*lda + p]*B[p*ldb + j];
1362 if (beta == beta_zero) {
1363 C[j*ldc + i] = alpha*temp;
1365 C[j*ldc + i] = alpha*temp + beta*C[j*ldc + i];
1375 template<
typename OrdinalType,
typename ScalarType>
1376 template <
typename alpha_type,
typename A_type,
typename B_type,
typename beta_type>
1377 void DefaultBLASImpl<OrdinalType, ScalarType>::SYMM(
ESide side,
EUplo uplo,
const OrdinalType m,
const OrdinalType
n,
const alpha_type alpha,
const A_type*
A,
const OrdinalType lda,
const B_type*
B,
const OrdinalType ldb,
const beta_type beta, ScalarType*
C,
const OrdinalType ldc)
const
1385 OrdinalType i, j, k, NRowA = m;
1386 ScalarType temp1, temp2;
1387 bool BadArgument =
false;
1392 if ( (m==izero) || (n==izero) || ( (alpha==alpha_zero)&&(beta==beta_one) ) ) {
return; }
1394 std::cout <<
"BLAS::SYMM Error: M == "<< m << std::endl;
1395 BadArgument =
true; }
1397 std::cout <<
"BLAS::SYMM Error: N == "<< n << std::endl;
1398 BadArgument =
true; }
1400 std::cout <<
"BLAS::SYMM Error: LDA < "<<NRowA<<std::endl;
1401 BadArgument =
true; }
1403 std::cout <<
"BLAS::SYMM Error: LDB < MAX(1,M)"<<std::endl;
1404 BadArgument =
true; }
1406 std::cout <<
"BLAS::SYMM Error: LDC < MAX(1,M)"<<std::endl;
1407 BadArgument =
true; }
1412 if (alpha == alpha_zero) {
1413 if (beta == beta_zero ) {
1414 for (j=izero; j<
n; j++) {
1415 for (i=izero; i<m; i++) {
1416 C[j*ldc + i] = C_zero;
1420 for (j=izero; j<
n; j++) {
1421 for (i=izero; i<m; i++) {
1422 C[j*ldc + i] *= beta;
1434 for (j=izero; j<
n; j++) {
1435 for (i=izero; i<m; i++) {
1436 temp1 = alpha*B[j*ldb + i];
1438 for (k=izero; k<i; k++) {
1439 C[j*ldc + k] += temp1*A[i*lda + k];
1440 temp2 += B[j*ldb + k]*A[i*lda + k];
1442 if (beta == beta_zero) {
1443 C[j*ldc + i] = temp1*A[i*lda + i] + alpha*temp2;
1445 C[j*ldc + i] = beta*C[j*ldc + i] + temp1*A[i*lda + i] + alpha*temp2;
1451 for (j=izero; j<
n; j++) {
1452 for (i=m-ione; i>-ione; i--) {
1453 temp1 = alpha*B[j*ldb + i];
1455 for (k=i+ione; k<m; k++) {
1456 C[j*ldc + k] += temp1*A[i*lda + k];
1457 temp2 += B[j*ldb + k]*A[i*lda + k];
1459 if (beta == beta_zero) {
1460 C[j*ldc + i] = temp1*A[i*lda + i] + alpha*temp2;
1462 C[j*ldc + i] = beta*C[j*ldc + i] + temp1*A[i*lda + i] + alpha*temp2;
1469 for (j=izero; j<
n; j++) {
1470 temp1 = alpha*A[j*lda + j];
1471 if (beta == beta_zero) {
1472 for (i=izero; i<m; i++) {
1473 C[j*ldc + i] = temp1*B[j*ldb + i];
1476 for (i=izero; i<m; i++) {
1477 C[j*ldc + i] = beta*C[j*ldc + i] + temp1*B[j*ldb + i];
1480 for (k=izero; k<j; k++) {
1482 temp1 = alpha*A[j*lda + k];
1484 temp1 = alpha*A[k*lda + j];
1486 for (i=izero; i<m; i++) {
1487 C[j*ldc + i] += temp1*B[k*ldb + i];
1490 for (k=j+ione; k<
n; k++) {
1492 temp1 = alpha*A[k*lda + j];
1494 temp1 = alpha*A[j*lda + k];
1496 for (i=izero; i<m; i++) {
1497 C[j*ldc + i] += temp1*B[k*ldb + i];
1505 template<
typename OrdinalType,
typename ScalarType>
1506 template <
typename alpha_type,
typename A_type,
typename beta_type>
1507 void DefaultBLASImpl<OrdinalType, ScalarType>::SYRK(
EUplo uplo,
ETransp trans,
const OrdinalType
n,
const OrdinalType k,
const alpha_type alpha,
const A_type*
A,
const OrdinalType lda,
const beta_type beta, ScalarType*
C,
const OrdinalType ldc)
const
1518 OrdinalType i, j, l, NRowA =
n;
1519 bool BadArgument =
false;
1526 "Teuchos::BLAS<"<<OTNT::name()<<
","<<STNT::name()<<
">::SYRK()"
1527 " does not support CONJ_TRANS for complex data types."
1536 if ( n==izero ) {
return; }
1537 if ( ( (alpha==alpha_zero) || (k==izero) ) && (beta==beta_one) ) {
return; }
1539 std::cout <<
"BLAS::SYRK Error: N == "<< n <<std::endl;
1540 BadArgument =
true; }
1542 std::cout <<
"BLAS::SYRK Error: K == "<< k <<std::endl;
1543 BadArgument =
true; }
1545 std::cout <<
"BLAS::SYRK Error: LDA < "<<NRowA<<std::endl;
1546 BadArgument =
true; }
1548 std::cout <<
"BLAS::SYRK Error: LDC < MAX(1,N)"<<std::endl;
1549 BadArgument =
true; }
1554 if (alpha == alpha_zero) {
1556 if (beta==beta_zero) {
1557 for (j=izero; j<
n; j++) {
1558 for (i=izero; i<=j; i++) {
1559 C[j*ldc + i] = C_zero;
1564 for (j=izero; j<
n; j++) {
1565 for (i=izero; i<=j; i++) {
1566 C[j*ldc + i] *= beta;
1572 if (beta==beta_zero) {
1573 for (j=izero; j<
n; j++) {
1574 for (i=j; i<
n; i++) {
1575 C[j*ldc + i] = C_zero;
1580 for (j=izero; j<
n; j++) {
1581 for (i=j; i<
n; i++) {
1582 C[j*ldc + i] *= beta;
1596 for (j=izero; j<
n; j++) {
1597 if (beta==beta_zero) {
1598 for (i=izero; i<=j; i++) {
1599 C[j*ldc + i] = C_zero;
1602 else if (beta!=beta_one) {
1603 for (i=izero; i<=j; i++) {
1604 C[j*ldc + i] *= beta;
1607 for (l=izero; l<k; l++) {
1608 if (A[l*lda + j] != A_zero) {
1609 temp = alpha*A[l*lda + j];
1610 for (i = izero; i <=j; i++) {
1611 C[j*ldc + i] += temp*A[l*lda + i];
1618 for (j=izero; j<
n; j++) {
1619 if (beta==beta_zero) {
1620 for (i=j; i<
n; i++) {
1621 C[j*ldc + i] = C_zero;
1624 else if (beta!=beta_one) {
1625 for (i=j; i<
n; i++) {
1626 C[j*ldc + i] *= beta;
1629 for (l=izero; l<k; l++) {
1630 if (A[l*lda + j] != A_zero) {
1631 temp = alpha*A[l*lda + j];
1632 for (i=j; i<
n; i++) {
1633 C[j*ldc + i] += temp*A[l*lda + i];
1644 for (j=izero; j<
n; j++) {
1645 for (i=izero; i<=j; i++) {
1647 for (l=izero; l<k; l++) {
1648 temp += A[i*lda + l]*A[j*lda + l];
1650 if (beta==beta_zero) {
1651 C[j*ldc + i] = alpha*temp;
1654 C[j*ldc + i] = alpha*temp + beta*C[j*ldc + i];
1660 for (j=izero; j<
n; j++) {
1661 for (i=j; i<
n; i++) {
1663 for (l=izero; l<k; ++l) {
1664 temp += A[i*lda + l]*A[j*lda + l];
1666 if (beta==beta_zero) {
1667 C[j*ldc + i] = alpha*temp;
1670 C[j*ldc + i] = alpha*temp + beta*C[j*ldc + i];
1679 template<
typename OrdinalType,
typename ScalarType>
1680 template <
typename alpha_type,
typename A_type>
1681 void DefaultBLASImpl<OrdinalType, ScalarType>::TRMM(
ESide side,
EUplo uplo,
ETransp transa,
EDiag diag,
const OrdinalType m,
const OrdinalType
n,
const alpha_type alpha,
const A_type*
A,
const OrdinalType lda, ScalarType*
B,
const OrdinalType ldb)
const
1689 OrdinalType i, j, k, NRowA = m;
1691 bool BadArgument =
false;
1697 if(!LSide) { NRowA =
n; }
1700 if (n==izero || m==izero) {
return; }
1702 std::cout <<
"BLAS::TRMM Error: M == "<< m <<std::endl;
1703 BadArgument =
true; }
1705 std::cout <<
"BLAS::TRMM Error: N == "<< n <<std::endl;
1706 BadArgument =
true; }
1708 std::cout <<
"BLAS::TRMM Error: LDA < "<<NRowA<<std::endl;
1709 BadArgument =
true; }
1711 std::cout <<
"BLAS::TRMM Error: LDB < MAX(1,M)"<<std::endl;
1712 BadArgument =
true; }
1717 if( alpha == alpha_zero ) {
1718 for( j=izero; j<
n; j++ ) {
1719 for( i=izero; i<m; i++ ) {
1720 B[j*ldb + i] = B_zero;
1735 for( j=izero; j<
n; j++ ) {
1736 for( k=izero; k<m; k++) {
1737 if ( B[j*ldb + k] != B_zero ) {
1738 temp = alpha*B[j*ldb + k];
1739 for( i=izero; i<k; i++ ) {
1740 B[j*ldb + i] += temp*A[k*lda + i];
1743 temp *=A[k*lda + k];
1744 B[j*ldb + k] = temp;
1750 for( j=izero; j<
n; j++ ) {
1751 for( k=m-ione; k>-ione; k-- ) {
1752 if( B[j*ldb + k] != B_zero ) {
1753 temp = alpha*B[j*ldb + k];
1754 B[j*ldb + k] = temp;
1756 B[j*ldb + k] *= A[k*lda + k];
1757 for( i=k+ione; i<m; i++ ) {
1758 B[j*ldb + i] += temp*A[k*lda + i];
1767 for( j=izero; j<
n; j++ ) {
1768 for( i=m-ione; i>-ione; i-- ) {
1769 temp = B[j*ldb + i];
1772 temp *= A[i*lda + i];
1773 for( k=izero; k<i; k++ ) {
1774 temp += A[i*lda + k]*B[j*ldb + k];
1779 for( k=izero; k<i; k++ ) {
1783 B[j*ldb + i] = alpha*temp;
1787 for( j=izero; j<
n; j++ ) {
1788 for( i=izero; i<m; i++ ) {
1789 temp = B[j*ldb + i];
1792 temp *= A[i*lda + i];
1793 for( k=i+ione; k<m; k++ ) {
1794 temp += A[i*lda + k]*B[j*ldb + k];
1799 for( k=i+ione; k<m; k++ ) {
1803 B[j*ldb + i] = alpha*temp;
1816 for( j=n-ione; j>-ione; j-- ) {
1819 temp *= A[j*lda + j];
1820 for( i=izero; i<m; i++ ) {
1821 B[j*ldb + i] *= temp;
1823 for( k=izero; k<j; k++ ) {
1824 if( A[j*lda + k] != A_zero ) {
1825 temp = alpha*A[j*lda + k];
1826 for( i=izero; i<m; i++ ) {
1827 B[j*ldb + i] += temp*B[k*ldb + i];
1834 for( j=izero; j<
n; j++ ) {
1837 temp *= A[j*lda + j];
1838 for( i=izero; i<m; i++ ) {
1839 B[j*ldb + i] *= temp;
1841 for( k=j+ione; k<
n; k++ ) {
1842 if( A[j*lda + k] != A_zero ) {
1843 temp = alpha*A[j*lda + k];
1844 for( i=izero; i<m; i++ ) {
1845 B[j*ldb + i] += temp*B[k*ldb + i];
1855 for( k=izero; k<
n; k++ ) {
1856 for( j=izero; j<k; j++ ) {
1857 if( A[k*lda + j] != A_zero ) {
1859 temp = alpha*A[k*lda + j];
1862 for( i=izero; i<m; i++ ) {
1863 B[j*ldb + i] += temp*B[k*ldb + i];
1870 temp *= A[k*lda + k];
1875 for( i=izero; i<m; i++ ) {
1876 B[k*ldb + i] *= temp;
1881 for( k=n-ione; k>-ione; k-- ) {
1882 for( j=k+ione; j<
n; j++ ) {
1883 if( A[k*lda + j] != A_zero ) {
1885 temp = alpha*A[k*lda + j];
1888 for( i=izero; i<m; i++ ) {
1889 B[j*ldb + i] += temp*B[k*ldb + i];
1896 temp *= A[k*lda + k];
1901 for( i=izero; i<m; i++ ) {
1902 B[k*ldb + i] *= temp;
1912 template<
typename OrdinalType,
typename ScalarType>
1913 template <
typename alpha_type,
typename A_type>
1914 void DefaultBLASImpl<OrdinalType, ScalarType>::TRSM(
ESide side,
EUplo uplo,
ETransp transa,
EDiag diag,
const OrdinalType m,
const OrdinalType
n,
const alpha_type alpha,
const A_type*
A,
const OrdinalType lda, ScalarType*
B,
const OrdinalType ldb)
const
1924 OrdinalType NRowA = m;
1925 bool BadArgument =
false;
1929 if (!(
ESideChar[side] ==
'L')) { NRowA =
n; }
1932 if (n == izero || m == izero) {
return; }
1934 std::cout <<
"BLAS::TRSM Error: M == "<<m<<std::endl;
1935 BadArgument =
true; }
1937 std::cout <<
"BLAS::TRSM Error: N == "<<n<<std::endl;
1938 BadArgument =
true; }
1940 std::cout <<
"BLAS::TRSM Error: LDA < "<<NRowA<<std::endl;
1941 BadArgument =
true; }
1943 std::cout <<
"BLAS::TRSM Error: LDB < MAX(1,M)"<<std::endl;
1944 BadArgument =
true; }
1950 if(alpha == alpha_zero) {
1951 for(j = izero; j <
n; j++) {
1952 for( i = izero; i < m; i++) {
1953 B[j*ldb+i] = B_zero;
1969 for(j = izero; j <
n; j++) {
1971 if(alpha != alpha_one) {
1972 for( i = izero; i < m; i++) {
1973 B[j*ldb+i] *= alpha;
1977 for(k = (m - ione); k > -ione; k--) {
1979 if (B[j*ldb + k] != B_zero) {
1981 B[j*ldb + k] /= A[k*lda + k];
1983 for(i = izero; i < k; i++) {
1984 B[j*ldb + i] -= B[j*ldb + k] * A[k*lda + i];
1992 for(j = izero; j <
n; j++) {
1994 if(alpha != alpha_one) {
1995 for( i = izero; i < m; i++) {
1996 B[j*ldb+i] *= alpha;
2000 for(k = izero; k < m; k++) {
2002 if (B[j*ldb + k] != B_zero) {
2004 B[j*ldb + k] /= A[k*lda + k];
2006 for(i = k+ione; i < m; i++) {
2007 B[j*ldb + i] -= B[j*ldb + k] * A[k*lda + i];
2021 for(j = izero; j <
n; j++) {
2022 for( i = izero; i < m; i++) {
2023 temp = alpha*B[j*ldb+i];
2025 for(k = izero; k < i; k++) {
2026 temp -= A[i*lda + k] * B[j*ldb + k];
2029 temp /= A[i*lda + i];
2032 for(k = izero; k < i; k++) {
2040 B[j*ldb + i] = temp;
2046 for(j = izero; j <
n; j++) {
2047 for(i = (m - ione) ; i > -ione; i--) {
2048 temp = alpha*B[j*ldb+i];
2050 for(k = i+ione; k < m; k++) {
2051 temp -= A[i*lda + k] * B[j*ldb + k];
2054 temp /= A[i*lda + i];
2057 for(k = i+ione; k < m; k++) {
2065 B[j*ldb + i] = temp;
2083 for(j = izero; j <
n; j++) {
2085 if(alpha != alpha_one) {
2086 for( i = izero; i < m; i++) {
2087 B[j*ldb+i] *= alpha;
2090 for(k = izero; k < j; k++) {
2092 if (A[j*lda + k] != A_zero) {
2093 for(i = izero; i < m; i++) {
2094 B[j*ldb + i] -= A[j*lda + k] * B[k*ldb + i];
2099 temp = B_one/A[j*lda + j];
2100 for(i = izero; i < m; i++) {
2101 B[j*ldb + i] *= temp;
2108 for(j = (n - ione); j > -ione; j--) {
2110 if(alpha != alpha_one) {
2111 for( i = izero; i < m; i++) {
2112 B[j*ldb+i] *= alpha;
2116 for(k = j+ione; k <
n; k++) {
2118 if (A[j*lda + k] != A_zero) {
2119 for(i = izero; i < m; i++) {
2120 B[j*ldb + i] -= A[j*lda + k] * B[k*ldb + i];
2125 temp = B_one/A[j*lda + j];
2126 for(i = izero; i < m; i++) {
2127 B[j*ldb + i] *= temp;
2140 for(k = (n - ione); k > -ione; k--) {
2143 temp = B_one/A[k*lda + k];
2146 for(i = izero; i < m; i++) {
2147 B[k*ldb + i] *= temp;
2150 for(j = izero; j < k; j++) {
2151 if (A[k*lda + j] != A_zero) {
2153 temp = A[k*lda + j];
2156 for(i = izero; i < m; i++) {
2157 B[j*ldb + i] -= temp*B[k*ldb + i];
2161 if (alpha != alpha_one) {
2162 for (i = izero; i < m; i++) {
2163 B[k*ldb + i] *= alpha;
2170 for(k = izero; k <
n; k++) {
2173 temp = B_one/A[k*lda + k];
2176 for (i = izero; i < m; i++) {
2177 B[k*ldb + i] *= temp;
2180 for(j = k+ione; j <
n; j++) {
2181 if(A[k*lda + j] != A_zero) {
2183 temp = A[k*lda + j];
2186 for(i = izero; i < m; i++) {
2187 B[j*ldb + i] -= temp*B[k*ldb + i];
2191 if (alpha != alpha_one) {
2192 for (i = izero; i < m; i++) {
2193 B[k*ldb + i] *= alpha;
2213 void ROTG(
float* da,
float* db,
float* c,
float* s)
const;
2214 void ROT(
const int n,
float* dx,
const int incx,
float* dy,
const int incy,
float* c,
float* s)
const;
2215 float ASUM(
const int n,
const float* x,
const int incx)
const;
2216 void AXPY(
const int n,
const float alpha,
const float* x,
const int incx,
float* y,
const int incy)
const;
2217 void COPY(
const int n,
const float* x,
const int incx,
float* y,
const int incy)
const;
2218 float DOT(
const int n,
const float* x,
const int incx,
const float* y,
const int incy)
const;
2219 float NRM2(
const int n,
const float* x,
const int incx)
const;
2220 void SCAL(
const int n,
const float alpha,
float* x,
const int incx)
const;
2221 int IAMAX(
const int n,
const float* x,
const int incx)
const;
2222 void GEMV(
ETransp trans,
const int m,
const int n,
const float alpha,
const float*
A,
const int lda,
const float* x,
const int incx,
const float beta,
float* y,
const int incy)
const;
2223 void TRMV(
EUplo uplo,
ETransp trans,
EDiag diag,
const int n,
const float*
A,
const int lda,
float* x,
const int incx)
const;
2224 void GER(
const int m,
const int n,
const float alpha,
const float* x,
const int incx,
const float* y,
const int incy,
float*
A,
const int lda)
const;
2225 void GEMM(
ETransp transa,
ETransp transb,
const int m,
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)
const;
2226 void SYMM(
ESide side,
EUplo uplo,
const int m,
const int n,
const float alpha,
const float*
A,
const int lda,
const float *
B,
const int ldb,
const float beta,
float *
C,
const int ldc)
const;
2227 void SYRK(
EUplo uplo,
ETransp trans,
const int n,
const int k,
const float alpha,
const float*
A,
const int lda,
const float beta,
float*
C,
const int ldc)
const;
2228 void TRMM(
ESide side,
EUplo uplo,
ETransp transa,
EDiag diag,
const int m,
const int n,
const float alpha,
const float*
A,
const int lda,
float*
B,
const int ldb)
const;
2229 void TRSM(
ESide side,
EUplo uplo,
ETransp transa,
EDiag diag,
const int m,
const int n,
const float alpha,
const float*
A,
const int lda,
float*
B,
const int ldb)
const;
2241 void ROTG(
double* da,
double* db,
double* c,
double* s)
const;
2242 void ROT(
const int n,
double* dx,
const int incx,
double* dy,
const int incy,
double* c,
double* s)
const;
2243 double ASUM(
const int n,
const double* x,
const int incx)
const;
2244 void AXPY(
const int n,
const double alpha,
const double* x,
const int incx,
double* y,
const int incy)
const;
2245 void COPY(
const int n,
const double* x,
const int incx,
double* y,
const int incy)
const;
2246 double DOT(
const int n,
const double* x,
const int incx,
const double* y,
const int incy)
const;
2247 double NRM2(
const int n,
const double* x,
const int incx)
const;
2248 void SCAL(
const int n,
const double alpha,
double* x,
const int incx)
const;
2249 int IAMAX(
const int n,
const double* x,
const int incx)
const;
2250 void GEMV(
ETransp trans,
const int m,
const int n,
const double alpha,
const double*
A,
const int lda,
const double* x,
const int incx,
const double beta,
double* y,
const int incy)
const;
2251 void TRMV(
EUplo uplo,
ETransp trans,
EDiag diag,
const int n,
const double*
A,
const int lda,
double* x,
const int incx)
const;
2252 void GER(
const int m,
const int n,
const double alpha,
const double* x,
const int incx,
const double* y,
const int incy,
double*
A,
const int lda)
const;
2253 void GEMM(
ETransp transa,
ETransp transb,
const int m,
const int n,
const int k,
const double alpha,
const double*
A,
const int lda,
const double*
B,
const int ldb,
const double beta,
double*
C,
const int ldc)
const;
2254 void SYMM(
ESide side,
EUplo uplo,
const int m,
const int n,
const double alpha,
const double*
A,
const int lda,
const double *
B,
const int ldb,
const double beta,
double *
C,
const int ldc)
const;
2255 void SYRK(
EUplo uplo,
ETransp trans,
const int n,
const int k,
const double alpha,
const double*
A,
const int lda,
const double beta,
double*
C,
const int ldc)
const;
2256 void TRMM(
ESide side,
EUplo uplo,
ETransp transa,
EDiag diag,
const int m,
const int n,
const double alpha,
const double*
A,
const int lda,
double*
B,
const int ldb)
const;
2257 void TRSM(
ESide side,
EUplo uplo,
ETransp transa,
EDiag diag,
const int m,
const int n,
const double alpha,
const double*
A,
const int lda,
double*
B,
const int ldb)
const;
2267 inline BLAS(
const BLAS<
int, std::complex<float> >& ) {}
2269 void ROTG(std::complex<float>* da, std::complex<float>* db,
float* c, std::complex<float>* s)
const;
2270 void ROT(
const int n, std::complex<float>* dx,
const int incx, std::complex<float>* dy,
const int incy,
float* c, std::complex<float>* s)
const;
2271 float ASUM(
const int n,
const std::complex<float>* x,
const int incx)
const;
2272 void AXPY(
const int n,
const std::complex<float> alpha,
const std::complex<float>* x,
const int incx, std::complex<float>* y,
const int incy)
const;
2273 void COPY(
const int n,
const std::complex<float>* x,
const int incx, std::complex<float>* y,
const int incy)
const;
2274 std::complex<float> DOT(
const int n,
const std::complex<float>* x,
const int incx,
const std::complex<float>* y,
const int incy)
const;
2275 float NRM2(
const int n,
const std::complex<float>* x,
const int incx)
const;
2276 void SCAL(
const int n,
const std::complex<float> alpha, std::complex<float>* x,
const int incx)
const;
2277 int IAMAX(
const int n,
const std::complex<float>* x,
const int incx)
const;
2278 void GEMV(
ETransp trans,
const int m,
const int n,
const std::complex<float> alpha,
const std::complex<float>*
A,
const int lda,
const std::complex<float>* x,
const int incx,
const std::complex<float> beta, std::complex<float>* y,
const int incy)
const;
2279 void TRMV(
EUplo uplo,
ETransp trans,
EDiag diag,
const int n,
const std::complex<float>*
A,
const int lda, std::complex<float>* x,
const int incx)
const;
2280 void GER(
const int m,
const int n,
const std::complex<float> alpha,
const std::complex<float>* x,
const int incx,
const std::complex<float>* y,
const int incy, std::complex<float>*
A,
const int lda)
const;
2281 void GEMM(
ETransp transa,
ETransp transb,
const int m,
const int n,
const int k,
const std::complex<float> alpha,
const std::complex<float>*
A,
const int lda,
const std::complex<float>*
B,
const int ldb,
const std::complex<float> beta, std::complex<float>*
C,
const int ldc)
const;
2282 void SYMM(
ESide side,
EUplo uplo,
const int m,
const int n,
const std::complex<float> alpha,
const std::complex<float>*
A,
const int lda,
const std::complex<float> *
B,
const int ldb,
const std::complex<float> beta, std::complex<float> *
C,
const int ldc)
const;
2283 void SYRK(
EUplo uplo,
ETransp trans,
const int n,
const int k,
const std::complex<float> alpha,
const std::complex<float>*
A,
const int lda,
const std::complex<float> beta, std::complex<float>*
C,
const int ldc)
const;
2284 void TRMM(
ESide side,
EUplo uplo,
ETransp transa,
EDiag diag,
const int m,
const int n,
const std::complex<float> alpha,
const std::complex<float>*
A,
const int lda, std::complex<float>*
B,
const int ldb)
const;
2285 void TRSM(
ESide side,
EUplo uplo,
ETransp transa,
EDiag diag,
const int m,
const int n,
const std::complex<float> alpha,
const std::complex<float>*
A,
const int lda, std::complex<float>*
B,
const int ldb)
const;
2295 inline BLAS(
const BLAS<
int, std::complex<double> >& ) {}
2297 void ROTG(std::complex<double>* da, std::complex<double>* db,
double* c, std::complex<double>* s)
const;
2298 void ROT(
const int n, std::complex<double>* dx,
const int incx, std::complex<double>* dy,
const int incy,
double* c, std::complex<double>* s)
const;
2299 double ASUM(
const int n,
const std::complex<double>* x,
const int incx)
const;
2300 void AXPY(
const int n,
const std::complex<double> alpha,
const std::complex<double>* x,
const int incx, std::complex<double>* y,
const int incy)
const;
2301 void COPY(
const int n,
const std::complex<double>* x,
const int incx, std::complex<double>* y,
const int incy)
const;
2302 std::complex<double> DOT(
const int n,
const std::complex<double>* x,
const int incx,
const std::complex<double>* y,
const int incy)
const;
2303 double NRM2(
const int n,
const std::complex<double>* x,
const int incx)
const;
2304 void SCAL(
const int n,
const std::complex<double> alpha, std::complex<double>* x,
const int incx)
const;
2305 int IAMAX(
const int n,
const std::complex<double>* x,
const int incx)
const;
2306 void GEMV(
ETransp trans,
const int m,
const int n,
const std::complex<double> alpha,
const std::complex<double>*
A,
const int lda,
const std::complex<double>* x,
const int incx,
const std::complex<double> beta, std::complex<double>* y,
const int incy)
const;
2307 void TRMV(
EUplo uplo,
ETransp trans,
EDiag diag,
const int n,
const std::complex<double>*
A,
const int lda, std::complex<double>* x,
const int incx)
const;
2308 void GER(
const int m,
const int n,
const std::complex<double> alpha,
const std::complex<double>* x,
const int incx,
const std::complex<double>* y,
const int incy, std::complex<double>*
A,
const int lda)
const;
2309 void GEMM(
ETransp transa,
ETransp transb,
const int m,
const int n,
const int k,
const std::complex<double> alpha,
const std::complex<double>*
A,
const int lda,
const std::complex<double>*
B,
const int ldb,
const std::complex<double> beta, std::complex<double>*
C,
const int ldc)
const;
2310 void SYMM(
ESide side,
EUplo uplo,
const int m,
const int n,
const std::complex<double> alpha,
const std::complex<double>*
A,
const int lda,
const std::complex<double> *
B,
const int ldb,
const std::complex<double> beta, std::complex<double> *
C,
const int ldc)
const;
2311 void SYRK(
EUplo uplo,
ETransp trans,
const int n,
const int k,
const std::complex<double> alpha,
const std::complex<double>*
A,
const int lda,
const std::complex<double> beta, std::complex<double>*
C,
const int ldc)
const;
2312 void TRMM(
ESide side,
EUplo uplo,
ETransp transa,
EDiag diag,
const int m,
const int n,
const std::complex<double> alpha,
const std::complex<double>*
A,
const int lda, std::complex<double>*
B,
const int ldb)
const;
2313 void TRSM(
ESide side,
EUplo uplo,
ETransp transa,
EDiag diag,
const int m,
const int n,
const std::complex<double> alpha,
const std::complex<double>*
A,
const int lda, std::complex<double>*
B,
const int ldb)
const;
2318 #endif // _TEUCHOS_BLAS_HPP_
OrdinalType IAMAX(const OrdinalType n, const ScalarType *x, const OrdinalType incx) const
Return the index of the element of x with the maximum magnitude.
static T one()
Returns representation of one for this ordinal type.
BLAS(const BLAS< OrdinalType, ScalarType > &)
Copy constructor.
void ROTG(ScalarType *a, ScalarType *b, typename ScalarTraits< ScalarType >::magnitudeType *c, ScalarType *s) const
Enumerated types for BLAS input characters.
virtual ~DefaultBLASImpl(void)
Destructor.
T magnitudeType
Mandatory typedef for result of magnitude.
virtual ~BLAS(void)
Destructor.
static T zero()
Returns representation of zero for this ordinal type.
Teuchos::ScalarTraits< ScalarType >::magnitudeType MagnitudeType
void COPY(const OrdinalType n, const ScalarType *x, const OrdinalType incx, ScalarType *y, const OrdinalType incy) const
Copy the vector x to the vector y.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
BLAS(void)
Default constructor.
DefaultBLASImpl(void)
Default constructor.
Teuchos header file which uses auto-configuration information to include necessary C++ headers...
TEUCHOSNUMERICS_LIB_DLL_EXPORT const char EDiagChar[]
This structure defines some basic traits for a scalar field type.
#define TEUCHOSNUMERICS_LIB_DLL_EXPORT
void SYMM(ESide side, EUplo uplo, const OrdinalType m, const OrdinalType n, const alpha_type alpha, const A_type *A, const OrdinalType lda, const B_type *B, const OrdinalType ldb, const beta_type beta, ScalarType *C, const OrdinalType ldc) const
Performs the matrix-matrix operation: C <- alpha*A*B+beta*C or C <- alpha*B*A+beta*C where A is an m ...
void SCAL(const OrdinalType n, const ScalarType alpha, ScalarType *x, const OrdinalType incx) const
Scale the vector x by the constant alpha.
DefaultBLASImpl(const DefaultBLASImpl< OrdinalType, ScalarType > &)
Copy constructor.
static T conjugate(T a)
Returns the conjugate of the scalar type a.
void ROTG(ScalarType *da, ScalarType *db, MagnitudeType *c, ScalarType *s) const
Computes a Givens plane rotation.
BLAS(const BLAS< int, std::complex< double > > &)
void GEMV(ETransp trans, const OrdinalType m, const OrdinalType n, const alpha_type alpha, const A_type *A, const OrdinalType lda, const x_type *x, const OrdinalType incx, const beta_type beta, ScalarType *y, const OrdinalType incy) const
Performs the matrix-vector operation: y <- alpha*A*x+beta*y or y <- alpha*A'*x+beta*y where A is a gene...
void SYRK(EUplo uplo, ETransp trans, const OrdinalType n, const OrdinalType k, const alpha_type alpha, const A_type *A, const OrdinalType lda, const beta_type beta, ScalarType *C, const OrdinalType ldc) const
Performs the symmetric rank k operation: C <- alpha*A*A'+beta*C or C <- alpha*A'*A+beta*C, where alpha and beta are scalars, C is an n by n symmetric matrix and A is an n by k matrix in the first case or k by n matrix in the second case.
TEUCHOSNUMERICS_LIB_DLL_EXPORT const char EUploChar[]
void GEMM(ETransp transa, ETransp transb, const OrdinalType m, const OrdinalType n, const OrdinalType k, const alpha_type alpha, const A_type *A, const OrdinalType lda, const B_type *B, const OrdinalType ldb, const beta_type beta, ScalarType *C, const OrdinalType ldc) const
General matrix-matrix multiply.
TEUCHOSNUMERICS_LIB_DLL_EXPORT const char ETypeChar[]
void blas_dabs1(const ScalarType *a, typename ScalarTraits< ScalarType >::magnitudeType *ret) const
void TRMM(ESide side, EUplo uplo, ETransp transa, EDiag diag, const OrdinalType m, const OrdinalType n, const alpha_type alpha, const A_type *A, const OrdinalType lda, ScalarType *B, const OrdinalType ldb) const
Performs the matrix-matrix operation: B <- alpha*op(A)*B or B <- alpha*B*op(A) where op(A) is an unit...
TEUCHOSNUMERICS_LIB_DLL_EXPORT const char ESideChar[]
void AXPY(const OrdinalType n, const alpha_type alpha, const x_type *x, const OrdinalType incx, ScalarType *y, const OrdinalType incy) const
Perform the operation: y <- y+alpha*x.
void ROT(const OrdinalType n, ScalarType *dx, const OrdinalType incx, ScalarType *dy, const OrdinalType incy, MagnitudeType *c, ScalarType *s) const
Applies a Givens plane rotation.
ScalarType SIGN(ScalarType x, ScalarType y) const
BLAS(const BLAS< int, std::complex< float > > &)
static magnitudeType magnitude(T a)
Returns the magnitudeType of the scalar type a.
Defines basic traits for the ordinal field type.
Default traits class that just returns typeid(T).name().
Default implementation for BLAS routines.
Teuchos::ScalarTraits< ScalarType >::magnitudeType MagnitudeType
void TRMV(EUplo uplo, ETransp trans, EDiag diag, const OrdinalType n, const A_type *A, const OrdinalType lda, ScalarType *x, const OrdinalType incx) const
Performs the matrix-vector operation: x <- A*x or x <- A'*x where A is a unit/non-unit n by n upper/low...
void GER(const OrdinalType m, const OrdinalType n, const alpha_type alpha, const x_type *x, const OrdinalType incx, const y_type *y, const OrdinalType incy, ScalarType *A, const OrdinalType lda) const
Performs the rank 1 operation: A <- alpha*x*y'+A.
Defines basic traits for the scalar field type.
ScalarTraits< ScalarType >::magnitudeType ASUM(const OrdinalType n, const ScalarType *x, const OrdinalType incx) const
Sum the absolute values of the entries of x.
static T zero()
Returns representation of zero for this scalar type.
TEUCHOSNUMERICS_LIB_DLL_EXPORT const char ETranspChar[]
void TRSM(ESide side, EUplo uplo, ETransp transa, EDiag diag, const OrdinalType m, const OrdinalType n, const alpha_type alpha, const A_type *A, const OrdinalType lda, ScalarType *B, const OrdinalType ldb) const
Solves the matrix equations: op(A)*X=alpha*B or X*op(A)=alpha*B where X and B are m by n matrices...
ScalarType DOT(const OrdinalType n, const x_type *x, const OrdinalType incx, const y_type *y, const OrdinalType incy) const
Form the dot product of the vectors x and y.
static T one()
Returns representation of one for this scalar type.
BLAS(const BLAS< int, double > &)
BLAS(const BLAS< int, float > &)
ScalarTraits< ScalarType >::magnitudeType NRM2(const OrdinalType n, const ScalarType *x, const OrdinalType incx) const
Compute the 2-norm of the vector x.