src/liblinear/blas/ddot.c

filter: Statementstmt 58.3% 14 / 24 Branchbran 43.7% 7 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 52.5% 21 / 40 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« src/liblinear/linear.cpp ↑ Summary src/liblinear/newton.cpp »
1 #include "blas.h"
2  
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6  
7 760 double ddot_(int *n, double *sx, int *incx, double *sy, int *incy)
8 {
9 long int i, m, nn, iincx, iincy;
10 double stemp;
11 long int ix, iy;
12  
13 /* forms the dot product of two vectors.
14 uses unrolled loops 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 760 nn = *n;
20 760 iincx = *incx;
21 760 iincy = *incy;
22  
23 760 stemp = 0.0;
24 760 ▶ if (nn > 0)
Branch: 1 branch
BranchTrueFalseTotal
if (nn > 0) 760 0 760
25 {
26 760 ▶ if (iincx == 1 && iincy == 1) /* code for both increments equal to 1 */
Branch: 2 branches
BranchTrueFalseTotal
if (iincx == 1 && iincy == 1) /* code for both increments equal to 1 */ 760 0 760
if (iincx == 1 && iincy == 1) /* code for both increments equal to 1 */ 760 0 760
27 {
28 760 m = nn-4;
29 2280 ▶ for (i = 0; i < m; i += 5)
Branch: 1 branch
BranchTrueFalseTotal
for (i = 0; i < m; i += 5) 1520 760 2280
30 1520 stemp += sx[i] * sy[i] + sx[i+1] * sy[i+1] + sx[i+2] * sy[i+2] +
31 1520 sx[i+3] * sy[i+3] + sx[i+4] * sy[i+4];
32  
33 3040 ▶ for ( ; i < nn; i++) /* clean-up loop */
Branch: 1 branch
BranchTrueFalseTotal
for ( ; i < nn; i++) /* clean-up loop */ 2280 760 3040
34 2280 stemp += sx[i] * sy[i];
35 }
36 else /* code for unequal increments or equal increments not equal to 1 */
37 {
38 0 ix = 0;
39 0 iy = 0;
40 0 ▶ if (iincx < 0)
Branch: 1 branch
BranchTrueFalseTotal
if (iincx < 0) 0 0 0
41 0 ix = (1 - nn) * iincx;
42 0 ▶ if (iincy < 0)
Branch: 1 branch
BranchTrueFalseTotal
if (iincy < 0) 0 0 0
43 0 iy = (1 - nn) * iincy;
44 0 ▶ for (i = 0; i < nn; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i = 0; i < nn; i++) 0 0 0
45 {
46 0 stemp += sx[ix] * sy[iy];
47 0 ix += iincx;
48 0 iy += iincy;
49 }
50 }
51 }
52  
53 760 return stemp;
54 } /* ddot_ */
55  
56 #ifdef __cplusplus
57 }
58 #endif
« src/liblinear/linear.cpp ↑ Summary src/liblinear/newton.cpp »