Go to the documentation of this file.Go to the SVN repository for this file.
1 #ifndef ALGO_BLAST_GUMBEL_PARAMS__INCLUDED_NJN_INTEGER
2 #define ALGO_BLAST_GUMBEL_PARAMS__INCLUDED_NJN_INTEGER
71 Int abs_j = j >= 0 ? j : -j;
80 Int k = (
i >= 0 ?
i : -
i) % abs_j;
81 return k == 0 ? k : abs_j - k;
94 Int abs_i = maximum <Int> (i_ >= 0 ? i_ : -i_, j_ >= 0 ? j_ : -j_);
95 Int abs_j = minimum <Int> (i_ >= 0 ? i_ : -i_, j_ >= 0 ? j_ : -j_);
100 remainder = mod <Int> (abs_i, abs_j);
108 template <
class Int,
class ConstIntegerPtr>
110 ConstIntegerPtr begin_,
111 ConstIntegerPtr end_)
115 if (begin_ == end_)
return 0;
119 for (ConstIntegerPtr k = begin_ + 1; k != end_; k++)
131 return mod <Int> (
i, 2) == 0 ? 1 : -1;
134 template <
class Real,
class Int>
141 Njn::IoUtil::abort (
"Int::integerPower <class Real, class Int> : negative exponent of zero");
156 for (
i =
n > 0 ?
n : -
n;
i > 0 ;
i /= 2)
174 template <
class Real,
class Un
signedInteger>
190 UnsignedInteger
i = 0;
192 for (
i =
n;
i > 0 ;
i /= 2)
204 template <
class Int,
class IntTwo>
211 return n == 0 ? 1 : 0;
217 for (
i =
n > 0 ?
n : -
n;
i > 0 ;
i /= 2)
static Int8 gcd(Int8 x, Int8 y)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
The NCBI C++/STL use hints.
Int euclidAlgorithm(Int i_, Int j_)
Int intPower(Int x, IntTwo n)
Int maximum(Int i, Int j)
Real integerPower(Real x, Int n)
Int minimum(Int i, Int j)
Real integerPositivePower(Real x, UnsignedInteger n)
Int euclidAlgorithmVector(ConstIntegerPtr begin_, ConstIntegerPtr end_)