| 1 |
|
| #include "blas.h" |
| 2 |
|
| |
| 3 |
|
| #ifdef __cplusplus |
| 4 |
|
| extern "C" { |
| 5 |
|
| #endif |
| 6 |
|
| |
| 7 |
127 |
| int dscal_(int *n, double *sa, double *sx, int *incx) |
| 8 |
|
| { |
| 9 |
|
| long int i, m, nincx, nn, iincx; |
| 10 |
|
| double ssa; |
| 11 |
|
| |
| 12 |
|
| /* scales a vector by a constant. |
| 13 |
|
| uses unrolled loops for increment equal to 1. |
| 14 |
|
| jack dongarra, linpack, 3/11/78. |
| 15 |
|
| modified 3/93 to return if incx .le. 0. |
| 16 |
|
| modified 12/3/93, array(1) declarations changed to array(*) */ |
| 17 |
|
| |
| 18 |
|
| /* Dereference inputs */ |
| 19 |
127 |
| nn = *n; |
| 20 |
127 |
| iincx = *incx; |
| 21 |
127 |
| ssa = *sa; |
| 22 |
|
| |
| 23 |
127 |
▶ | if (nn > 0 && iincx > 0) |
Branch: 2 branches
| Branch | True | False | Total |
| if (nn > 0 && iincx > 0) |
127 |
0 |
127 |
| if (nn > 0 && iincx > 0) |
127 |
0 |
127 |
|
| 24 |
|
| { |
| 25 |
127 |
▶ | if (iincx == 1) /* code for increment equal to 1 */ |
Branch: 1 branch
| Branch | True | False | Total |
| if (iincx == 1) /* code for increment equal to 1 */ |
127 |
0 |
127 |
|
| 26 |
|
| { |
| 27 |
127 |
| m = nn-4; |
| 28 |
381 |
▶ | for (i = 0; i < m; i += 5) |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < m; i += 5) |
254 |
127 |
381 |
|
| 29 |
|
| { |
| 30 |
254 |
| sx[i] = ssa * sx[i]; |
| 31 |
254 |
| sx[i+1] = ssa * sx[i+1]; |
| 32 |
254 |
| sx[i+2] = ssa * sx[i+2]; |
| 33 |
254 |
| sx[i+3] = ssa * sx[i+3]; |
| 34 |
254 |
| sx[i+4] = ssa * sx[i+4]; |
| 35 |
|
| } |
| 36 |
508 |
▶ | for ( ; i < nn; ++i) /* clean-up loop */ |
Branch: 1 branch
| Branch | True | False | Total |
| for ( ; i < nn; ++i) /* clean-up loop */ |
381 |
127 |
508 |
|
| 37 |
381 |
| sx[i] = ssa * sx[i]; |
| 38 |
|
| } |
| 39 |
|
| else /* code for increment not equal to 1 */ |
| 40 |
|
| { |
| 41 |
0 |
| nincx = nn * iincx; |
| 42 |
0 |
▶ | for (i = 0; i < nincx; i += iincx) |
Branch: 1 branch
| Branch | True | False | Total |
| for (i = 0; i < nincx; i += iincx) |
0 |
0 |
0 |
|
| 43 |
0 |
| sx[i] = ssa * sx[i]; |
| 44 |
|
| } |
| 45 |
|
| } |
| 46 |
|
| |
| 47 |
127 |
| return 0; |
| 48 |
|
| } /* dscal_ */ |
| 49 |
|
| |
| 50 |
|
| #ifdef __cplusplus |
| 51 |
|
| } |
| 52 |
|
| #endif |