Skip to content

Commit 050d1b7

Browse files
committed
fix: wrong/unneccessary asserts
1 parent a76d6fe commit 050d1b7

7 files changed

Lines changed: 13 additions & 15 deletions

File tree

factory/cf_char.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ int getExp()
7373

7474
int getGFDegree()
7575
{
76-
ASSERT( theDegree > 0, "not in GF(q)" );
76+
//ASSERT( theDegree > 0, "not in GF(q)" );
7777
return theDegree;
7878
}
7979

factory/cf_gcd_smallp.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3991,7 +3991,7 @@ Evaluation optimize4Lift (const CanonicalForm& F, CFMap & M,
39913991

39923992
Evaluation result= Evaluation (A.min(), A.max());
39933993
ASSERT (A.min() == 2, "expected A.min() == 2");
3994-
ASSERT (A.max() == n, "expected A.max() == n");
3994+
ASSERT (A.max() >= n, "expected A.max() >= n");
39953995
int max_deg;
39963996
int k= n;
39973997
int l= 1;

factory/cf_map_ext.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ CanonicalForm mapUp (const CanonicalForm& F, const CanonicalForm& G,
286286
counter++;
287287
if (buf == buf2) break;
288288
}
289-
ASSERT (counter >= bound, "alpha is not primitive");
289+
ASSERT (counter <= bound, "alpha is not primitive");
290290
if (pos == 0)
291291
{
292292
H_power= buf*power (H, counter);

factory/facFqBivar.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ CFList
144144
uniFactorizer (const CanonicalForm& A, const Variable& alpha, const bool& GF)
145145
{
146146
Variable x= A.mvar();
147-
ASSERT (A.isUnivariate(), "univariate polynomial expected");
147+
ASSERT (A.isUnivariate() || A.inCoeffDomain(),
148+
"univariate polynomial expected or constant expected");
148149
CFFList factorsA;
149150
ZZ p= to_ZZ (getCharacteristic());
150151
ZZ_p::init (p);

factory/facFqBivarUtil.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,8 @@ writeInMatrix (CFMatrix& M, const CFArray& A, const int column,
548548
const int startIndex
549549
)
550550
{
551-
ASSERT (A.size () - startIndex > 0, "wrong starting index");
552-
ASSERT (A.size () - startIndex == M.rows(), "wrong starting index");
551+
ASSERT (A.size () - startIndex >= 0, "wrong starting index");
552+
ASSERT (A.size () - startIndex <= M.rows(), "wrong starting index");
553553
ASSERT (column > 0 && column <= M.columns(), "wrong column");
554554
if (A.size() - startIndex <= 0) return;
555555
int j= 1;
@@ -559,7 +559,7 @@ writeInMatrix (CFMatrix& M, const CFArray& A, const int column,
559559

560560
CFArray getCoeffs (const CanonicalForm& F, const int k)
561561
{
562-
ASSERT (F.isUnivariate(), "univariate input expected");
562+
ASSERT (F.isUnivariate() || F.inCoeffDomain(), "univariate input expected");
563563
if (degree (F, 2) < k)
564564
return CFArray();
565565

@@ -582,7 +582,7 @@ CFArray getCoeffs (const CanonicalForm& F, const int k)
582582

583583
CFArray getCoeffs (const CanonicalForm& F, const int k, const Variable& alpha)
584584
{
585-
ASSERT (F.isUnivariate(), "univariate input expected");
585+
ASSERT (F.isUnivariate() || F.inCoeffDomain(), "univariate input expected");
586586
if (degree (F, 2) < k)
587587
return CFArray ();
588588

@@ -625,7 +625,7 @@ getCoeffs (const CanonicalForm& G, const int k, const int l, const int degMipo,
625625
const Variable& alpha, const CanonicalForm& evaluation,
626626
const mat_zz_p& M)
627627
{
628-
ASSERT (G.isUnivariate(), "univariate input expected");
628+
ASSERT (G.isUnivariate() || G.inCoeffDomain(), "univariate input expected");
629629
CanonicalForm F= G (G.mvar() - evaluation, G.mvar());
630630
if (F.isZero())
631631
return CFArray ();

factory/facMul.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2421,7 +2421,6 @@ newtonDiv (const CanonicalForm& F, const CanonicalForm& G, const CanonicalForm&
24212421
M)
24222422
{
24232423
ASSERT (getCharacteristic() > 0, "positive characteristic expected");
2424-
ASSERT (CFFactory::gettype() != GaloisFieldDomain, "no GF expected");
24252424

24262425
CanonicalForm A= mod (F, M);
24272426
CanonicalForm B= mod (G, M);
@@ -2574,16 +2573,15 @@ void divrem21 (const CanonicalForm& F, const CanonicalForm& G, CanonicalForm& Q,
25742573
R= A;
25752574
return;
25762575
}
2577-
ASSERT (2*degB > degA, "expected degree (F, 1) < 2*degree (G, 1)");
25782576
if (degB < 1)
25792577
{
25802578
divrem (A, B, Q, R);
25812579
Q= mod (Q, M);
25822580
R= mod (R, M);
25832581
return;
25842582
}
2585-
25862583
int m= (int) ceil ((double) (degB + 1)/2.0) + 1;
2584+
ASSERT (4*m >= degA, "expected degree (F, 1) < 2*degree (G, 1)");
25872585
CFList splitA= split (A, m, x);
25882586
if (splitA.length() == 3)
25892587
splitA.insert (0);
@@ -2646,7 +2644,6 @@ void divrem32 (const CanonicalForm& F, const CanonicalForm& G, CanonicalForm& Q,
26462644
R= A;
26472645
return;
26482646
}
2649-
ASSERT (3*(degB/2) > degA, "expected degree (F, 1) < 3*(degree (G, 1)/2)");
26502647
if (degB < 1)
26512648
{
26522649
divrem (A, B, Q, R);
@@ -2655,7 +2652,7 @@ void divrem32 (const CanonicalForm& F, const CanonicalForm& G, CanonicalForm& Q,
26552652
return;
26562653
}
26572654
int m= (int) ceil ((double) (degB + 1)/ 2.0);
2658-
2655+
ASSERT (3*m > degA, "expected degree (F, 1) < 3*degree (G, 1)");
26592656
CFList splitA= split (A, m, x);
26602657
CFList splitB= split (B, m, x);
26612658

factory/variable.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static CanonicalForm conv2mipo ( const CanonicalForm & mipo, const Variable alph
160160

161161
Variable rootOf( const CanonicalForm & mipo, char name )
162162
{
163-
ASSERT (mipo.inPolyDomain() && mipo.isUnivariate(), "not a legal extension");
163+
ASSERT (mipo.isUnivariate(), "not a legal extension");
164164

165165
int l;
166166
if ( var_names_ext == 0 ) {

0 commit comments

Comments
 (0)