small fixes in polynomials
This commit is contained in:
parent
0db682e5df
commit
d208819103
|
@ -88,14 +88,14 @@ void matrix::generate_random_invertible (uint size, prng & rng)
|
|||
{
|
||||
matrix lt, ut;
|
||||
uint i, j;
|
||||
// random lower triagonal
|
||||
// random lower triangular
|
||||
lt.resize (size);
|
||||
for (i = 0; i < size; ++i) {
|
||||
lt[i].resize (size);
|
||||
lt[i][i] = 1;
|
||||
for (j = i + 1; j < size; ++j) lt[i][j] = rng.random (2);
|
||||
}
|
||||
// random upper triagonal
|
||||
// random upper triangular
|
||||
ut.resize (size);
|
||||
for (i = 0; i < size; ++i) {
|
||||
ut[i].resize (size);
|
||||
|
|
|
@ -24,7 +24,7 @@ bool polynomial::zero() const
|
|||
bool polynomial::one() const
|
||||
{
|
||||
if (degree() != 0) return false;
|
||||
return item (0) == 1;
|
||||
return (item (0) == 1) ? true : false;
|
||||
}
|
||||
|
||||
void polynomial::add (const polynomial&f, gf2m&fld)
|
||||
|
@ -123,7 +123,7 @@ bool polynomial::is_irreducible (gf2m&fld) const
|
|||
t.add (xmodf, fld);
|
||||
|
||||
t = t.gcd (*this, fld);
|
||||
if (!t.one() )
|
||||
if (t.degree() > 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue