Source: https://github.com/linbox-team/givaro/commit/b0cf33e1d4437530c7e4b3db90b6c80057a7f2f3.patch GCC 14: No match for operator= for Givaro::ZRing https://github.com/linbox-team/givaro/issues/226 Includes the commit that fixes the error with gcc 14. ``` givaro/givaro/random-integer.h: In member function 'Givaro::RandomIntegerIterator<_Unsigned, _Exact_Size>& Givaro::RandomIntegerIterator<_Unsigned, _Exact_Size>::operator=(const Givaro::RandomIntegerIterator<_Unsigned, _Exact_Size>&)': givaro/givaro/random-integer.h:94:54: error: no match for 'operator=' (operand types are 'Givaro::RandomIntegerIterator<_Unsigned, _Exact_Size>::Integer_Domain' {aka 'Givaro::ZRing'} and 'const Givaro::RandomIntegerIterator<_Unsigned, _Exact_Size>::Integer_Domain' {aka 'const Givaro::ZRing'}) 94 | const_cast(_ring)=R._ring; | ^~~~~ ``` -- From b0cf33e1d4437530c7e4b3db90b6c80057a7f2f3 Mon Sep 17 00:00:00 2001 From: Jean-Guillaume Dumas Date: Fri, 26 Jan 2024 15:59:37 +0100 Subject: [PATCH] More givarational operators --- src/kernel/field/gfqext.h | 7 +- src/kernel/integer/givinteger.h | 11 +- src/kernel/integer/random-integer.h | 1 - src/kernel/rational/givrational.h | 193 ++++++++++++++++++++++++++++ src/library/poly1/givpoly1padic.h | 3 +- 5 files changed, 203 insertions(+), 12 deletions(-) diff --git a/src/kernel/field/gfqext.h b/src/kernel/field/gfqext.h index 90ff49c5..4b7576c4 100644 --- a/src/kernel/field/gfqext.h +++ b/src/kernel/field/gfqext.h @@ -5,7 +5,7 @@ // and abiding by the rules of distribution of free software. // see the COPYRIGHT file for more details. // file: gfqext.h -// Time-stamp: <12 Jun 15 16:28:43 Jean-Guillaume.Dumas@imag.fr> +// Time-stamp: <26 Jan 24 15:58:15 Jean-Guillaume.Dumas@imag.fr> // date: 2007 // version: // author: Jean-Guillaume.Dumas @@ -363,6 +363,11 @@ namespace Givaro { const double tmp(fmod(d,this->_fMODOUT)); return DirectFather_t::init(pad, (tmp>0.0)?tmp:(tmp+_fMODOUT) ); } + virtual Rep& init(Rep& pad, const float d) const + { + return init(pad, (double)d); + } + }; } // namespace Givaro diff --git a/src/kernel/integer/givinteger.h b/src/kernel/integer/givinteger.h index 6e4c9f63..5d7f359d 100644 --- a/src/kernel/integer/givinteger.h +++ b/src/kernel/integer/givinteger.h @@ -39,15 +39,8 @@ namespace Givaro { using Parent_t::Parent_t; // inherit constructors - int operator==( const Self_t&) const - { - return 1; - } - int operator!=( const Self_t&) const - { - return 0; - } - + int operator==( const Self_t&) const { return 1; } + int operator!=( const Self_t&) const { return 0; } template XXX& convert(XXX& x, const Rep& a) const { diff --git a/src/kernel/integer/random-integer.h b/src/kernel/integer/random-integer.h index f9361d33..ea189a36 100644 --- a/src/kernel/integer/random-integer.h +++ b/src/kernel/integer/random-integer.h @@ -87,7 +87,6 @@ namespace Givaro if (this != &R) { _bits = R._bits; _integer = R._integer; - const_cast(_ring)=R._ring; } return *this; } diff --git a/src/kernel/rational/givrational.h b/src/kernel/rational/givrational.h index 9bf498fc..2d933ea5 100644 --- a/src/kernel/rational/givrational.h +++ b/src/kernel/rational/givrational.h @@ -107,6 +107,199 @@ namespace Givaro { Integer operator % (const Integer &r) const; + /** @name Comparison operators. + * @brief Compare with operators. + */ + ///@{ + /** greater or equal. + * @param l integer to be compared to + */ + giv_all_inlined int32_t operator >= (const Integer & l) const; + /** @overload Rational::operator>=(Rational) */ + giv_all_inlined int32_t operator >= (const int32_t l) const; + /** @overload Rational::operator>=(Rational) */ + giv_all_inlined int32_t operator >= (const int64_t l) const; + /** @overload Rational::operator>=(Rational) */ + giv_all_inlined int32_t operator >= (const uint64_t l) const; + /** @overload Rational::operator>=(Rational) */ + giv_all_inlined int32_t operator >= (const uint32_t l) const; + /** @overload Rational::operator>=(Rational) */ + giv_all_inlined int32_t operator >= (const double l) const; + /** @overload Rational::operator>=(Rational) */ + giv_all_inlined int32_t operator >= (const float l) const; + + //! greater or equal. + /// @param l,n rationals to compare + giv_all_inlined friend int32_t operator >= (uint32_t l, const Rational& n); + /** @overload Rational::operator>=(unsigned, Rational) */ + giv_all_inlined friend int32_t operator >= (float l, const Rational& n); + /** @overload Rational::operator>=(unsigned, Rational) */ + giv_all_inlined friend int32_t operator >= (double l, const Rational& n); + /** @overload Rational::operator>=(unsigned, Rational) */ + giv_all_inlined friend int32_t operator >= (int32_t l, const Rational& n); + /** @overload Rational::operator>=(unsigned, Rational) */ + giv_all_inlined friend int32_t operator >= (int64_t l, const Rational& n); + /** @overload Rational::operator>=(unsigned, Rational) */ + giv_all_inlined friend int32_t operator >= (uint64_t l, const Rational& n); + + + //! less or equal + /// @param l rational to be compared to + giv_all_inlined int32_t operator <= (const Rational & l) const; + /** @overload Rational::operator<=(Rational) */ + giv_all_inlined int32_t operator <= (const int32_t l) const; + /** @overload Rational::operator<=(Rational) */ + giv_all_inlined int32_t operator <= (const int64_t l) const; + /** @overload Rational::operator<=(Rational) */ + giv_all_inlined int32_t operator <= (const uint64_t l) const; + /** @overload Rational::operator<=(Rational) */ + giv_all_inlined int32_t operator <= (const uint32_t l) const; + /** @overload Rational::operator<=(Rational) */ + giv_all_inlined int32_t operator <= (const double l) const; + /** @overload Rational::operator<=(Rational) */ + giv_all_inlined int32_t operator <= (const float l) const; + + //! less or equal + /// @param l,n rationals to compare + giv_all_inlined friend int32_t operator <= (uint32_t l, const Rational& n); + /** @overload Rational::operator>=(unsigned, Rational) */ + giv_all_inlined friend int32_t operator <= (float l, const Rational& n); + /** @overload Rational::operator>=(unsigned, Rational) */ + giv_all_inlined friend int32_t operator <= (double l, const Rational& n); + /** @overload Rational::operator>=(unsigned, Rational) */ + giv_all_inlined friend int32_t operator <= (int32_t l, const Rational& n); + /** @overload Rational::operator>=(unsigned, Rational) */ + giv_all_inlined friend int32_t operator <= (int64_t l, const Rational& n); + /** @overload Rational::operator>=(unsigned, Rational) */ + giv_all_inlined friend int32_t operator <= (uint64_t l, const Rational& n); + + /*! operator != (not equal) + * @param l rational + * @return \c 1 iff l == this + */ + giv_all_inlined int32_t operator != (const Integer & l) const; + /** @overload Rational::operator!=(Rational) */ + giv_all_inlined int32_t operator != (const int32_t l) const; + /** @overload Rational::operator!=(Rational) */ + giv_all_inlined int32_t operator != (const int64_t l) const; + /** @overload Rational::operator!=(Rational) */ + giv_all_inlined int32_t operator != (const uint64_t l) const; + /** @overload Rational::operator!=(Rational) */ + giv_all_inlined int32_t operator != (const uint32_t l) const; + /** @overload Rational::operator!=(Rational) */ + giv_all_inlined int32_t operator != (const double l) const; + /** @overload Rational::operator!=(Rational) */ + giv_all_inlined int32_t operator != (const float l) const; + + /*! operator != (not equal) + * @param l,n rational + * @return \c 1 iff l == n + */ + giv_all_inlined friend int32_t operator != (uint32_t l, const Rational& n); + /** @overload Rational::operator!=(unsigned, Rational) */ + giv_all_inlined friend int32_t operator != (float l, const Rational& n); + /** @overload Rational::operator!=(unsigned, Rational) */ + giv_all_inlined friend int32_t operator != (double l, const Rational& n); + /** @overload Rational::operator!=(unsigned, Rational) */ + giv_all_inlined friend int32_t operator != (int32_t l, const Rational& n); + /** @overload Rational::operator!=(unsigned, Rational) */ + giv_all_inlined friend int32_t operator != (int64_t l, const Rational& n); + /** @overload Rational::operator!=(unsigned, Rational) */ + giv_all_inlined friend int32_t operator != (uint64_t l, const Rational& n); + + + //! Equality + /// @param l rational to be compared to + giv_all_inlined int32_t operator == (const Integer & l) const; + /** @overload Rational::operator==(Rational) */ + giv_all_inlined int32_t operator == (const int32_t l) const; + /** @overload Rational::operator==(Rational) */ + giv_all_inlined int32_t operator == (const int64_t l) const; + /** @overload Rational::operator==(Rational) */ + giv_all_inlined int32_t operator == (const uint64_t l) const; + /** @overload Rational::operator==(Rational) */ + giv_all_inlined int32_t operator == (const uint32_t l) const; + /** @overload Rational::operator==(Rational) */ + giv_all_inlined int32_t operator == (const double l) const; + /** @overload Rational::operator==(Rational) */ + giv_all_inlined int32_t operator == (const float l) const; + + //! Equality + /// @param l,n rationals to compare + giv_all_inlined friend int32_t operator == (uint32_t l, const Rational& n); + /** @overload Rational::operator==(unsigned, Rational) */ + giv_all_inlined friend int32_t operator == (float l, const Rational& n); + /** @overload Rational::operator==(unsigned, Rational) */ + giv_all_inlined friend int32_t operator == (double l, const Rational& n); + /** @overload Rational::operator==(unsigned, Rational) */ + giv_all_inlined friend int32_t operator == (int32_t l, const Rational& n); + /** @overload Rational::operator==(unsigned, Rational) */ + giv_all_inlined friend int32_t operator == (int64_t l, const Rational& n); + /** @overload Rational::operator==(unsigned, Rational) */ + giv_all_inlined friend int32_t operator == (uint64_t l, const Rational& n); + + + //! greater (strict) + /// @param l rational to be compared to + giv_all_inlined int32_t operator > (const Integer & l) const; + /** @overload Rational::operator>(Rational) */ + giv_all_inlined int32_t operator > (const int32_t l) const; + /** @overload Rational::operator>(Rational) */ + giv_all_inlined int32_t operator > (const int64_t l) const; + /** @overload Rational::operator>(Rational) */ + giv_all_inlined int32_t operator > (const uint64_t l) const; + /** @overload Rational::operator>(Rational) */ + giv_all_inlined int32_t operator > (const uint32_t l) const; + /** @overload Rational::operator>(Rational) */ + giv_all_inlined int32_t operator > (const double l) const; + /** @overload Rational::operator>(Rational) */ + giv_all_inlined int32_t operator > (const float l) const; + + //! greater (strict) + /// @param l,n rationals to compare + giv_all_inlined friend int32_t operator > (uint32_t l, const Rational& n); + /** @overload Rational::operator>(unsigned, Rational) */ + giv_all_inlined friend int32_t operator > (float l, const Rational& n); + /** @overload Rational::operator>(unsigned, Rational) */ + giv_all_inlined friend int32_t operator > (double l, const Rational& n); + /** @overload Rational::operator>(unsigned, Rational) */ + giv_all_inlined friend int32_t operator > (int32_t l, const Rational& n); + /** @overload Rational::operator>(unsigned, Rational) */ + giv_all_inlined friend int32_t operator > (int64_t l, const Rational& n); + /** @overload Rational::operator>(unsigned, Rational) */ + giv_all_inlined friend int32_t operator > (uint64_t l, const Rational& n); + + //! less (strict) + /// @param l rational to be compared to + giv_all_inlined int32_t operator < (const Integer & l) const; + /** @overload Rational::operator<(Rational) */ + giv_all_inlined int32_t operator < (const int32_t l) const; + /** @overload Rational::operator<(Rational) */ + giv_all_inlined int32_t operator < (const int64_t l) const; + /** @overload Rational::operator<(Rational) */ + giv_all_inlined int32_t operator < (const uint64_t l) const; + /** @overload Rational::operator<(Rational) */ + giv_all_inlined int32_t operator < (const uint32_t l) const; + /** @overload Rational::operator<(Rational) */ + giv_all_inlined int32_t operator < (const double l) const; + /** @overload Rational::operator<(Rational) */ + giv_all_inlined int32_t operator < (const float l) const; + + //! less (strict) + /// @param l,n rationals to compare + giv_all_inlined friend int32_t operator < (uint32_t l, const Rational& n); + /** @overload Rational::operator<(unsigned, Rational) */ + giv_all_inlined friend int32_t operator < (float l, const Rational& n); + /** @overload Rational::operator<(unsigned, Rational) */ + giv_all_inlined friend int32_t operator < (double l, const Rational& n); + /** @overload Rational::operator<(unsigned, Rational) */ + giv_all_inlined friend int32_t operator < (int32_t l, const Rational& n); + /** @overload Rational::operator<(unsigned, Rational) */ + giv_all_inlined friend int32_t operator < (int64_t l, const Rational& n); + /** @overload Rational::operator<(unsigned, Rational) */ + giv_all_inlined friend int32_t operator < (uint64_t l, const Rational& n); + ///@} + //-----------------------------------------Arithmetic functions friend const Rational pow(const Rational &r, const int64_t l); diff --git a/src/library/poly1/givpoly1padic.h b/src/library/poly1/givpoly1padic.h index ed91dd89..5f391308 100644 --- a/src/library/poly1/givpoly1padic.h +++ b/src/library/poly1/givpoly1padic.h @@ -4,7 +4,7 @@ // Givaro is governed by the CeCILL-B license under French law // and abiding by the rules of distribution of free software. // see the COPYRIGHT file for more details. -// Time-stamp: <28 Oct 15 04:14:34 Jean-Guillaume.Dumas@imag.fr> +// Time-stamp: <26 Jan 24 15:56:09 Jean-Guillaume.Dumas@imag.fr> // ================================================================= // /** @file givpoly1padic.h @@ -40,6 +40,7 @@ namespace Givaro { Poly1PadicDom (const Poly_t& P, const IntegerDom& D) : Poly_t (P), IntegerDom(D) {} using Poly_t::write; + using IntegerDom::write; // Horner like evaluation of the polynomial for p = _domain.size() template