24 #define INT_MAX 2147483647 27 #define INFINITY INT_MAX 29 #pragma map generate_hw 0 32 bellmanford(
int source[
N_dest],
int dest[N_dest],
int weight [N_dest],
int distance[
N_dist],
int edgecount,
int nodecount,
int src)
37 for (i=0; i < nodecount; ++i)
41 for (i=0; i < nodecount; ++i) {
42 for (j=0; j < edgecount; ++j) {
44 int new_distance =
distance[source[j]] + weight[j];
45 if (new_distance <
distance[dest[j]])
51 for (i=0; i < edgecount; ++i) {
63 int *source, *dest, *weight, *
dist, i, edgecount, nodecount, src, success;
70 source = (
int*) malloc( 10 *
sizeof(
int ) );
71 dest = (
int*) malloc( edgecount *
sizeof(
int ) );
72 weight = (
int*) malloc( edgecount *
sizeof(
int ) );
73 dist = (
int*) malloc( nodecount *
sizeof(
int ) );
75 source[0] = 0; dest[0] = 1; weight[0] = 5;
76 source[1] = 0; dest[1] = 2; weight[1] = 8;
77 source[2] = 0; dest[2] = 3; weight[2] = -4;
78 source[3] = 1; dest[3] = 0; weight[3] = -2;
79 source[4] = 2; dest[4] = 1; weight[4] = -3;
80 source[5] = 2; dest[5] = 3; weight[5] = 9;
81 source[6] = 3; dest[6] = 1; weight[6] = 7;
82 source[7] = 3; dest[7] = 4; weight[7] = 2;
83 source[8] = 4; dest[8] = 0; weight[8] = 6;
84 source[9] = 4; dest[9] = 2; weight[9] = 7;
90 source = (
int*) malloc( 21 *
sizeof(
int ) );
91 dest = (
int*) malloc( edgecount *
sizeof(
int ) );
92 weight = (
int*) malloc( edgecount *
sizeof(
int ) );
93 dist = (
int*) malloc( nodecount *
sizeof(
int ) );
95 source[0] = 0; dest[0] = 2; weight[0] = 2;
96 source[1] = 0; dest[1] = 13; weight[1] = 30;
97 source[2] = 1; dest[2] = 12; weight[2] = -2;
98 source[3] = 2; dest[3] = 1; weight[3] = -1;
99 source[4] = 2; dest[4] = 11; weight[4] = 9;
100 source[5] = 3; dest[5] = 13; weight[5] = -10;
101 source[6] = 3; dest[6] = 10; weight[6] = 7;
102 source[7] = 5; dest[7] = 3; weight[7] = 3;
103 source[8] = 5; dest[8] = 6; weight[8] = 2;
104 source[9] = 6; dest[9] = 8; weight[9] = 3;
105 source[10] = 7; dest[10] = 6; weight[10] = -4;
106 source[11] = 7; dest[11] = 8; weight[11] = 6;
107 source[12] = 8; dest[12] = 7; weight[12] = 3;
108 source[13] = 9; dest[13] = 7; weight[13] = 2;
109 source[14] = 9; dest[14] = 4; weight[14] = -5;
110 source[15] = 10; dest[15] = 11; weight[15] = 1;
111 source[16] = 10; dest[16] = 14; weight[16] = 2;
112 source[17] = 11; dest[17] = 5; weight[17] = 8;
113 source[18] = 12; dest[18] = 0; weight[18] = -3;
114 source[19] = 13; dest[19] = 9; weight[19] = 3;
115 source[20] = 14; dest[20] = 1; weight[20] = 6;
119 #pragma map call_hw VIRTEX5 0 120 success = bellmanford(source, dest, weight, dist, edgecount, nodecount, src);
_Bool __attribute__((noinline))
TYPE distance(TYPE position_x[nAtoms], TYPE position_y[nAtoms], TYPE position_z[nAtoms], int i, int j)