10 typedef typename std::vector<T>::const_iterator const_iterator;
11 J(const const_iterator &x, const const_iterator &y) : b (x), e (y) {}
12 const const_iterator &begin ();
13 const const_iterator &end ();
19 const typename std::vector<T>::const_iterator &J<T>::begin () { return b; }
21 const typename std::vector<T>::const_iterator &J<T>::end () { return e; }
29 if (*i < 0 || *i >= 2000)
35 f1 (const std::vector<int>::const_iterator &x,
36 const std::vector<int>::const_iterator &y)
41 for (std::vector<int>::const_iterator i = x; i <= y; i += 6)
46 f2 (const std::vector<int>::const_iterator &x,
47 const std::vector<int>::const_iterator &y)
49 std::vector<int>::const_iterator i;
52 #pragma omp taskloop private(i)
53 for (i = x; i < y - 1; i = 1 - 6 + 7 + i)
59 f3 (const std::vector<int>::const_iterator &x,
60 const std::vector<int>::const_iterator &y)
65 for (std::vector<int>::const_iterator i = x; i <= y; i = i + 9 - 8)
71 f4 (const std::vector<int>::const_iterator &x,
72 const std::vector<int>::const_iterator &y)
74 std::vector<int>::const_iterator i;
77 #pragma omp taskloop lastprivate(i)
78 for (i = x + 2000 - 64; i > y + 10; --i)
83 f5 (const std::vector<int>::const_iterator &x,
84 const std::vector<int>::const_iterator &y)
89 for (std::vector<int>::const_iterator i = x + 2000 - 64; i > y + 10; i -= 10)
95 f6 (const std::vector<int>::const_iterator &x,
96 const std::vector<int>::const_iterator &y)
101 for (std::vector<int>::const_iterator i = x + 2000 - 64;
102 i > y + 10; i = i - 12 + 2)
104 std::vector<int>::const_iterator j = i + N;
111 f7 (std::vector<int>::const_iterator i,
112 const std::vector<int>::const_iterator &x,
113 const std::vector<int>::const_iterator &y)
118 for (i = x - 10; i <= y + 10; i += N)
126 std::vector<int>::const_iterator i;
130 for (i = j.begin (); i <= j.end () + N; i += 2)
134 template <typename T, int N>
136 f9 (const typename std::vector<T>::const_iterator &x,
137 const typename std::vector<T>::const_iterator &y)
142 for (typename std::vector<T>::const_iterator i = x; i <= y; i = i + N)
146 template <typename T, int N>
148 f10 (const typename std::vector<T>::const_iterator &x,
149 const typename std::vector<T>::const_iterator &y)
151 typename std::vector<T>::const_iterator i;
155 for (i = x; i > y; i = i + N)
159 template <typename T>
161 f11 (const T &x, const T &y)
165 #pragma omp single nowait
166 #pragma omp taskloop nogroup
167 for (T i = x; i <= y; i += 3)
169 #pragma omp single nowait
177 template <typename T>
179 f12 (const T &x, const T &y)
185 for (i = x; i > y; --i)
192 template <typename T>
194 f13 (const T &x, const T &y)
199 for (T i = x; i <= y + N; i += N)
204 std::vector<int>::const_iterator
205 f14 (const std::vector<int>::const_iterator &x,
206 const std::vector<int>::const_iterator &y)
208 std::vector<int>::const_iterator i;
211 #pragma omp taskloop lastprivate(i)
212 for (i = x; i < y - 1; i = 1 - 6 + 7 + i)
217 template <typename T>
218 std::vector<int>::const_iterator
219 f15 (const std::vector<int>::const_iterator &x,
220 const std::vector<int>::const_iterator &y)
222 std::vector<int>::const_iterator i;
225 #pragma omp taskloop lastprivate(i)
226 for (i = x + 2000 - 64; i > y + 10; --i)
232 std::vector<int>::const_iterator
233 f16 (std::vector<int>::const_iterator i,
234 const std::vector<int>::const_iterator &x,
235 const std::vector<int>::const_iterator &y)
239 #pragma omp taskloop lastprivate(i)
240 for (i = x - 10; i <= y + 10; i += N)
246 std::vector<int>::const_iterator
249 static std::vector<int>::const_iterator i;
252 #pragma omp taskloop lastprivate(i)
253 for (i = j.begin (); i <= j.end () + N; i += 2)
258 template <typename T, int N>
259 typename std::vector<T>::const_iterator
260 f18 (const typename std::vector<T>::const_iterator &x,
261 const typename std::vector<T>::const_iterator &y)
263 static typename std::vector<T>::const_iterator i;
266 #pragma omp taskloop lastprivate(i)
267 for (i = x; i > y; i = i + N)
272 template <typename T>
274 f19 (const T &x, const T &y)
279 #pragma omp single nowait
280 #pragma omp taskloop nogroup lastprivate(i)
281 for (i = x; i <= y; i += 3)
283 #pragma omp single nowait
292 template <typename T>
294 f20 (const T &x, const T &y)
299 #pragma omp taskloop lastprivate(i)
300 for (i = x; i > y; --i)
305 #define check(expr) \
306 for (int i = 0; i < 2000; i++) \
309 if (results[i] != 1) \
313 else if (results[i]) \
319 std::vector<int> a(2000);
320 std::vector<long> b(2000);
321 for (int i = 0; i < 2000; i++)
326 f1 (a.begin () + 10, a.begin () + 1990);
327 check (i >= 10 && i <= 1990 && (i - 10) % 6 == 0);
328 f2 (a.begin () + 0, a.begin () + 1999);
329 check (i < 1998 && (i & 1) == 0);
330 f3<char> (a.begin () + 20, a.begin () + 1837);
331 check (i >= 20 && i <= 1837);
332 f4<int> (a.begin () + 0, a.begin () + 30);
333 check (i > 40 && i <= 2000 - 64);
334 f5 (a.begin () + 0, a.begin () + 100);
335 check (i >= 116 && i <= 2000 - 64 && (i - 116) % 10 == 0);
336 f6<-10> (a.begin () + 10, a.begin () + 110);
337 check (i >= 116 && i <= 2000 - 64 && (i - 116) % 10 == 0);
338 f7<6> (std::vector<int>::const_iterator (), a.begin () + 12,
340 check (i >= 2 && i <= 1808 && (i - 2) % 6 == 0);
341 f8<121> (J<int> (a.begin () + 14, a.begin () + 1803));
342 check (i >= 14 && i <= 1924 && (i & 1) == 0);
343 f9<int, 7> (a.begin () + 33, a.begin () + 1967);
344 check (i >= 33 && i <= 1967 && (i - 33) % 7 == 0);
345 f10<int, -7> (a.begin () + 1939, a.begin () + 17);
346 check (i >= 21 && i <= 1939 && (i - 21) % 7 == 0);
347 f11<std::vector<int>::const_iterator > (a.begin () + 16, a.begin () + 1981);
348 check (i >= 16 && i <= 1984 && (i - 16) % 3 == 0);
349 f12<std::vector<int>::const_iterator > (a.begin () + 1761, a.begin () + 37);
350 check (i > 37 && i <= 1761);
351 K<5>::f13<std::vector<int>::const_iterator > (a.begin () + 1,
353 check (i >= 1 && i <= 1936 && (i - 1) % 5 == 0);
354 if (f14 (a.begin () + 0, a.begin () + 1999) != a.begin () + 1998)
356 check (i < 1998 && (i & 1) == 0);
357 if (f15<int> (a.begin () + 0, a.begin () + 30) != a.begin () + 40)
359 check (i > 40 && i <= 2000 - 64);
360 if (f16<6> (std::vector<int>::const_iterator (), a.begin () + 12,
361 a.begin () + 1800) != a.begin () + 1814)
363 check (i >= 2 && i <= 1808 && (i - 2) % 6 == 0);
364 if (f17<121> (J<int> (a.begin () + 14, a.begin () + 1803)) != a.begin () + 1926)
366 check (i >= 14 && i <= 1924 && (i & 1) == 0);
367 if (f18<int, -7> (a.begin () + 1939, a.begin () + 17) != a.begin () + 14)
369 check (i >= 21 && i <= 1939 && (i - 21) % 7 == 0);
370 if (f19<std::vector<int>::const_iterator > (a.begin () + 16, a.begin () + 1981)
371 != a.begin () + 1984)
373 check (i >= 16 && i <= 1984 && (i - 16) % 3 == 0);
374 if (f20<std::vector<int>::const_iterator > (a.begin () + 1761, a.begin () + 37)
377 check (i > 37 && i <= 1761);
378 f9<long, 7> (b.begin () + 33, b.begin () + 1967);
379 check (i >= 33 && i <= 1967 && (i - 33) % 7 == 0);
380 f10<long, -7> (b.begin () + 1939, b.begin () + 17);
381 check (i >= 21 && i <= 1939 && (i - 21) % 7 == 0);
382 f11<std::vector<long>::const_iterator > (b.begin () + 16, b.begin () + 1981);
383 check (i >= 16 && i <= 1984 && (i - 16) % 3 == 0);
384 f12<std::vector<long>::const_iterator > (b.begin () + 1761, b.begin () + 37);
385 check (i > 37 && i <= 1761);
386 K<5>::f13<std::vector<long>::const_iterator > (b.begin () + 1,
388 check (i >= 1 && i <= 1936 && (i - 1) % 5 == 0);
389 if (f18<long, -7> (b.begin () + 1939, b.begin () + 17) != b.begin () + 14)
391 check (i >= 21 && i <= 1939 && (i - 21) % 7 == 0);
392 if (f19<std::vector<long>::const_iterator > (b.begin () + 16, b.begin () + 1981)
393 != b.begin () + 1984)
395 check (i >= 16 && i <= 1984 && (i - 16) % 3 == 0);
396 if (f20<std::vector<long>::const_iterator > (b.begin () + 1761, b.begin () + 37)
399 check (i > 37 && i <= 1761);