Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- array_view<float, 1> Matrix_X(N, POSX), Matrix_Y(N, POSY), Matrix_R(N + N, POSR), AX(N, AX_M), AY(N, AY_M);
- Matrix_R.discard_data();
- parallel_for_each(
- Matrix_R.extent, [=](index<1> first) restrict(amp) {
- for (int next = 0; next < N; next++) {
- if (first[0] != next) {
- AX[first[0]] = 0.1 * (Matrix_X[next] - Matrix_X[first[0]]) / fast_math::sqrt((Matrix_X[next] - Matrix_X[first[0]])*(Matrix_X[next] - Matrix_X[first[0]]) + (Matrix_Y[next] - Matrix_Y[first[0]])*(Matrix_Y[next] - Matrix_Y[first[0]]));
- AY[first[0]] = 0.1 * (Matrix_Y[next] - Matrix_Y[first[0]]) / fast_math::sqrt((Matrix_X[next] - Matrix_X[first[0]])*(Matrix_X[next] - Matrix_X[first[0]]) + (Matrix_Y[next] - Matrix_Y[first[0]])*(Matrix_Y[next] - Matrix_Y[first[0]]));
- }
- }
- Matrix_R[first[0]] += AX[first[0]];
- Matrix_R[first[0] + N] += AY[first[0]];
- });
- Matrix_R.synchronize();
Advertisement
Add Comment
Please, Sign In to add comment