Exemplo n.º 1
0
unsigned long staticity( method const& m )
{
  unsigned long s = 0ul; //1ul;
  for ( int i=0, b=m.bells(); i!=b-1; ++i)
  {
    int j=0, l=m.size();
    while ( j!=l && ( m[j].findswap(i) || 
                      m[j].findplace(i) && m[j].findplace(i+1) ) ) 
      ++j;
    if (j==l) 
      return static_cast<unsigned long>(-1);

    for ( int k=j; k<j+l; ++k )
    {
      int k0=k;
      while ( k!=j+l && ( m[k%l].findswap(i) || 
                          m[k%l].findplace(i) && m[k%l].findplace(i+1) ) )
        ++k;
      if (k!=k0) {
        // s *= ipower( 2, k-k0-1 );
        s += k-k0-1;
      }
    }
  }
  return s;
}
Exemplo n.º 2
0
string tenors_together_coursing_order( const method& m )
{
  const row lh( m.lh() );

  int i(0);
  bell b( m.bells() - 1 );
  do {
    b *= lh, ++i;
    assert( i <= m.bells() );
  } while ( b < m.bells() - 2 );



  if ( b == m.bells() - 1 ) // 7 and 8 are in different orbits
    throw runtime_error( "Unable to get a tenors together coursing order" );
  
  assert( b == m.bells() - 2 );

  row cg(lh);
  for ( int j=1; j<i; ++j ) cg *= lh;

  make_string ms;  
  ms << b;

  do {
    ms << (b *= cg);
  } while ( b != m.bells() - 1 );

  return ms;
}