5050
5151#ifdef HAVE_FACTORY
5252#include < polys/clapsing.h>
53+ #include < polys/clapconv.h>
54+ #include < factory/factory.h>
5355#endif
5456
5557#include " ext_fields/transext.h"
@@ -89,7 +91,7 @@ static const n_coeffType ID = n_transExt;
8991
9092
9193
92- extern omBin fractionObjectBin = omGetSpecBin(sizeof (fractionObject));
94+ omBin fractionObjectBin = omGetSpecBin(sizeof (fractionObject));
9395
9496// / forward declarations
9597BOOLEAN ntGreaterZero (number a, const coeffs cf);
@@ -304,8 +306,8 @@ number ntInit(int i, const coeffs cf)
304306 {
305307 fraction result = (fraction)omAlloc0Bin (fractionObjectBin);
306308 NUM (result) = p_ISet (i, ntRing);
307- DEN (result) = NULL ;
308- COM (result) = 0 ;
309+ // DEN(result) = NULL; // done by omAlloc0Bin
310+ // COM(result) = 0; // done by omAlloc0Bin
309311 return (number)result;
310312 }
311313}
@@ -1198,6 +1200,26 @@ void ntKillChar(coeffs cf)
11981200 if ((--cf->extRing ->ref ) == 0 )
11991201 rDelete (cf->extRing );
12001202}
1203+ #ifdef HAVE_FACTORY
1204+ number ntConvFactoryNSingN ( const CanonicalForm n, const coeffs cf)
1205+ {
1206+ if (n.isZero ()) return NULL ;
1207+ poly p=convFactoryPSingP (n,ntRing);
1208+ fraction result = (fraction)omAlloc0Bin (fractionObjectBin);
1209+ NUM (result) = p;
1210+ // DEN(result) = NULL; // done by omAlloc0Bin
1211+ // COM(result) = 0; // done by omAlloc0Bin
1212+ return (number)result;
1213+ }
1214+ CanonicalForm ntConvSingNFactoryN ( number n, BOOLEAN setChar, const coeffs cf )
1215+ {
1216+ ntTest (n);
1217+ if (IS0 (n)) return CanonicalForm (0 );
1218+
1219+ fraction f = (fraction)n;
1220+ return convSingPFactoryP (NUM (f),ntRing);
1221+ }
1222+ #endif
12011223
12021224BOOLEAN ntInitChar (coeffs cf, void * infoStruct)
12031225{
@@ -1215,6 +1237,7 @@ BOOLEAN ntInitChar(coeffs cf, void * infoStruct)
12151237
12161238 cf->extRing = e->r ;
12171239 cf->extRing ->ref ++; // increase the ref.counter for the ground poly. ring!
1240+ cf->factoryVarOffset = cf->extRing ->cf ->factoryVarOffset +rVar (cf->extRing );
12181241
12191242 /* propagate characteristic up so that it becomes
12201243 directly accessible in cf: */
@@ -1260,6 +1283,9 @@ BOOLEAN ntInitChar(coeffs cf, void * infoStruct)
12601283 PrintS (" // Warning: The 'factory' module is not available.\n " );
12611284 PrintS (" // Hence gcd's cannot be cancelled in any\n " );
12621285 PrintS (" // computed fraction!\n " );
1286+ #else
1287+ cf->convFactoryNSingN =ntConvFactoryNSingN;
1288+ cf->convSingNFactoryN =ntConvSingNFactoryN;
12631289#endif
12641290
12651291 return FALSE ;
0 commit comments