#include <Bitmap.h>
Public Member Functions | |
| Bitmap (size_t size, const std::vector< bool > &initializer) | |
| Create Bitmap of length size, and initialise with vector.   | |
| Bitmap (size_t size) | |
| Create Bitmap of length size and initialise.   | |
| Bitmap (const Bitmap ©) | |
| Deep copy.   | |
| Bitmap (const Bitmap ©, const Range &range) | |
| size_t | GetNumWordsCovered () const | 
| Count of words translated.   | |
| size_t | GetFirstGapPos () const | 
| position of 1st word not yet translated, or NOT_FOUND if everything already translated   | |
| size_t | GetLastGapPos () const | 
| position of last word not yet translated, or NOT_FOUND if everything already translated   | |
| size_t | GetLastPos () const | 
| position of last translated word   | |
| bool | GetValue (size_t pos) const | 
| whether a word has been translated at a particular position   | |
| void | SetValue (size_t pos, bool value) | 
| set value at a particular position   | |
| bool | IsComplete () const | 
| whether every word has been translated   | |
| bool | Overlap (const Range &compare) const | 
| whether the wordrange overlaps with any translated word in this bitmap   | |
| size_t | GetSize () const | 
| number of elements   | |
| size_t | GetEdgeToTheLeftOf (size_t l) const | 
| size_t | GetEdgeToTheRightOf (size_t r) const | 
| WordsBitmapID | GetID () const | 
| converts bitmap into an integer ID: it consists of two parts: the first 16 bit are the pattern between the first gap and the last word-1, the second 16 bit are the number of filled positions. enforces a sentence length limit of 65535 and a max distortion of 16   | |
| WordsBitmapID | GetIDPlus (size_t startPos, size_t endPos) const | 
| converts bitmap into an integer ID, with an additional span covered   | |
| size_t | hash () const | 
| bool | operator== (const Bitmap &other) const | 
| bool | operator!= (const Bitmap &other) const | 
| TO_STRING () | |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const Bitmap &bitmap) | 
Implemented using a vector of char, which is usually the same representation for the elements that a C array of bool would use. A vector of bool, or a Boost dynamic_bitset, could be much more efficient in theory. Unfortunately algorithms like std::find() are not optimized for vector<bool> on gcc or clang, and dynamic_bitset lacks all the optimized search operations we want. Only benchmarking will tell what works best. Perhaps dynamic_bitset could still be a dramatic improvement, if we flip the meaning of the bits around so we can use its find_first() and find_next() for the most common searches.
Definition at line 50 of file Bitmap.h.
| Moses::Bitmap::Bitmap | ( | size_t | size, | |
| const std::vector< bool > & | initializer | |||
| ) |  [explicit] | 
        
| Moses::Bitmap::Bitmap | ( | size_t | size | ) |  [explicit] | 
        
| Moses::Bitmap::Bitmap | ( | const Bitmap & | copy | ) |  [explicit] | 
        
Definition at line 65 of file Bitmap.cpp.
| size_t Moses::Bitmap::GetEdgeToTheLeftOf | ( | size_t | l | ) |  const [inline] | 
        
Definition at line 180 of file Bitmap.h.
Referenced by Moses::SearchNormal::ProcessOneHypothesis().

| size_t Moses::Bitmap::GetEdgeToTheRightOf | ( | size_t | r | ) |  const [inline] | 
        
Definition at line 188 of file Bitmap.h.
Referenced by Moses::SearchNormal::ProcessOneHypothesis().

| size_t Moses::Bitmap::GetFirstGapPos | ( | ) |  const [inline] | 
        
position of 1st word not yet translated, or NOT_FOUND if everything already translated
Definition at line 115 of file Bitmap.h.
Referenced by BOOST_AUTO_TEST_CASE(), Moses::SquareMatrix::CalcEstimatedScore(), Moses::ReorderingConstraint::Check(), Moses::SearchCubePruning::CheckDistortion(), Moses::DistortionScoreProducer::EvaluateWhenApplied(), GetID(), GetIDPlus(), Moses::HypothesisScoreOrdererWithDistortion::operator()(), and Moses::SearchNormal::ProcessOneHypothesis().

| WordsBitmapID Moses::Bitmap::GetID | ( | ) |  const [inline] | 
        
converts bitmap into an integer ID: it consists of two parts: the first 16 bit are the pattern between the first gap and the last word-1, the second 16 bit are the number of filled positions. enforces a sentence length limit of 65535 and a max distortion of 16
Definition at line 198 of file Bitmap.h.
References end, GetFirstGapPos(), GetLastPos(), GetValue(), and NOT_FOUND.
Referenced by Moses::HypothesisStackNormal::Add(), Moses::HypothesisStackNormal::GetWorstScoreForBitmap(), and Moses::HypothesisStackNormal::PruneToSize().


