42 template <
typename TInteger>
 
   47 template <
typename TInteger>
 
   52 template <
typename TInteger>
 
   57 template <
typename TInteger>
 
   67 template <
typename TInteger>
 
   76 template <
typename TInteger>
 
   85 template <
typename TInteger>
 
   94 template <
typename TInteger>
 
  100   return a < NumberTraits<Integer>::ZERO;
 
  103 template <
typename TInteger>
 
  112 template <
typename TInteger>
 
  118   return a <= NumberTraits<Integer>::ZERO;
 
  121 template <
typename TInteger>
 
  127   if ( isPositiveOrZero( a ) )
 
  133 template <
typename TInteger>
 
  139   return ( a >= b ) ? a : b;
 
  142 template <
typename TInteger>
 
  148   return max( max(a,b), c );
 
  151 template <
typename TInteger>
 
  157   return ( a <= b ) ? a : b;
 
  160 template <
typename TInteger>
 
  166   return min( min(a,b), c );
 
  169 template <
typename TInteger>
 
  180 template <
typename TInteger>
 
  188   if ( isNegative( _m_b ) )
 
  203   if ( isPositive( _m_a ) || isZero( _m_a % _m_b ) )
 
  209 template <
typename TInteger>
 
  217   if ( isNegative( _m_b ) )
 
  232   if ( isNegative( _m_a ) || isZero( _m_a % _m_b ) )
 
  238 template <
typename TInteger>
 
  247   if ( isNegative( _m_b ) )
 
  253   if ( isNotZero( _m_a % _m_b ) )
 
  255       if ( isNegativeOrZero( _m_a ) ) --fl;
 
  256       if ( isPositiveOrZero( _m_a ) ) ++ce;
 
  260 template <
typename TInteger>
 
  268   Integer _m_a0 = max( _m_a, _m_b );
 
  269   Integer _m_a1 = min( _m_a, _m_b );
 
  271   while ( isNotZero( _m_a1 ) )
 
  273     _m_r = _m_a0 % _m_a1;
 
  280 template <
typename TInteger>
 
  288   _m_a0 = max( _m_a, _m_b );
 
  289   _m_a1 = min( _m_a, _m_b );
 
  290   while ( isNotZero( _m_a1 ) )
 
  292     _m_r = _m_a0 % _m_a1;
 
  299 template <
typename TInteger>
 
  308   _m_a0 = max( _m_a, _m_b );
 
  309   _m_a1 = min( _m_a, _m_b );
 
  310   while ( isNotZero( _m_a1 ) )
 
  312     _m_r = _m_a0 % _m_a1;
 
  319 template <
typename TInteger>
 
  326   ASSERT( isPositiveOrZero( a ) && isPositiveOrZero( b ) );
 
  329   while ( isNotZero( _m_a1 ) )
 
  331     getEuclideanDiv( _m_q, _m_r, _m_a0, _m_a1 );
 
  332     quotients.push_back( _m_q );
 
  339 template <
typename TInteger>
 
  340 template <
typename OutputIterator>
 
  347   BOOST_CONCEPT_ASSERT(( boost::OutputIterator< OutputIterator, Integer > ));
 
  348   ASSERT( isPositiveOrZero( a ) && isPositiveOrZero( b ) );
 
  351   while ( isNotZero( _m_a1 ) )
 
  353     getEuclideanDiv( _m_q, _m_r, _m_a0, _m_a1 );
 
  361 template <
typename TInteger>
 
  366             unsigned int k )
 const 
  368   _m_bezout[ 0 ].clear(); 
 
  371   _m_bezout[ 1 ].clear(); 
 
  374   if ( k >= quotients.size() ) 
 
  375     k = (quotients.size() - 1);
 
  376   for ( 
unsigned int i = 0; i <= k; ++i )
 
  378       _m_bezout[ 0 ].push_back( quotients[ i ] * _m_bezout[ 0 ][ i + 1 ]
 
  379                                 + _m_bezout[ 0 ][ i ] );
 
  380       _m_bezout[ 1 ].push_back( quotients[ i ] * _m_bezout[ 1 ][ i + 1 ]
 
  381                                 + _m_bezout[ 1 ][ i ] );
 
  383   _m_v[ 0 ] = _m_bezout[ 0 ].back();
 
  384   _m_v[ 1 ] = _m_bezout[ 1 ].back();
 
  390 template <
