Skip to content

Commit

Permalink
v1.3b
Browse files Browse the repository at this point in the history
- Upgraded version to 1.3b
- Sanitized comparison between mapping pairs in prolongables check
- Removed use of std::string::npos
- nontrivial member is determined by arithmetic rather than counting
- Fix isTrivial member of parihkVector for alphabet sizes greater than 2
- New and faster algorithm for counting occurences of a character in a word for a given alphabet
- Added missing documentation to prefix.hpp
- parihkVector::operator std::string() is now const
- Removed comparison members of parihkVector to use the default instead.
  • Loading branch information
jamesrswift committed Jun 24, 2019
1 parent 2913e37 commit 2c64e17
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 2,789 deletions.
2,565 changes: 0 additions & 2,565 deletions Doxyfile

This file was deleted.

36 changes: 0 additions & 36 deletions Morphism/analysis/Mordreda.out

This file was deleted.

18 changes: 0 additions & 18 deletions Morphism/output/MordecaiA.out

This file was deleted.

18 changes: 0 additions & 18 deletions Morphism/output/MordecaiB.out

This file was deleted.

18 changes: 0 additions & 18 deletions Morphism/output/MordredA.out

This file was deleted.

18 changes: 0 additions & 18 deletions Morphism/output/MordredB.out

This file was deleted.

18 changes: 0 additions & 18 deletions Morphism/output/MoriartyA.out

This file was deleted.

18 changes: 0 additions & 18 deletions Morphism/output/MoriartyB.out

This file was deleted.

18 changes: 0 additions & 18 deletions Morphism/output/MorpheusA.out

This file was deleted.

18 changes: 0 additions & 18 deletions Morphism/output/MorpheusB.out

This file was deleted.

2 changes: 1 addition & 1 deletion asalib/private/asalib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

#include <asalib/public/library.h>

asalib const char* AbelianSquaresAnalysis::BUILD = "1.3";
asalib const char* AbelianSquaresAnalysis::BUILD = "1.3b";
4 changes: 2 additions & 2 deletions asalib/private/morphism.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ asalib morphismOutput AbelianSquaresAnalysis::morphism::RunMorphismSingle(morphi
bool k_uniform = true;
for (auto& morphismPair : input.morphism) {

// Check for prolongables
if (morphismPair.first.front() == morphismPair.second.front()) {
// Check for prolongables (sanitized to lower)
if (tolower(morphismPair.first.front()) == tolower(morphismPair.second.front())) {
output.morphismAnalysis.prolongable.push_back(morphismPair.first);
}

Expand Down
7 changes: 4 additions & 3 deletions asalib/private/prefix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ prefix::substringAnalysisOutput asalib AbelianSquaresAnalysis::prefix::AnalyseSu

// Count second half
types::parihkVector secondHalf = input.alphabet; // copy construct
input.word.countOccurences(input.length / 2, std::string::npos, secondHalf);
input.word.countOccurences(input.length / 2, input.length / 2, secondHalf);

if (firstHalf == secondHalf) {
output.isSquare = true;
Expand Down Expand Up @@ -191,8 +191,9 @@ void asalib AbelianSquaresAnalysis::prefix::SquaresCountTrivials(prefix::prefix
if (square.isTrivial) {
input.trivial++;
}
else {
/*else {
input.nontrivial++;
}
}*/
}
input.nontrivial = input.list.size() - input.trivial;
}
15 changes: 5 additions & 10 deletions asalib/private/word.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ AbelianSquaresAnalysis::types::parihkVector::parihkVector()
bool asalib AbelianSquaresAnalysis::types::parihkVector::isTrivial() const {
unsigned int count = 0;
for (const auto& entry : *this) {
if (entry.second == 0) count++;
if (entry.second != 0) count++;
}
return count == 1; // if a parihk vector of ([0,]*)^2 is tested, isTrivial returns false;
}
Expand All @@ -38,15 +38,10 @@ AbelianSquaresAnalysis::types::parihkVector asalib AbelianSquaresAnalysis::types
}

void AbelianSquaresAnalysis::types::word::countOccurences(size_t offset, size_t count, AbelianSquaresAnalysis::types::parihkVector& out) {
std::string substr = this->substr(offset, count);
for (const auto& character : substr) {
types::parihkVector::iterator it = out.find(character);
if (it != out.end()) {
it->second++;
}
else {
throw new std::exception("Attempt to count occurences into ill-formed parihk vector!");
}
//std::string substr = this->substr(offset, count);
for (auto& alphabetCharacter : out) {
//alphabetCharacter.second = std::count(substr.begin(), substr.end(), alphabetCharacter.first);
alphabetCharacter.second = std::count(this->begin()+offset, this->begin()+offset+count, alphabetCharacter.first);
}
}

Expand Down
Loading

0 comments on commit 2c64e17

Please sign in to comment.