本文整理汇总了C++中CWord::Inverse方法的典型用法代码示例。如果您正苦于以下问题:C++ CWord::Inverse方法的具体用法?C++ CWord::Inverse怎么用?C++ CWord::Inverse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CWord
的用法示例。
在下文中一共展示了CWord::Inverse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LongestPieceFixedStart
CWord::size_type LongestPieceFixedStart(const CWord& w) {
CWord::size_type result = 1;
auto shifted = w;
shifted.CyclicLeftShift();
while (shifted != w) {
result = std::max(result, CommonPrefixLength(w, shifted));
if (result * 6 >= w.size()) {
return result;
}
shifted.CyclicLeftShift();
}
auto inverse = w.Inverse();
if (LeastCyclicShift(inverse) == LeastCyclicShift(w)) {
return result;
}
result = std::max(result, CommonPrefixLength(w, inverse));
inverse.CyclicLeftShift();
while (inverse != w.Inverse()) {
result = std::max(result, CommonPrefixLength(w, inverse));
if (result * 6 >= w.size()) {
return result;
}
inverse.CyclicLeftShift();
}
return result;
}
示例2: ConjugationInverseNormalForm
CWord ConjugationInverseNormalForm(const CWord& w) {
assert(w.Empty() || w.GetBack().Inverse() != w.GetFront());
auto min_w = LeastCyclicPermutation(w);
auto min_i = LeastCyclicPermutation(w.Inverse());
if (min_w < min_i) {
return min_w;
} else {
return min_i;
}
}