Skip to content

Commit 4f391f9

Browse files
committed
fix: issues with building factory without NTL
1 parent 4d6e51a commit 4f391f9

6 files changed

Lines changed: 28 additions & 6 deletions

File tree

factory/algext.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,10 +590,10 @@ void tryBrownGCD( const CanonicalForm & F, const CanonicalForm & G, const Canoni
590590
fail = true;
591591
}
592592

593-
#ifdef HAVE_NTL
594593
static CanonicalForm
595594
myicontent ( const CanonicalForm & f, const CanonicalForm & c )
596595
{
596+
#ifdef HAVE_NTL
597597
if (f.isOne() || c.isOne())
598598
return 1;
599599
if ( f.inBaseDomain() && c.inBaseDomain())
@@ -621,8 +621,10 @@ myicontent ( const CanonicalForm & f, const CanonicalForm & c )
621621
g = myicontent( i.coeff(), g );
622622
return g;
623623
}
624-
}
624+
#else
625+
return 1;
625626
#endif
627+
}
626628

627629
CanonicalForm
628630
myicontent ( const CanonicalForm & f )

factory/cf_factor.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@ CFFList factorize ( const CanonicalForm & f, bool issqrfree )
638638
}
639639
else
640640
{
641+
#ifdef HAVE_NTL
641642
On (SW_RATIONAL);
642643
if (issqrfree)
643644
{
@@ -649,6 +650,9 @@ CFFList factorize ( const CanonicalForm & f, bool issqrfree )
649650
else
650651
F = ratFactorize (fz);
651652
Off (SW_RATIONAL);
653+
#else
654+
ASSERT( 0, "multivariate factorization without NTL not implemented" );
655+
#endif
652656
}
653657

654658
if ( on_rational )

factory/cf_gcd.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,13 @@ CanonicalForm chinrem_gcd ( const CanonicalForm & FF, const CanonicalForm & GG )
12761276
}
12771277
//printf("try p=%d\n",p);
12781278
setCharacteristic( p );
1279+
#ifdef HAVE_NTL
12791280
Dp = GCD_small_p (mapinto (f), mapinto (g), cofp, cogp);
1281+
#else
1282+
Dp= gcd_poly (mapinto (f), mapinto (g));
1283+
cofp= mapinto (f)/Dp;
1284+
cogp= mapinto (g)/Dp;
1285+
#endif
12801286
Dp /=Dp.lc();
12811287
cofp /= lc (cofp);
12821288
cogp /= lc (cogp);

factory/cf_gcd_smallp.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "cf_reval.h"
3131
#include "facHensel.h"
3232
#include "cfNewtonPolygon.h"
33+
#include "cf_algorithm.h"
3334

3435
// iinline helper functions:
3536
#include "cf_map_ext.h"
@@ -41,10 +42,8 @@
4142

4243
#include "cf_gcd_smallp.h"
4344

44-
#ifdef HAVE_NTL
45-
46-
TIMING_DEFINE_PRINT(gcd_recursion);
47-
TIMING_DEFINE_PRINT(newton_interpolation);
45+
TIMING_DEFINE_PRINT(gcd_recursion)
46+
TIMING_DEFINE_PRINT(newton_interpolation)
4847

4948
bool
5049
terminationTest (const CanonicalForm& F, const CanonicalForm& G,
@@ -68,6 +67,8 @@ terminationTest (const CanonicalForm& F, const CanonicalForm& G,
6867
return false;
6968
}
7069

70+
#ifdef HAVE_NTL
71+
7172
static const double log2exp= 1.442695041;
7273

7374
/// compressing two polynomials F and G, M is used for compressing,

factory/facFqBivar.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "facFqSquarefree.h"
2626
#include "cf_map.h"
2727
#include "cfNewtonPolygon.h"
28+
#include "fac_util.h"
2829

2930
static const double log2exp= 1.442695041;
3031

factory/fac_ezgcd.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "cf_map.h"
3030
#include "facHensel.h"
3131

32+
#ifdef HAVE_NTL
3233
static
3334
int compress4EZGCD (const CanonicalForm& F, const CanonicalForm& G, CFMap & M,
3435
CFMap & N, int& both_non_zero)
@@ -672,11 +673,18 @@ ezgcd ( const CanonicalForm & FF, const CanonicalForm & GG, REvaluation & b,
672673
cand /= icontent (cand);
673674
return N (d*cand);
674675
}
676+
#endif
675677

676678
CanonicalForm
677679
ezgcd ( const CanonicalForm & FF, const CanonicalForm & GG )
678680
{
681+
#ifdef HAVE_NTL
679682
REvaluation b;
680683
return ezgcd( FF, GG, b, false );
684+
#else
685+
Off (SW_USE_EZGCD);
686+
return gcd (FF, GG);
687+
On (SW_USE_EZGCD);
688+
#endif
681689
}
682690

0 commit comments

Comments
 (0)