// finds longest head of p2 // that can be multiplied by p1 on the left ThRightNormalForm::transformationResult ThRightNormalForm::transform( int theRank , Permutation& p1 , Permutation& p2 ) { transformationResult res = TWO_MULTIPLIERS; const Permutation omega = Permutation::getHalfTwistPermutation( theRank ); Permutation p3 = p1.RightGCD( omega * -p2 ); if( p3==p1 ) res = ONE_MULTIPLIER; if( p3.isTrivial( ) ) res = NO_CHANGE; p2 = p3 * p2; p1 *= -p3; return res; }