Skip to content

Commit 21b0524

Browse files
committed
fm: worst
1 parent e447fca commit 21b0524

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/algorithms/fiduccia_mattheyses.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ fn fiduccia_mattheyses<W>(
122122
// number of vertices in the mesh. However, if too many subsequent
123123
// bad flips are performed, the loop will break early
124124
for _ in 0..max_moves_per_pass {
125-
let (moved_vertex, move_gain) = match gain_to_vertex
125+
let (moved_vertex, move_gain) = match gain_to_vertex[gain_table_idx(1)..]
126126
.iter()
127-
.rev()
128-
.zip((-max_possible_gain..=max_possible_gain).rev())
127+
.chain(gain_to_vertex[..gain_table_idx(1)].iter().rev())
128+
.zip((1..=max_possible_gain).chain((-max_possible_gain..1).rev()))
129129
.find_map(|(vertices, gain)| {
130130
let (best_vertex, _) = vertices
131131
.iter()

0 commit comments

Comments
 (0)