Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
ExactBitParalelism.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <exception>
9#include <string/LinearString.h>
10
11#include "BitParalelism.h"
12
13namespace stringology {
14
15namespace simulations {
16
18public:
19 template <class SymbolType>
21};
22
23
24template <class SymbolType>
26
27 // preparation stage
28 ext::set<SymbolType> common_alphabet = text.getAlphabet();
29 common_alphabet.insert(pattern.getAlphabet().begin(), pattern.getAlphabet().end());
30
32
33 // computation part
35
36 auto B_vector = ext::vector<bool>(pattern.getContent().size(), 1);
37
38 for(unsigned int i = 0; i<text.getContent().size(); i++) {
39 B_vector = (B_vector << 1) | D_vectors[text.getContent()[i]];
40
41 if ( ! B_vector [ pattern.getContent ( ).size ( ) - 1 ] ) {
42 result.insert(i + 1);
43 }
44 }
45
46 return result;
47}
48
49} // namespace simulations
50
51} // namespace stringology
52
Class extending the map class from the standard library. Original reason is to allow printing of the ...
Definition: map.hpp:48
Definition: set.hpp:44
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
Linear string.
Definition: LinearString.h:57
const ext::set< SymbolType > & getAlphabet() const &
Definition: LinearString.h:103
const ext::vector< SymbolType > & getContent() const &
Definition: LinearString.h:238
static ext::map< SymbolType, ext::vector< bool > > constructDVectors(const ext::set< SymbolType > &alphabet, const string::LinearString< SymbolType > &pattern)
Definition: BitParalelism.h:22
Definition: ExactBitParalelism.h:17
static ext::set< unsigned int > search(const string::LinearString< SymbolType > &text, const string::LinearString< SymbolType > &pattern)
Definition: ExactBitParalelism.h:25
int i
Definition: AllEpsilonClosure.h:118
for(const StateType &state :fsm.getStates()) renamingData.insert(std Rename::RenamedAutomaton< T > result(renamingData.at(fsm.getInitialState()))
Definition: Rename.h:253
Definition: ArithmeticCompression.h:18