diff options
Diffstat (limited to 'src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Field_Zp.h')
-rw-r--r-- | src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Field_Zp.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Field_Zp.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Field_Zp.h index 419bd2eb..5d0c9f9f 100644 --- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Field_Zp.h +++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology/Field_Zp.h @@ -46,8 +46,8 @@ class Field_Zp { add_id_all(0) { } - void init(uint16_t charac) { - assert(charac != 0); // division by zero + void init(int charac) { + assert(charac > 0); // division by zero + non negative values Prime = charac; inverse_.clear(); inverse_.reserve(charac); @@ -62,7 +62,7 @@ class Field_Zp { /** Set x <- x + w * y*/ Element plus_times_equal(const Element& x, const Element& y, const Element& w) { - assert(Prime != 0); // division by zero + assert(Prime > 0); // division by zero + non negative values Element result = (x + w * y) % Prime; if (result < 0) result += Prime; @@ -98,18 +98,18 @@ class Field_Zp { /** Returns -x * y.*/ Element times_minus(Element x, Element y) { - assert(Prime != 0); // division by zero + assert(Prime > 0); // division by zero + non negative values Element out = (-x * y) % Prime; return (out < 0) ? out + Prime : out; } /** \brief Returns the characteristic \f$p\f$ of the field.*/ - const uint16_t& characteristic() const { + const int& characteristic() const { return Prime; } private: - uint16_t Prime; + int Prime; /** Property map Element -> Element, which associate to an element its inverse in the field.*/ std::vector<Element> inverse_; const Element mult_id_all; |