3 /* complex reductions. */
17 double complex vresult
, result
, array
[n
];
18 bool lvresult
, lresult
;
20 for (i
= 0; i
< n
; i
++)
27 #pragma acc parallel vector_length (vl)
28 #pragma acc loop reduction (+:result)
29 for (i
= 0; i
< n
; i
++)
32 /* Verify the reduction. */
33 for (i
= 0; i
< n
; i
++)
36 if (result
!= vresult
)
42 /* Needs support for complex multiplication. */
44 // /* '*' reductions. */
45 // #pragma acc parallel vector_length (vl)
46 // #pragma acc loop reduction (*:result)
47 // for (i = 0; i < n; i++)
48 // result *= array[i];
50 // /* Verify the reduction. */
51 // for (i = 0; i < n; i++)
52 // vresult *= array[i];
54 // if (fabs(result - vresult) > .0001)
59 // /* 'max' reductions. */
60 // #pragma acc parallel vector_length (vl)
61 // #pragma acc loop reduction (+:result)
62 // for (i = 0; i < n; i++)
63 // result = result > array[i] ? result : array[i];
65 // /* Verify the reduction. */
66 // for (i = 0; i < n; i++)
67 // vresult = vresult > array[i] ? vresult : array[i];
69 // printf("%d != %d\n", result, vresult);
70 // if (result != vresult)
76 // /* 'min' reductions. */
77 // #pragma acc parallel vector_length (vl)
78 // #pragma acc loop reduction (+:result)
79 // for (i = 0; i < n; i++)
80 // result = result < array[i] ? result : array[i];
82 // /* Verify the reduction. */
83 // for (i = 0; i < n; i++)
84 // vresult = vresult < array[i] ? vresult : array[i];
86 // printf("%d != %d\n", result, vresult);
87 // if (result != vresult)
96 /* '&&' reductions. */
97 #pragma acc parallel vector_length (vl)
98 #pragma acc loop reduction (&&:lresult)
99 for (i
= 0; i
< n
; i
++)
100 lresult
= lresult
&& (creal(result
) > creal(array
[i
]));
102 /* Verify the reduction. */
103 for (i
= 0; i
< n
; i
++)
104 lvresult
= lresult
&& (creal(result
) > creal(array
[i
]));
106 if (lresult
!= lvresult
)
115 /* '||' reductions. */
116 #pragma acc parallel vector_length (vl)
117 #pragma acc loop reduction (||:lresult)
118 for (i
= 0; i
< n
; i
++)
119 lresult
= lresult
|| (creal(result
) > creal(array
[i
]));
121 /* Verify the reduction. */
122 for (i
= 0; i
< n
; i
++)
123 lvresult
= lresult
|| (creal(result
) > creal(array
[i
]));
125 if (lresult
!= lvresult
)