当前位置: 首页>>代码示例>>C++>>正文


C++ Permutation::geodesicWord方法代码示例

本文整理汇总了C++中Permutation::geodesicWord方法的典型用法代码示例。如果您正苦于以下问题:C++ Permutation::geodesicWord方法的具体用法?C++ Permutation::geodesicWord怎么用?C++ Permutation::geodesicWord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Permutation的用法示例。


在下文中一共展示了Permutation::geodesicWord方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getShortWord

Word ThRightNormalForm::getShortWord( ) const
{
  Word result;
  Permutation omega = Permutation::getHalfTwistPermutation( getRank( ) );
  int power = getPower( );

  if( power<0 ) {

    const list< Permutation >& decomp = getDecomposition( );
    list<Permutation>:: const_iterator it = decomp.begin( );
    for( int j=0 ; it!=decomp.end( ) ; ++it, ++j ) {
      int n = j - decomp.size( ) - power;
      if( n<0 ) {
	vector< int > gd = (*it).geodesic();
	for( size_t t=0 ; t<gd.size() ; ++t )
	  result.push_back( gd[t]+1 );
      } else {
	
	Permutation p = ( n%2 == 1 ? (*it).inverse() * omega : omega * (*it).inverse() );
	
	vector<int> gd = p.geodesic();
	for( int t=gd.size( )-1 ; t>=0 ; --t )
	  result.push_back( -gd[t]-1 );
      }
    }
    Word omega_w = Word(omega.geodesicWord( ));
    omega_w = -omega_w;
    for( int j=decomp.size( ) ; j<-power ; ++j )
      result = omega_w*result;
  } else
    result = getWord( );
  
  return result;
}
开发者ID:stevens-crag,项目名称:crag,代码行数:34,代码来源:ThRightNormalForm.cpp

示例2: getReducedWord

Word ThLeftNormalForm::getReducedWord() const {
  if (theOmegaPower >= 0 || theDecomposition.size() == 0)
    return getWord();

  const auto p = -theOmegaPower;
  const auto d = theDecomposition.size();
  const auto a = p < d ? p : d;

  Word result;

  // 1. Process omega
  const Permutation omega = Permutation::getHalfTwistPermutation(theRank);
  Word omegaWord = Word(omega.geodesicWord());
  omegaWord = -omegaWord;
  result = omegaWord.power(p - a);

  // 2. Cancel omega^-1 with positive permutations
  auto it = theDecomposition.begin();
  for (int i = 0; i < a; ++i, ++it) {
    auto perm = (-(*it)) * omega;
    if ((a - i - 1) % 2 != 0)
      perm = perm.flip();
    result *= -Word(perm.geodesicWord());
  }
  // 3. process the rest of positive permutations
  for (; it != theDecomposition.end(); ++it) {
    result *= Word((*it).geodesicWord());
  }

  return result;
}
开发者ID:stevens-crag,项目名称:crag,代码行数:31,代码来源:ThLeftNormalForm.cpp

示例3: getWord

Word ThLeftNormalForm::getWord() const {
  Word result;
  // A. Take care of Deltas
  if( theOmegaPower!=0 ) {
    const Permutation omega = Permutation::getHalfTwistPermutation( theRank );
    Word omegaWord = Word(omega.geodesicWord());
    if( theOmegaPower<0 )
      omegaWord = -omegaWord;
    result = omegaWord.power(abs(theOmegaPower));
  }
  
  // B. Take care of permutation braids
  for (const auto &d : theDecomposition) {
    result *= Word(d.geodesicWord());
  }
  
  return result;
}
开发者ID:stevens-crag,项目名称:crag,代码行数:18,代码来源:ThLeftNormalForm.cpp


注:本文中的Permutation::geodesicWord方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。