| WordsBitmapID Moses::Bitmap::GetIDPlus | ( | size_t | startPos, | |
| size_t | endPos | |||
| ) |  const [inline] | 
        
converts bitmap into an integer ID, with an additional span covered
Definition at line 216 of file Bitmap.h.
References end, GetFirstGapPos(), GetLastPos(), GetValue(), and NOT_FOUND.
Referenced by Moses::SearchNormal::ExpandHypothesis().


| size_t Moses::Bitmap::GetLastGapPos | ( | ) |  const [inline] | 
        
position of last word not yet translated, or NOT_FOUND if everything already translated
Definition at line 121 of file Bitmap.h.
References NOT_FOUND.
Referenced by BOOST_AUTO_TEST_CASE().

| size_t Moses::Bitmap::GetLastPos | ( | ) |  const [inline] | 
        
position of last translated word
Definition at line 133 of file Bitmap.h.
References NOT_FOUND.
Referenced by BOOST_AUTO_TEST_CASE(), Moses::SquareMatrix::CalcEstimatedScore(), Moses::ReorderingConstraint::Check(), GetID(), and GetIDPlus().

| size_t Moses::Bitmap::GetNumWordsCovered | ( | ) |  const [inline] | 
        
Count of words translated.
Definition at line 110 of file Bitmap.h.
Referenced by Moses::SentenceStats::AddRecombination(), Moses::ascendingCoverageCmp(), Moses::BackwardsEdge::BackwardsEdge(), BOOST_AUTO_TEST_CASE(), Moses::calcNgramExpectations(), Moses::SearchCubePruning::CreateForwardTodos(), Moses::BleuScoreFeature::EvaluateWhenApplied(), Moses::SearchNormal::ExpandHypothesis(), IsComplete(), Moses::Manager::OutputSearchGraphAsHypergraph(), and Moses::OutputSearchNode().

| size_t Moses::Bitmap::GetSize | ( | ) |  const [inline] | 
        
number of elements
Definition at line 176 of file Bitmap.h.
Referenced by BOOST_AUTO_TEST_CASE(), Moses::SquareMatrix::CalcEstimatedScore(), Moses::BleuScoreFeature::EvaluateWhenApplied(), and IsComplete().

| bool Moses::Bitmap::GetValue | ( | size_t | pos | ) |  const [inline] | 
        
whether a word has been translated at a particular position
Definition at line 144 of file Bitmap.h.
Referenced by BOOST_AUTO_TEST_CASE(), Moses::SquareMatrix::CalcEstimatedScore(), Moses::ReorderingConstraint::Check(), Moses::SearchCubePruning::CreateForwardTodos(), GetID(), GetIDPlus(), Moses::IsMonotonicStep(), Moses::IsSwap(), Moses::operator<<(), and Moses::SearchNormal::ProcessOneHypothesis().

| size_t Moses::Bitmap::hash | ( | ) | const | 
Definition at line 74 of file Bitmap.cpp.
References Moses::hash_value().
Referenced by Moses::Hypothesis::hash().


| bool Moses::Bitmap::IsComplete | ( | ) |  const [inline] | 
        
whether every word has been translated
Definition at line 164 of file Bitmap.h.
References GetNumWordsCovered(), and GetSize().
Referenced by Moses::calcNgramExpectations(), Moses::TargetNgramFeature::EvaluateWhenApplied(), Moses::TargetBigramFeature::EvaluateWhenApplied(), and Moses::Hypothesis::IsSourceCompleted().


| bool Moses::Bitmap::operator!= | ( | const Bitmap & | other | ) |  const [inline] | 
        
| bool Moses::Bitmap::operator== | ( | const Bitmap & | other | ) | const | 
Definition at line 80 of file Bitmap.cpp.
| bool Moses::Bitmap::Overlap | ( | const Range & | compare | ) |  const [inline] | 
        
whether the wordrange overlaps with any translated word in this bitmap
Definition at line 168 of file Bitmap.h.
References Moses::Range::GetEndPos(), and Moses::Range::GetStartPos().
Referenced by Moses::TranslationOption::Overlap(), and Moses::SearchNormal::ProcessOneHypothesis().


| void Moses::Bitmap::SetValue | ( | size_t | pos, | |
| bool | value | |||
| ) |  [inline] | 
        
set value at a particular position
Definition at line 148 of file Bitmap.h.
Referenced by BOOST_AUTO_TEST_CASE(), and Moses::OpSequenceModel::EvaluateWhenApplied().

| Moses::Bitmap::TO_STRING | ( | ) | 
| std::ostream& operator<< | ( | std::ostream & | out, | |
| const Bitmap & | bitmap | |||
| ) |  [friend] | 
        
Definition at line 86 of file Bitmap.cpp.
 1.5.9