From d208819103ef03100f7164c233db2aaa20acce46 Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Tue, 15 May 2012 14:00:41 +0200 Subject: [PATCH] small fixes in polynomials --- lib/matrix.cpp | 4 ++-- lib/polynomial.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/matrix.cpp b/lib/matrix.cpp index d9fe84c..7ec3157 100644 --- a/lib/matrix.cpp +++ b/lib/matrix.cpp @@ -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); diff --git a/lib/polynomial.cpp b/lib/polynomial.cpp index f29b49a..5e0f1e4 100644 --- a/lib/polynomial.cpp +++ b/lib/polynomial.cpp @@ -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;