typename TInteger>
 
  396   _m_a = 
gcd( p[ 0 ], p[ 1 ] );
 
  401 template <
typename TInteger>
 
  407   _m_a0 = u[ 0 ] * v[ 1 ];
 
  408   _m_a1 = u[ 1 ] * v[ 0 ];
 
  409   return _m_a0 - _m_a1;
 
  412 template <
typename TInteger>
 
  419   cp = u[ 0 ] * v[ 1 ];
 
  420   cp -= u[ 1 ] * v[ 0 ];
 
  423 template <
typename TInteger>
 
  429   _m_a0 = u[ 0 ] * v[ 0 ];
 
  430   _m_a1 = u[ 1 ] * v[ 1 ];
 
  431   return _m_a0 + _m_a1;
 
  434 template <
typename TInteger>
 
  441   dp = u[ 0 ] * v[ 0 ];
 
  442   dp += u[ 1 ] * v[ 1 ];
 
  445 template <
typename TInteger>
 
  454   for ( 
unsigned int i = 0; i < 4; ++i )
 
  455     _m_bezout[ i ].clear();
 
  457   _m_bezout[ 0 ].push_back( 
abs( a ) );
 
  458   _m_bezout[ 0 ].push_back( 
abs( b ) );
 
  466   while( isNotZero( _m_bezout[ 0 ][ k+1 ] ) )
 
  468       _m_bezout[ 1 ].push_back( _m_bezout[ 0 ][ k ] 
 
  469                                 / _m_bezout[ 0 ][ k+1 ] );
 
  470       _m_bezout[ 0 ].push_back( _m_bezout[ 0 ][ k ] 
 
  471                                 % _m_bezout[ 0 ][ k+1 ] );
 
  472       _m_bezout[ 2 ].push_back( _m_bezout[ 2 ][ k ] 
 
  473                                 - _m_bezout[ 1 ][ k+1 ]
 
  474                                 * _m_bezout[ 2 ][ k+1 ] );
 
  475       _m_bezout[ 3 ].push_back( _m_bezout[ 3 ][ k ] 
 
  476                                 - _m_bezout[ 1 ][ k+1 ]
 
  477                                 *_m_bezout[ 3 ][ k+1 ] );
 
  481   _m_v[ 0 ] = _m_bezout[ 2 ][ k ];
 
  482   _m_v[ 1 ] = _m_bezout[ 3 ][ k ];
 
  484   if ( isNegative( a ) ) _m_v[ 0 ] = -_m_v[ 0 ];
 
  485   if ( isNegative( b ) ) _m_v[ 1 ] = -_m_v[ 1 ];
 
  490 template <
typename TInteger>
 
  500   getDotProduct( _m_c0, p, N );
 
  501   getDotProduct( _m_c1, u, N );
 
  503   fl = floorDiv( _m_c2, _m_c1 );
 
  504   ce = ceilDiv( _m_c2, _m_c1 );
 
  508 template <
typename TInteger>
 
  516                  bool compute_v )
 const 
  522       getDotProduct( _m_c0, _m_v0, N );
 
  531   getCoefficientIntersection( _m_a0, _m_a1, 
 
  535   ASSERT( N2.dot( A + v ) <= c2 );
 
  536   ASSERT( N2.dot( A + v + u ) > c2 );
 
  539 template <
typename TInteger>
 
  545   _m_a = 
gcd( p[ 0 ], p[ 1 ] );
 
  546   _m_r = 
gcd( _m_a, p[ 2 ] );
 
  550 template <
typename TInteger>
 
  556   _m_a0 = u[ 0 ] * v[ 0 ];
 
  557   _m_a0 += u[ 1 ] * v[ 1 ];
 
  558   _m_a0 += u[ 2 ] * v[ 2 ];
 
  562 template <
typename TInteger>
 
  569   dp =  u[ 0 ] * v[ 0 ];
 
  570   dp += u[ 1 ] * v[ 1 ];
 
  571   dp += u[ 2 ] * v[ 2 ];
 
  582 template <
typename TInteger>
 
  587   out << 
"[IntegerComputer]";
 
  594 template <
typename TInteger>
 
  607 template <
typename TInteger>
 
  613   object.selfDisplay( out );