Revision d5b6282d Matrix/matrix.c
Matrix/matrix.c  

23  23 
(m>values[i+j*(m>rows)]) 
24  24 
#define MAT_SET(m,i,j,v) \ 
25  25 
(m>values[i+j*(m>rows)] = v) 
26 
#define MAX(a,b) ((a) > (b) ? (a) : (b)) 

27 
#define MIN(a,b) ((a) < (b) ? (a) : (b)) 

26  28  
27  29 
struct matrix { 
28  30 
matsize rows; 
...  ...  
74  76 
return 0; 
75  77 
} 
76  78  
79 
int matrix_make_bidir(struct matrix * m) 

80 
{ 

81 
int res = 0; 

82 
matsize i, j; 

83 
matvalue v; 

84  
85 
if (m) 

86 
{ 

87 
for(i = 0; i < m>rows; i++) 

88 
for(j = 0; j < m>cols; j++) 

89 
{ 

90 
v = MIN(MAT_GET(m, i, j), MAT_GET(m, j, i)); 

91 
if (v == 0) 

92 
{ 

93 
v = MAX(MAT_GET(m, i, j), MAT_GET(m, j, i)); 

94 
MAT_SET(m, i, j, v); 

95 
MAT_SET(m, j, i, v); 

96 
} 

97 
} 

98 
} else 

99 
res = 1; 

100  
101 
return res; 

102 
} 

103  
77  104 
int matrix_add_edge_record(struct matrix * m, struct string_indexer * si, char * rec) 
78  105 
//input: 0 4 0.56 
79  106 
{ 
Also available in: Unified diff