本文整理汇总了C++中Basis::getRank方法的典型用法代码示例。如果您正苦于以下问题:C++ Basis::getRank方法的具体用法?C++ Basis::getRank怎么用?C++ Basis::getRank使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Basis
的用法示例。
在下文中一共展示了Basis::getRank方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: count
QList<int> FnWord::abelianization(const Basis &basis) const {
// returns an integer list of basis elements exponent sums
int rank = basis.getRank();
QList<int> abelian_image;
for(int i = 0; i < rank; i++)
abelian_image.append(count(basis.at(2*i)) - count(basis.at(2*i+1)));
return abelian_image;
}
示例2: ijBasis
QList<int> FnWord::stepTwoNilpotentNormalForm(const Basis & basis) const {
// returns an integer list of the two step nilpotent normal form of the element
int rank = basis.getRank();
QList<int> nilpotent_image = abelianization(basis);
QList<int> commutator_portion;
int index = 0;
for(int i = 0; i < rank; i++) {
for(int j = i+1; j < rank; j++) {
QString ijBasis(basis);
ijBasis.remove(2*j,2);
ijBasis.remove(2*i,2);
FnWord ijWord(*this);
ijWord.remove(QRegExp("["+ijBasis+"]"));
ijWord.tighten();
// integrate -y dx
int integral = 0;
commutator_portion.append(0);
for(int k = 0; k < ijWord.length(); k++) {
if(ijWord.at(k) == basis.at(2*i))
commutator_portion[index] += integral;
if(ijWord.at(k) == basis.at(2*i + 1))
commutator_portion[index] -= integral;
if(ijWord.at(k) == basis.at(2*j))
integral -= 1;
if(ijWord.at(k) == basis.at(2*j + 1))
integral += 1;
}
index++;
}
}
nilpotent_image.append(commutator_portion);
return nilpotent_image;
}
示例3: whiteheadGraph
FnGraph FnWord::whiteheadGraph(const Basis &basis) const {
FnGraph whitehead;
QString edge;
int i;
for(i = 0; i < 2*basis.getRank(); i++)
whitehead.addVertex(basis.at(i));
for(i = 0; i < length()-1; i++)
whitehead.addEdge(edge.setNum(i),at(i),basis.inverse(at(i+1)));
whitehead.addEdge(edge.setNum(i),at(i),basis.inverse(at(0)));
return whitehead;
}
示例4: minimizeLength
FnMap minimizeLength(const FnWord &u, const Basis &basis)
{
/* Returns an automorphism phi such that phi(u) has minimal
length. */
int r = basis.getRank();
FnMap phi(r);
if (u == Id) return phi;
if (u.length() == 1) return phi;
int old_norm,new_norm;
FnWord u_min(u),tmp;
FnMap whAuto(r);
QList<WhiteheadData> whAutos = whiteheadAutos(basis);
QListIterator<WhiteheadData> move(whAutos);
bool reduced_norm = true;
while (reduced_norm) {
old_norm = u_min.length();
new_norm = old_norm;
move.toFront();
while (old_norm <= new_norm && move.hasNext()) {
whAuto = whitehead(move.next(),basis);
tmp = whAuto(u_min);
new_norm = tmp.length();
}
if (new_norm < old_norm) {
u_min = tmp;
phi = whAuto*phi;
} else
reduced_norm = false;
} // end while (reduced_norm)
// now u_min = phi(u)
return phi;
}
示例5: whiteheadProblem
FnMap whiteheadProblem(const FnWord &u, const FnWord &v,
const Basis &basis)
{
/* Determines if there is an automorphism phi such that u = phi(v).
If yes, the map is returned. Else, the Fail map is returned. */
int i,r = basis.getRank();
int min_len;
FnWord tmp,v_tmp;
FnWord u_min,v_min;
FnMap phi(r);
FnMap whAuto(r);
FnMap rho(r),sigma(r),tau(r);
FnMap phi_u(r),phi_v(r),phi_u_inv(r);
// get minimal length representatives
phi_u = minimizeLength(u,basis);
phi_v = minimizeLength(v,basis);
u_min = phi_u(u);
v_min = phi_v(v);
// easy case, minimum lengths are different
if (u_min.length() != v_min.length()) {
phi.fail();
return phi;
}
min_len = u_min.length();
phi_u_inv = phi_u.isAutomorphism();
// other easy case, u_min = v_min
if (u_min == v_min) { // u = phi_u^-1 (phi_v(v))
phi = phi_u_inv*phi_v;
return phi;
}
// now the hard case... need to find all words of length u_min related
// by Whitehead moves and permutations...
// build Whitehead data
QList<WhiteheadData> whAutos = whiteheadAutos(basis);
QListIterator<WhiteheadData> move(whAutos);
// define the permutation automorphisms
for (i = 0; i < r-1; i++) { // i -> i+1
rho.insert(basis.at(2*i),FnWord(basis.at(2*i + 2)));
rho.insert(basis.at(2*i + 1),FnWord(basis.at(2*i + 3)));
}
rho.insert(basis.at(2*r - 2),FnWord(basis.at(0)));
rho.insert(basis.at(2*r - 1),FnWord(basis.at(1)));
sigma.insert(basis.at(0),FnWord(basis.at(1))); // a -> A
sigma.insert(basis.at(1),FnWord(basis.at(0))); // A -> a
tau.insert(basis.at(0),FnWord(basis.at(2))); // a -> b
tau.insert(basis.at(1),FnWord(basis.at(3))); // A -> B
tau.insert(basis.at(2),FnWord(basis.at(0))); // b -> a
tau.insert(basis.at(3),FnWord(basis.at(1))); // B -> A
int n = 0;
QList<FnWord> v_rel;
QHash<FnWord, FnMap> wh_v; // wh_v[x](v_min) = x
v_rel.append(v_min);
wh_v.insert(v_min,FnMap(r));
// looped over words with the same length as v
while (n < v_rel.size()) {
v_tmp = v_rel.at(n++);
move.toFront();
// loop over Whitehead moves
while (move.hasNext()) {
whAuto = whitehead(move.next(),basis);
tmp = whAuto(v_tmp);
if (tmp.length() == min_len) {
if (!v_rel.contains(tmp)) {
v_rel.append(tmp);
wh_v.insert(tmp,whAuto*wh_v.value(v_tmp));
}
if (tmp == u_min) { // found it!
phi_v = wh_v.value(tmp)*phi_v; // phi_u(u) = tmp = phi_v(v)
phi = phi_u_inv*phi_v; // u = phi_u^-1 phi_v(v)
return phi;
}
}
} // end while (move.hasNext())
// loop over permutation moves, these don't change length
tmp = rho(v_tmp);
if (!v_rel.contains(tmp)) {
v_rel.append(tmp);
wh_v.insert(tmp,rho*wh_v.value(v_tmp));
}
if (tmp == u_min) { // found it!
phi_v = wh_v.value(tmp)*phi_v; // phi_u(u) = tmp = phi_v(v)
phi = phi_u_inv*phi_v; // u = phi_u^-1 phi_v(v)
//.........这里部分代码省略.........