30 ASSERT (integer != 0 && integer != 1 && integer != -1,
31 "non-zero non-unit expected");
40 while ((i != 1) && (i%2 == 0))
47 result=
new int [
exp];
48 for (
int k= 0;
k <
exp;
k++)
58 while ((i != 1) && (j < 31937))
61 while ((i != 1) && (i%next_prime == 0))
69 result=
new int [length +
exp];
70 for (
int k= 0;
k < length;
k++)
72 for (
int k= 0;
k <
exp;
k++)
73 result [
k + length]= next_prime;
81 ASSERT (j < 31397,
"integer factorizer ran out of primes");
87 int*
makeDistinct (
int* factors,
const int factors_length,
int& length)
90 int*
result=
new int [length];
92 result[0]= factors [0];
93 for (
int i= 1;
i < factors_length;
i++)
95 if (factors[
i - 1] != factors[
i])
98 result=
new int [length + 1];
99 for (
int j= 0;
j < length;
j++)
101 result[length]= factors[
i];
116 int prime_factors_length;
117 int distinct_factors_length;
119 int* distinct_factors=
makeDistinct (prime_factors, prime_factors_length,
120 distinct_factors_length);
125 for (
int i= 0;
i < distinct_factors_length;
i++)
128 prod *= distinct_factors[
i];
factory's class for variables
bool isPrimitive(const Variable &alpha, bool &fail)
checks if alpha is a primitive element, alpha is assumed to be an algebraic variable over some finite...
const CanonicalForm CFMap CFMap int &both_non_zero int n
CanonicalForm cyclotomicPoly(int n, bool &fail)
compute the n-th cyclotomic polynomial, function may fail if integer_factorizer fails to factorize n ...
int status int void * buf
int * integerFactorizer(const long integer, int &length, bool &fail)
integer factorization using table look-ups, function may fail if integer contains primes which exceed...
int ipower(int b, int m)
int ipower ( int b, int m )
static int * makeDistinct(int *factors, const int factors_length, int &length)
make prime factorization distinct
#define ASSERT(expression, message)
CanonicalForm getMipo(const Variable &alpha, const Variable &x)