4 typedef __PTRDIFF_TYPE__ ptrdiff_t;
5 extern "C" void abort ();
11 typedef ptrdiff_t difference_type;
18 T &operator [] (const difference_type &) const;
19 I &operator = (const I &);
24 I &operator += (const difference_type &);
25 I &operator -= (const difference_type &);
26 I operator + (const difference_type &) const;
27 I operator - (const difference_type &) const;
28 template <typename S> friend bool operator == (I<S> &, I<S> &);
29 template <typename S> friend bool operator == (const I<S> &, const I<S> &);
30 template <typename S> friend bool operator < (I<S> &, I<S> &);
31 template <typename S> friend bool operator < (const I<S> &, const I<S> &);
32 template <typename S> friend bool operator <= (I<S> &, I<S> &);
33 template <typename S> friend bool operator <= (const I<S> &, const I<S> &);
34 template <typename S> friend bool operator > (I<S> &, I<S> &);
35 template <typename S> friend bool operator > (const I<S> &, const I<S> &);
36 template <typename S> friend bool operator >= (I<S> &, I<S> &);
37 template <typename S> friend bool operator >= (const I<S> &, const I<S> &);
38 template <typename S> friend typename I<S>::difference_type operator - (I<S> &, I<S> &);
39 template <typename S> friend typename I<S>::difference_type operator - (const I<S> &, const I<S> &);
40 template <typename S> friend I<S> operator + (typename I<S>::difference_type , const I<S> &);
44 template <typename T> I<T>::I () : p (0) {}
45 template <typename T> I<T>::~I () { p = (T *) 0; }
46 template <typename T> I<T>::I (T *x) : p (x) {}
47 template <typename T> I<T>::I (const I &x) : p (x.p) {}
48 template <typename T> T &I<T>::operator * () { return *p; }
49 template <typename T> T *I<T>::operator -> () { return p; }
50 template <typename T> T &I<T>::operator [] (const difference_type &x) const { return p[x]; }
51 template <typename T> I<T> &I<T>::operator = (const I &x) { p = x.p; return *this; }
52 template <typename T> I<T> &I<T>::operator ++ () { ++p; return *this; }
53 template <typename T> I<T> I<T>::operator ++ (int) { return I (p++); }
54 template <typename T> I<T> &I<T>::operator -- () { --p; return *this; }
55 template <typename T> I<T> I<T>::operator -- (int) { return I (p--); }
56 template <typename T> I<T> &I<T>::operator += (const difference_type &x) { p += x; return *this; }
57 template <typename T> I<T> &I<T>::operator -= (const difference_type &x) { p -= x; return *this; }
58 template <typename T> I<T> I<T>::operator + (const difference_type &x) const { return I (p + x); }
59 template <typename T> I<T> I<T>::operator - (const difference_type &x) const { return I (p - x); }
60 template <typename T> bool operator == (I<T> &x, I<T> &y) { return x.p == y.p; }
61 template <typename T> bool operator == (const I<T> &x, const I<T> &y) { return x.p == y.p; }
62 template <typename T> bool operator != (I<T> &x, I<T> &y) { return !(x == y); }
63 template <typename T> bool operator != (const I<T> &x, const I<T> &y) { return !(x == y); }
64 template <typename T> bool operator < (I<T> &x, I<T> &y) { return x.p < y.p; }
65 template <typename T> bool operator < (const I<T> &x, const I<T> &y) { return x.p < y.p; }
66 template <typename T> bool operator <= (I<T> &x, I<T> &y) { return x.p <= y.p; }
67 template <typename T> bool operator <= (const I<T> &x, const I<T> &y) { return x.p <= y.p; }
68 template <typename T> bool operator > (I<T> &x, I<T> &y) { return x.p > y.p; }
69 template <typename T> bool operator > (const I<T> &x, const I<T> &y) { return x.p > y.p; }
70 template <typename T> bool operator >= (I<T> &x, I<T> &y) { return x.p >= y.p; }
71 template <typename T> bool operator >= (const I<T> &x, const I<T> &y) { return x.p >= y.p; }
72 template <typename T> typename I<T>::difference_type operator - (I<T> &x, I<T> &y) { return x.p - y.p; }
73 template <typename T> typename I<T>::difference_type operator - (const I<T> &x, const I<T> &y) { return x.p - y.p; }
74 template <typename T> I<T> operator + (typename I<T>::difference_type x, const I<T> &y) { return I<T> (x + y.p); }
80 J(const I<T> &x, const I<T> &y) : b (x), e (y) {}
87 template <typename T> const I<T> &J<T>::begin () { return b; }
88 template <typename T> const I<T> &J<T>::end () { return e; }
93 f1 (J<int> x, J<int> y, J<int> z)
96 int l, f = 0, n = 0, m = 0;
97 #pragma omp parallel shared (i, j, k, l) firstprivate (f) \
98 reduction (+:n, m) num_threads (8)
100 #pragma omp for lastprivate (i, j, k, l) schedule (static, 9) \
102 for (i = x.begin (); i < x.end (); ++i)
103 for (j = y.begin (); j <= y.end (); j += 1)
104 for (l = 0; l < 1; l++)
105 for (k = z.begin () + 3; k < z.end () - 3; k++)
106 if (omp_get_num_threads () == 8
107 && ((*i + 2) * 12 + (*j + 5) * 4 + (*k - 13)
108 != (omp_get_thread_num () * 9 + f++)))
113 if (n || i != x.end () || j != y.end () + 1 || k != z.end () - 3
114 || m != 72 || l != 1)
119 f2 (J<int> x, J<int> y, J<int> z)
121 int f = 0, n = 0, m = 0;
122 #pragma omp parallel for firstprivate (f) reduction (+:n, m) \
123 num_threads (8) schedule (static, 9) \
125 for (I<int> i = x.end () - 1; i >= x.begin (); --i)
126 for (int l = -131; l >= -131; l--)
127 for (I<int> j = y.end (); j > y.begin () - 1; j -= 1)
129 for (I<int> k = z.end () - 4; k >= z.begin () + 3; k--)
130 if (omp_get_num_threads () == 8
131 && ((3 - *i) * 12 + (-3 - *j) * 4 + (16 - *k)
132 != (omp_get_thread_num () * 9 + f++)))
141 template <typename T>
143 f3 (J<int> x, J<int> y, J<int> z)
146 int l, f = 0, n = 0, m = 0;
147 #pragma omp parallel shared (i, j, k, l) firstprivate (f) \
148 reduction (+:n, m) num_threads (8)
150 #pragma omp for lastprivate (i, j, k, l) schedule (static, 9) \
152 for (i = x.begin (); i < x.end (); ++i)
153 for (j = y.begin (); j <= y.end (); j += 1)
154 for (k = z.begin () + 3; k < z.end () - 3; k++)
155 for (l = 7; l <= 7; l++)
156 if (omp_get_num_threads () == 8
157 && ((*i + 2) * 12 + (*j + 5) * 4 + (*k - 13)
158 != (omp_get_thread_num () * 9 + f++)))
163 if (n || i != x.end () || j != y.end () + 1 || k != z.end () - 3
164 || m != 72 || l != 8)
168 template <typename T>
170 f4 (J<int> x, J<int> y, J<int> z)
172 int f = 0, n = 0, m = 0;
173 #pragma omp parallel for firstprivate (f) reduction (+:n, m) \
174 num_threads (8) schedule (static, 9) \
176 for (I<int> i = x.end () - 1; i >= x.begin (); --i)
178 for (I<int> j = y.end (); j > y.begin () - 1; j -= 1)
180 for (I<int> k = z.end () - 4; k >= z.begin () + 3; k--)
181 if (omp_get_num_threads () == 8
182 && ((3 - *i) * 12 + (-3 - *j) * 4 + (16 - *k)
183 != (omp_get_thread_num () * 9 + f++)))
193 template <typename T>
195 f5 (J<int> x, J<int> y, J<int> z)
198 int f = 0, n = 0, m = 0;
199 #pragma omp parallel shared (i, j, k) firstprivate (f) \
200 reduction (+:n, m) num_threads (8)
202 #pragma omp for lastprivate (i, j, k) schedule (static, 9) \
204 for (i = x.begin (); i < x.end (); ++i)
205 for (j = y.begin (); j <= y.end (); j += (T) 1)
207 for (k = z.begin () + 3; k < z.end () - 3; k++)
208 if (omp_get_num_threads () == 8
209 && ((*i + 2) * 12 + (*j + 5) * 4 + (*k - 13)
210 != (omp_get_thread_num () * 9 + f++)))
216 if (n || i != x.end () || j != y.end () + 1 || k != z.end () - 3
221 template <typename T>
223 f6 (J<int> x, J<int> y, J<int> z)
225 int f = 0, n = 0, m = 0;
226 #pragma omp parallel for firstprivate (f) reduction (+:n, m) \
227 num_threads (8) schedule (static, 9) \
229 for (I<int> i = x.end () - 1; i >= x.begin (); --i)
231 for (I<int> j = y.end (); j > y.begin () - 1; j -= 1)
233 for (I<int> k = z.end () - 4; k >= z.begin () + (T) 3; k--)
234 if (omp_get_num_threads () == 8
235 && ((3 - *i) * 12 + (-3 - *j) * 4 + (16 - *k)
236 != (omp_get_thread_num () * 9 + f++)))
246 template <typename T>
248 f7 (J<T> x, J<T> y, J<T> z)
250 I<T> i, j, k, o = y.begin ();
251 T l, f = 0, n = 0, m = 0;
252 #pragma omp parallel shared (i, j, k, l) firstprivate (f) \
253 reduction (+:n, m) num_threads (8)
255 #pragma omp for lastprivate (i, j, k, l) schedule (static, 9) \
257 for (i = x.begin (); i < x.end (); ++i)
258 for (j = y.begin (); j <= y.end (); j += 1)
259 for (l = *o; l <= *o; l = 1 + l)
260 for (k = z.begin () + 3; k < z.end () - 3; k++)
261 if (omp_get_num_threads () == 8
262 && ((*i + 2) * 12 + (*j + 5) * 4 + (*k - 13)
263 != (omp_get_thread_num () * 9 + f++)))
268 if (n || i != x.end () || j != y.end () + 1 || k != z.end () - 3
269 || m != 72 || l != *o + 1)
273 template <typename T>
275 f8 (J<T> x, J<T> y, J<T> z)
277 T f = 0, n = 0, m = 0;
278 #pragma omp parallel for firstprivate (f) reduction (+:n, m) \
279 num_threads (8) schedule (static, 9) \
281 for (I<T> i = x.end () - 1; i >= x.begin (); --i)
282 for (T l = 0; l < 1; l++)
283 for (I<T> j = y.end (); j > y.begin () - 1; j -= 1)
285 for (I<T> k = z.end () - 4; k >= z.begin () + 3; k--)
286 if (omp_get_num_threads () == 8
287 && ((3 - *i) * 12 + (-3 - *j) * 4 + (16 - *k)
288 != (omp_get_thread_num () * 9 + f++)))
297 template <typename S, typename T>
299 f9 (J<T> x, J<T> y, J<T> z)
301 S i, j, k, o = y.begin ();
302 T l, f = 0, n = 0, m = 0;
303 #pragma omp parallel shared (i, j, k, l) firstprivate (f) \
304 reduction (+:n, m) num_threads (8)
306 #pragma omp for lastprivate (i, j, k, l) schedule (static, 9) \
308 for (i = x.begin (); i < x.end (); ++i)
309 for (j = y.begin (); j <= y.end (); j += 1)
310 for (l = *o; l <= *o; l = 1 + l)
311 for (k = z.begin () + 3; k < z.end () - 3; k++)
312 if (omp_get_num_threads () == 8
313 && ((*i + 2) * 12 + (*j + 5) * 4 + (*k - 13)
314 != (omp_get_thread_num () * 9 + f++)))
319 if (n || i != x.end () || j != y.end () + 1 || k != z.end () - 3
320 || m != 72 || l != *o + 1)
324 template <typename S, typename T>
326 f10 (J<T> x, J<T> y, J<T> z)
328 T f = 0, n = 0, m = 0;
329 #pragma omp parallel for firstprivate (f) reduction (+:n, m) \
330 num_threads (8) schedule (static, 9) \
332 for (S i = x.end () - 1; i >= x.begin (); --i)
333 for (T l = 0; l < 1; l++)
334 for (S j = y.end (); j > y.begin () - 1; j -= 1)
336 for (S k = z.end () - 4; k >= z.begin () + 3; k--)
337 if (omp_get_num_threads () == 8
338 && ((3 - *i) * 12 + (-3 - *j) * 4 + (16 - *k)
339 != (omp_get_thread_num () * 9 + f++)))
353 for (int i = 0; i < 2000; i++)
358 J<int> x (&a[998], &a[1004]);
359 J<int> y (&a[995], &a[997]);
360 J<int> z (&a[1010], &a[1020]);
369 f9 <I<int>, int> (x, y, z);
370 f10 <I<int>, int> (x, y, z);