-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make lt-comp go a bit faster #114
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -319,18 +319,18 @@ Transducer::determinize(int const epsilon_tag) | |
|
||
int t = 0; | ||
|
||
set<int> finals_state; | ||
for(auto& it2 : finals) { | ||
finals_state.insert(it2.first); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for our edification, can you explain why this block is moved? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's calculating a list of the final states in the original transducer, but in its original location it was recalculating it on each iteration but it won't have changed. |
||
while(size_Q_prime != Q_prime.size()) | ||
{ | ||
size_Q_prime = Q_prime.size(); | ||
R[(t+1)%2].clear(); | ||
|
||
for(auto& it : R[t]) | ||
{ | ||
set<int> finals_state; | ||
for(auto& it2 : finals) | ||
{ | ||
finals_state.insert(it2.first); | ||
} | ||
if(!isEmptyIntersection(Q_prime[it], finals_state)) | ||
{ | ||
double w = default_weight; | ||
|
@@ -378,8 +378,8 @@ Transducer::determinize(int const epsilon_tag) | |
t = (t+1)%2; | ||
} | ||
|
||
transitions = transitions_prime; | ||
finals = finals_prime; | ||
transitions.swap(transitions_prime); | ||
finals.swap(finals_prime); | ||
initial = initial_prime; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be
if(current_minimise) minimize(); joinFinals()
, ie. we want to joinFinals also when we minimize? (Seems like the current change would also alter how non-paradigms are compiled!)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minimize()
callsreverse()
which callsjoinFinals()
, so there shouldn't be a change in behavior.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calls
reverse
twice in fact, so it both joins finals and initials … I suppose nowhere in that sequence any new (unjoined) final is added so it's safe then :)