Algorithm-ConstructDFA-XS
view release on metacpan or search on metacpan
ConstructDFA.xs view on Meta::CPAN
// to identify accepting configurations, the call_sv
// and the associated array copying is a bottleneck
typedef UV State;
typedef set<State> States;
typedef UV Label;
typedef size_t StatesId;
template <class T>
class VectorBasedSet {
public:
std::vector<bool> included;
std::vector<T> elements;
bool empty() { return elements.empty(); };
bool contains(const T& s) {
return s < included.size() && included[s];
}
void insert(const T& s) {
if (!contains(s)) {
if (included.size() <= s) {
included.resize(s + 1);
ConstructDFA.xs view on Meta::CPAN
}
PUTBACK;
FREETMPS;
LEAVE;
return result;
}
class StatesBimap {
public:
std::map<vector<State>, StatesId> s2id;
std::vector<vector<State>> id2s;
StatesBimap() {
states_to_id(States());
};
StatesId states_to_id(const States& s) {
vector<State> v;
lib/Algorithm/ConstructDFA/XS.pm view on Meta::CPAN
=head1 DESCRIPTION
Replacement for L<Algorithm::ConstructDFA> written in C++.
=head2 FUNCTIONS
=over
=item construct_dfa_xs(...)
Same as C<construct_dfa> in L<Algorithm::ConstructDFA>. The public
API should be the same between the two modules if the version numbers
match.
=back
=head2 EXPORTS
The function C<construct_dfa_xs> by default.
=head1 AUTHOR / COPYRIGHT / LICENSE
( run in 0.332 second using v1.01-cache-2.11-cpan-64827b87656 )