| 1 |
|
| #include "blas.h" |
| 2 |
|
| |
| 3 |
|
| #ifdef __cplusplus |
| 4 |
|
| extern "C" { |
| 5 |
|
| #endif |
| 6 |
|
| |
| 7 |
507 |
| int daxpy_(int *n, double *sa, double *sx, int *incx, double *sy, |
| 8 |
|
| int *incy) |
| 9 |
|
| { |
| 10 |
|
| long int i, m, ix, iy, nn, iincx, iincy; |
| 11 |
|
| register double ssa; |
| 12 |
|
| |
| 13 |
|
| /* constant times a vector plus a vector. |
| 14 |
|
| uses unrolled loop for increments equal to one. |
| 15 |
|
| jack dongarra, linpack, 3/11/78. |
| 16 |
|
| modified 12/3/93, array(1) declarations changed to array(*) */ |
| 17 |
|
| |
| 18 |
|
| /* Dereference inputs */ |
| 19 |
507 |
| nn = *n; |
| 20 |
507 |
| ssa = *sa; |
| 21 |
507 |
| iincx = *incx; |
| 22 |
507 |
| iincy = *incy; |
| 23 |
|
| |
| 24 |
507 |
▶ | if( nn > 0 && ssa != 0.0 ) |
Branch: 2 branches
| Branch | True | False | Total |
| if( nn > 0 && ssa != 0.0 ) |
507 |
0 |
507 |
| if( nn > 0 && ssa != 0.0 ) |
507 |
0 |
507 |
|
| 25 |
|
| { |
| 26 |
507 |
▶ | if (iincx == 1 && iincy == 1) /* code for both increments equal to 1 */ |
Branch: 2 branches
| Branch | True | False | Total |
| if (iincx == 1 && iincy == 1) /* code for both increments equal to 1 */ |
507 |
0 |
507 |
| if (iincx == 1 && iincy == 1) /* code for both increments equal to 1 */ |
507 |
0 |
507 |
|
| 27 |
|
| { |
| 28 |
507 |
| m = nn-3; |
| 29 |
2028 |
▶ | for (i = 0; i < m; i += 4) |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < m; i += 4) |
1521 |
507 |
2028 |
|
| 30 |
|
| { |
| 31 |
1521 |
| sy[i] += ssa * sx[i]; |
| 32 |
1521 |
| sy[i+1] += ssa * sx[i+1]; |
| 33 |
1521 |
| sy[i+2] += ssa * sx[i+2]; |
| 34 |
1521 |
| sy[i+3] += ssa * sx[i+3]; |
| 35 |
|
| } |
| 36 |
1014 |
▶ | for ( ; i < nn; ++i) /* clean-up loop */ |
Branch: 1 branch
| Branch | True | False | Total |
| for ( ; i < nn; ++i) /* clean-up loop */ |
507 |
507 |
1014 |
|
| 37 |
507 |
| sy[i] += ssa * sx[i]; |
| 38 |
|
| } |
| 39 |
|
| else /* code for unequal increments or equal increments not equal to 1 */ |
| 40 |
|
| { |
| 41 |
0 |
▶ | ix = iincx >= 0 ? 0 : (1 - nn) * iincx; |
Branch: 1 branch
| Branch | True | False | Total |
| ix = iincx >= 0 ? 0 : (1 - nn) * iincx; |
0 |
0 |
0 |
|
| 42 |
0 |
▶ | iy = iincy >= 0 ? 0 : (1 - nn) * iincy; |
Branch: 1 branch
| Branch | True | False | Total |
| iy = iincy >= 0 ? 0 : (1 - nn) * iincy; |
0 |
0 |
0 |
|
| 43 |
0 |
▶ | for (i = 0; i < nn; i++) |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < nn; i++) |
0 |
0 |
0 |
|
| 44 |
|
| { |
| 45 |
0 |
| sy[iy] += ssa * sx[ix]; |
| 46 |
0 |
| ix += iincx; |
| 47 |
0 |
| iy += iincy; |
| 48 |
|
| } |
| 49 |
|
| } |
| 50 |
|
| } |
| 51 |
|
| |
| 52 |
507 |
| return 0; |
| 53 |
|
| } /* daxpy_ */ |
| 54 |
|
| |
| 55 |
|
| #ifdef __cplusplus |
| 56 |
|
| } |
| 57 |
|
| #endif |