@@ -78,7 +78,7 @@ template <class T> matrix <unsigned int> select_most(const matrix <T> &mat_arg,
78
78
* @return The index of the elements that are equal to T_arg
79
79
* @ingroup Search
80
80
*/
81
- template <class T > iset find (const matrix <T> &mat_arg, T &T_arg);
81
+ template <class T > susa::bitset find (const matrix <T> &mat_arg, T &T_arg);
82
82
83
83
/* *
84
84
* @brief Dijkstra finds the shortest path
@@ -117,8 +117,7 @@ template <class T> matrix <unsigned int> select_least(const matrix <T> &mat_arg,
117
117
matrix <T> mat_ret = mat_arg;
118
118
matrix <unsigned int > mat_index (uint_num, 1 );
119
119
120
- SUSA_ASSERT_MESSAGE (uint_size > uint_num,
121
- " The number of elements to be selected is larger than the matrix size." );
120
+ SUSA_ASSERT_MESSAGE (uint_size > uint_num, " The number of elements to be selected is larger than the matrix size." );
122
121
123
122
if (uint_size < uint_num)
124
123
{
@@ -128,7 +127,7 @@ template <class T> matrix <unsigned int> select_least(const matrix <T> &mat_arg,
128
127
unsigned int uint_min_index;
129
128
T T_min;
130
129
131
- for ( unsigned int uint_i = 0 ; uint_i < uint_num; uint_i++)
130
+ for ( unsigned int uint_i = 0 ; uint_i < uint_num; uint_i++)
132
131
{
133
132
uint_min_index = uint_i;
134
133
T_min = mat_ret (uint_i);
@@ -161,8 +160,7 @@ template <class T> matrix <unsigned int> select_limited_least(const matrix <T> &
161
160
matrix <T> mat_ret = mat_arg;
162
161
matrix <unsigned int > mat_index (uint_num, 1 );
163
162
164
- SUSA_ASSERT_MESSAGE (uint_size > uint_num,
165
- " The number of elements to be selected is larger than the matrix size." );
163
+ SUSA_ASSERT_MESSAGE (uint_size > uint_num, " The number of elements to be selected is larger than the matrix size." );
166
164
if (uint_size < uint_num)
167
165
{
168
166
return mat_index;
@@ -235,20 +233,20 @@ template <class T> matrix <unsigned int> select_most(const matrix <T> &mat_arg,
235
233
}
236
234
237
235
238
- template <class T > iset find (const matrix <T> &mat_arg, T &T_arg)
236
+ template <class T > susa::bitset find (const matrix <T> &mat_arg, T &T_arg)
239
237
{
240
238
241
239
// TODO support matrices
242
240
SUSA_ASSERT_MESSAGE (mat_arg.is_vector (), " this method supports one dimensional matrices (vectors) only." );
243
241
244
- susa::iset __iset (mat_arg.size () + 1 ); // lets have at least one index
242
+ susa::bitset indxset (mat_arg.size () + 1 ); // lets have at least one index
245
243
246
244
for (unsigned int uint_index = 0 ; uint_index < mat_arg.size (); uint_index++)
247
245
{
248
- if (mat_arg (uint_index) == T_arg) __iset. add (uint_index);
246
+ if (mat_arg (uint_index) == T_arg) indxset. set (uint_index);
249
247
}
250
248
251
- return __iset ;
249
+ return indxset ;
252
250
}
253
251
254
252
@@ -265,27 +263,27 @@ template <class T> matrix <unsigned int> dijkstra(const matrix <T> &mat_graph, u
265
263
266
264
dist (uint_src) = 0 ;
267
265
268
- iset __iset (uint_num_nodes);
269
- __iset. add_all ();
266
+ susa::bitset nset (uint_num_nodes);
267
+ nset. set ();
270
268
271
269
272
270
unsigned int uint_min = 0 ;
273
271
unsigned int uint_min_index = 0 ;
274
272
unsigned int uint_alt = 0 ;
275
- while (__iset. is_not_empty ())
273
+ while (nset. any ())
276
274
{
277
275
278
276
uint_min = std::numeric_limits <unsigned int >::max ();
279
277
for (unsigned int uint_index = 0 ; uint_index < uint_num_nodes; uint_index++)
280
278
{
281
- if (__iset .exists (uint_index) && dist (uint_index) < uint_min)
279
+ if (nset .exists (uint_index) && dist (uint_index) < uint_min)
282
280
{
283
281
uint_min_index = uint_index;
284
282
uint_min = dist (uint_index);
285
283
}
286
284
}
287
285
288
- __iset. remove (uint_min_index);
286
+ nset. reset (uint_min_index);
289
287
290
288
291
289
for (unsigned int uint_i = 0 ; uint_i < uint_num_nodes; uint_i++)
0 commit comments