From 228a71ddb0a7b53802d14b961741cd0b7fa55c9f Mon Sep 17 00:00:00 2001 From: Dima Pasechnik Date: Sun, 20 Apr 2025 23:55:11 -0500 Subject: [PATCH] linbox patches for gcc-15 and Apple clang-17 --- build/pkgs/linbox/patches/41.patch | 216 +++++++++++++++++++++++++++++ build/pkgs/linbox/patches/42.patch | 26 ++++ build/pkgs/linbox/patches/43.patch | 160 +++++++++++++++++++++ 3 files changed, 402 insertions(+) create mode 100644 build/pkgs/linbox/patches/41.patch create mode 100644 build/pkgs/linbox/patches/42.patch create mode 100644 build/pkgs/linbox/patches/43.patch diff --git a/build/pkgs/linbox/patches/41.patch b/build/pkgs/linbox/patches/41.patch new file mode 100644 index 00000000000..dbda0e726f7 --- /dev/null +++ b/build/pkgs/linbox/patches/41.patch @@ -0,0 +1,216 @@ +From 4a1e1395804d4630ec556c61ba3f2cb67e140248 Mon Sep 17 00:00:00 2001 +From: Jean-Guillaume Dumas +Date: Thu, 5 Dec 2024 15:38:58 +0100 +Subject: [PATCH] solving issue #319 + +--- + linbox/vector/blas-subvector.h | 52 +++++++++++++++++----------------- + tests/test-subvector.C | 6 ++++ + 2 files changed, 32 insertions(+), 26 deletions(-) + +diff --git a/linbox/vector/blas-subvector.h b/linbox/vector/blas-subvector.h +index e1582723c3d4488504ca1473dec7260c33a06a23..8f290dd4362872a6b98a08b4e775ad66b5cde2dd 100644 +--- a/linbox/vector/blas-subvector.h ++++ b/linbox/vector/blas-subvector.h +@@ -1,6 +1,6 @@ + /* linbox/matrix/blas-vector.h + * Copyright (C) 2013 the LinBox group +- * 2019 Pascal Giorgi ++ * 2019 Pascal Giorgi + * + * Written by : + * Pascal Giorgi pascal.giorgi@lirmm.fr +@@ -45,7 +45,7 @@ namespace LinBox { + // forward declaration + template + class BlasVector; +- ++ + + template + class VectorEltPointer { +@@ -61,7 +61,7 @@ namespace LinBox { + typedef typename _Vector::Storage::const_reference reference; + using Element=const typename _Vector::Field::Element; + }; +- ++ + template + class BlasSubvector { + +@@ -88,7 +88,7 @@ namespace LinBox { + typedef std::reverse_iterator const_reverse_iterator; + + protected: +- pointer _ptr; ++ pointer _ptr; + size_t _size; + size_t _inc; + Field const*_field; +@@ -101,7 +101,7 @@ namespace LinBox { + ////////////////// + + BlasSubvector(){} +- ++ + /** Constructor from an existing @ref BlasVector and dimensions. + * \param V Pointer to @ref BlasVector of which to construct subvector + * \param beg Starting idx +@@ -110,7 +110,7 @@ namespace LinBox { + */ + BlasSubvector (vectorType &V, size_t beg, size_t inc, size_t dim) : + _ptr(V.getPointer()+beg), _size(dim), _inc(inc), _field(&V.field()) {} +- ++ + /** Constructor from an existing @ref BlasSubvector and dimensions. + * \param V Pointer to @ref DenseSubector of which to construct subvector + * \param beg Starting idx +@@ -118,9 +118,9 @@ namespace LinBox { + * \param inc distance between two element + */ + BlasSubvector (Self_t &V, size_t beg, size_t inc, size_t dim) : +- _ptr(V.data()+beg), _size(dim), _inc(inc), _field(&V.field()) {} ++ _ptr(V.getPointer()+beg), _size(dim), _inc(inc), _field(&V.field()) {} ++ + +- + /** Constructor from an existing @ref BlasVector + * \param V Pointer to @ref BlasVector of which to construct submatrix + */ +@@ -132,17 +132,17 @@ namespace LinBox { + */ + BlasSubvector (const Field& F, pointer ptr, size_t inc, size_t dim) : + _ptr(ptr), _size(dim), _inc(inc), _field(&F) {} +- +- ++ ++ + + BlasSubvector (const Field& F, std::vector& v) : +- _ptr(v.data()), _size(v.size()), _inc(1), _field(&F) ++ _ptr(v.data()), _size(v.size()), _inc(1), _field(&F) + { + std::cerr<<"WARNING "<<__LINE__<<" ("<<__FILE__<<") : creating a BlasSubvector from a std::vector -> MUST BE DEPRECATED"< + Self_t& copy(const Vect& A){ +- assert(_size == A.size()); ++ assert(_size == A.size()); + auto it=A.begin(); auto jt=begin(); + for( ; it!=A.end();++it,++jt) + field().assign(*jt,*it); + return *this; + } +- ++ + //! Rebind operator + template::other> + struct rebind { + typedef BlasVector<_Tp1, _Rep2> other; +- ++ + void operator() (other & Ap, const Self_t& A) { + typedef typename Self_t::const_iterator ConstSelfIterator ; + typedef typename other::iterator OtherIterator ; +@@ -180,14 +180,14 @@ namespace LinBox { + } + }; + +- ++ + + ///////////////// + // ACCESSORS // + ///////////////// + + const Field& field() const { return *_field;} +- ++ + // dimension of the vector + size_t size() const{ return _size; } + size_t max_size() const{ return _size; } +@@ -203,14 +203,14 @@ namespace LinBox { + * @return the inc value of the subvector + */ + size_t getInc() const {return _inc;} +- ++ + + void setEntry (size_t i, const Element &a_i){ field().assign(_ptr[i],a_i); } +- ++ + reference refEntry (size_t i){ return _ptr[i]; } + + const_reference getEntry (size_t i) const { return _ptr[i]; } +- ++ + Element& getEntry (Element &x, size_t i) const{ return field().assign(x,_ptr[i]); } + + // write +@@ -226,7 +226,7 @@ namespace LinBox { + case (Tag::FileFormat::Maple) : + { + os << '<' ; +- for(size_t i=0; i<_size; i++){ ++ for(size_t i=0; i<_size; i++){ + field().write(os, *(_ptr+_inc*i)); + if (i != _size-1) + os << ',' ; +@@ -237,7 +237,7 @@ namespace LinBox { + return os << "not implemented" ; + } + } +- ++ + //read + std::istream &read ( std::istream &is, Tag::FileFormat fmt = Tag::FileFormat::Pretty ) { + return is; +@@ -275,10 +275,10 @@ namespace LinBox { + const_reference front (void) const { return _ptr[0];} + reference back (void) { return _ptr[(_size-1)*_inc];} + const_reference back (void) const { return _ptr[(_size-1)*_inc];} +- ++ + bool empty() const {return (_size==0);} + }; +- ++ + template + std::ostream& operator<< (std::ostream & os, const BlasSubvector & V) { + return V.write(os); +@@ -296,7 +296,7 @@ namespace LinBox { + + + +- ++ + } // LinBox + #endif + // Local Variables: +diff --git a/tests/test-subvector.C b/tests/test-subvector.C +index be4850e23344c95f762c09d8fdfe2cdbbac896b2..fc1d2c658afdb4cf6a8338443e29d73b583de9f4 100644 +--- a/tests/test-subvector.C ++++ b/tests/test-subvector.C +@@ -752,6 +752,12 @@ static bool testSubvector3(Field &F, size_t n) + //vector ww(3, 77); + w = ww; + report << ww << std::endl; ++ ++ report << "Constructing subvectors from subvector: "; ++ subVector ww1(w, 0, 0, Length); ++ report << ww1 << std::endl; ++ ++ + #if 0 + report << "Constructing subvector from iterators: "; + Subvect www(w.begin(), w.end()); diff --git a/build/pkgs/linbox/patches/42.patch b/build/pkgs/linbox/patches/42.patch new file mode 100644 index 00000000000..17cd0b4d542 --- /dev/null +++ b/build/pkgs/linbox/patches/42.patch @@ -0,0 +1,26 @@ +From d1f618fb0ee4a84be3ccddcfc28b257f34e1cbf7 Mon Sep 17 00:00:00 2001 +From: "Benjamin A. Beasley" +Date: Fri, 17 Jan 2025 14:25:19 -0500 +Subject: [PATCH] Fix a compiler error on GCC 15 + +Fixes https://github.com/linbox-team/linbox/issues/321. +--- + linbox/matrix/sparsematrix/sparse-tpl-matrix-omp.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/linbox/matrix/sparsematrix/sparse-tpl-matrix-omp.h b/linbox/matrix/sparsematrix/sparse-tpl-matrix-omp.h +index feca4cf35d41910759c564273cf12f30e150b853..c97b1c8c114f58b3f1be4fdc89cb3dae0f1d8dea 100644 +--- a/linbox/matrix/sparsematrix/sparse-tpl-matrix-omp.h ++++ b/linbox/matrix/sparsematrix/sparse-tpl-matrix-omp.h +@@ -318,9 +318,9 @@ class SparseMatrix : public BlackboxInterfa + typedef typename selfvec::const_iterator selfiter; + otheriter vp_p; selfiter v_p; + +- Ap.data_.resize(A.data.size()); ++ Ap.data_.resize(A.data_.size()); + for (v_p = A.data_.begin(), vp_p = Ap.data_.begin(); +- v_p != A.data.end(); ++ v_p, ++ vp_p) ++ v_p != A.data_.end(); ++ v_p, ++ vp_p) + hom.image (vp_p->elt, v_p->elt); + } + }; diff --git a/build/pkgs/linbox/patches/43.patch b/build/pkgs/linbox/patches/43.patch new file mode 100644 index 00000000000..8093a863b6f --- /dev/null +++ b/build/pkgs/linbox/patches/43.patch @@ -0,0 +1,160 @@ +diff --git a/linbox/blackbox/block-hankel.h b/linbox/blackbox/block-hankel.h +index a4bc7bf..c8e2756 100644 +--- a/linbox/blackbox/block-hankel.h ++++ b/linbox/blackbox/block-hankel.h +@@ -345,8 +345,8 @@ namespace LinBox + template + Vector1& apply(Vector1 &x, const Vector2 &y) const + { +- linbox_check(this->_coldim == y.size()); +- linbox_check(this->_rowdim == x.size()); ++ linbox_check(this->coldim() == y.size()); ++ linbox_check(this->rowdim() == x.size()); + BlasMatrixDomain BMD(field()); + #ifdef BHANKEL_TIMER + _chrono.clear(); +diff --git a/linbox/matrix/sparsematrix/sparse-ell-matrix.h b/linbox/matrix/sparsematrix/sparse-ell-matrix.h +index 1fc1bca..60378b9 100644 +--- a/linbox/matrix/sparsematrix/sparse-ell-matrix.h ++++ b/linbox/matrix/sparsematrix/sparse-ell-matrix.h +@@ -1083,16 +1083,6 @@ namespace LinBox + + {} + +- _Iterator &operator = (const _Iterator &iter) +- { +- _data_it = iter._data_it ; +- _data_beg = iter._data_beg ; +- _data_end = iter._data_end ; +- _field = iter._field ; +- +- return *this; +- } +- + bool operator == (const _Iterator &i) const + { + return (_data_it == i._data_it) ; +@@ -1205,20 +1195,6 @@ namespace LinBox + , _row(iter._row) + {} + +- _IndexedIterator &operator = (const _IndexedIterator &iter) +- { +- _colid_beg = iter._colid_beg ; +- _colid_it = iter._colid_it ; +- _data_it = iter._data_it ; +- const_cast(_data_beg) = iter._data_beg ; +- const_cast(_data_end) = iter._data_end ; +- const_cast(_field) = iter._field ; +- const_cast(_ld) = iter._ld ; +- _row = iter._row ; +- +- return *this; +- } +- + bool operator == (const _IndexedIterator &i) const + { + // we assume consistency +diff --git a/linbox/matrix/sparsematrix/sparse-ellr-matrix.h b/linbox/matrix/sparsematrix/sparse-ellr-matrix.h +index 11e59d5..359cb15 100644 +--- a/linbox/matrix/sparsematrix/sparse-ellr-matrix.h ++++ b/linbox/matrix/sparsematrix/sparse-ellr-matrix.h +@@ -1099,19 +1099,6 @@ namespace LinBox + + {} + +- _Iterator &operator = (const _Iterator &iter) +- { +- _data_it = iter._data_it ; +- const_cast(_data_beg) = iter._data_beg ; +- const_cast(_data_end)= iter._data_end ; +- const_cast(_field) = iter._field ; +- const_cast&>(_rowid) = iter._rowid; +- const_cast(_ld) = iter._ld ; +- _row = iter._row ; +- +- return *this; +- } +- + bool operator == (const _Iterator &i) const + { + return (_data_it == i._data_it) ; +@@ -1246,21 +1233,6 @@ namespace LinBox + , _row(iter._row) + {} + +- _IndexedIterator &operator = (const _IndexedIterator &iter) +- { +- _rowid_it = iter._rowid_it ; +- _colid_beg = iter._colid_beg ; +- _colid_it = iter._colid_it ; +- _data_it = iter._data_it ; +- const_cast(_data_beg) = iter._data_beg ; +- const_cast(_data_end) = iter._data_end ; +- const_cast(_field) = iter._field ; +- const_cast(_ld)= iter._ld ; +- _row = iter._row ; +- +- return *this; +- } +- + bool operator == (const _IndexedIterator &i) const + { + // we assume consistency +diff --git a/linbox/ring/ntl/ntl-lzz_p.h b/linbox/ring/ntl/ntl-lzz_p.h +index 201baaa..1bf8fc8 100644 +--- a/linbox/ring/ntl/ntl-lzz_p.h ++++ b/linbox/ring/ntl/ntl-lzz_p.h +@@ -145,6 +145,11 @@ namespace LinBox + ,zero( NTL::to_zz_p(0)),one( NTL::to_zz_p(1)),mOne(-one) + {} + ++ Element &init (Element &x) const ++ { ++ return x = NTL::to_zz_p(0); ++ } ++ + Element& init(Element& x, const double& y) const + { + double z = fmod(y,(double)Element::modulus()); +@@ -153,7 +158,7 @@ namespace LinBox + return x = NTL::to_zz_p(static_cast(z)); //rounds towards 0 + } + +- Element &init (Element &x, const integer &y=0) const ++ Element &init (Element &x, const integer &y) const + { + NTL::ZZ tmp= NTL::to_ZZ(std::string(y).data()); + return x = NTL::to_zz_p(tmp); +diff --git a/linbox/ring/ntl/ntl-lzz_pe.h b/linbox/ring/ntl/ntl-lzz_pe.h +index 60b132a..045b2f7 100644 +--- a/linbox/ring/ntl/ntl-lzz_pe.h ++++ b/linbox/ring/ntl/ntl-lzz_pe.h +@@ -207,7 +207,9 @@ namespace LinBox + return f; + } + +- Element & init(Element & x, integer n = 0) const ++ Element & init(Element & x) const { return x; } ++ ++ Element & init(Element & x, integer n) const + { // assumes n >= 0. + int e = exponent(); + n %= cardinality(); +diff --git a/linbox/ring/ntl/ntl-zz_px.h b/linbox/ring/ntl/ntl-zz_px.h +index 6e7d5b2..340df9f 100644 +--- a/linbox/ring/ntl/ntl-zz_px.h ++++ b/linbox/ring/ntl/ntl-zz_px.h +@@ -104,6 +104,12 @@ namespace LinBox + ,_CField(cf) + {} + ++ /** Initialize p to 0 */ ++ Element& init( Element& p ) const ++ { ++ return p = 0; ++ } ++ + /** Initialize p to the constant y (p = y*x^0) */ + template + Element& init( Element& p, const ANY& y ) const