Skip to content

Commit e0fd5c0

Browse files
committed
upstream patches #320 and #323
1 parent 7888c42 commit e0fd5c0

File tree

2 files changed

+272
-0
lines changed

2 files changed

+272
-0
lines changed

build/pkgs/linbox/patches/319.patch

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
From 4a1e1395804d4630ec556c61ba3f2cb67e140248 Mon Sep 17 00:00:00 2001
2+
From: Jean-Guillaume Dumas <[email protected]>
3+
Date: Thu, 5 Dec 2024 15:38:58 +0100
4+
Subject: [PATCH] solving issue #319
5+
6+
---
7+
linbox/vector/blas-subvector.h | 52 +++++++++++++++++-----------------
8+
tests/test-subvector.C | 6 ++++
9+
2 files changed, 32 insertions(+), 26 deletions(-)
10+
11+
diff --git a/linbox/vector/blas-subvector.h b/linbox/vector/blas-subvector.h
12+
index e1582723c3..8f290dd436 100644
13+
--- a/linbox/vector/blas-subvector.h
14+
+++ b/linbox/vector/blas-subvector.h
15+
@@ -1,6 +1,6 @@
16+
/* linbox/matrix/blas-vector.h
17+
* Copyright (C) 2013 the LinBox group
18+
- * 2019 Pascal Giorgi
19+
+ * 2019 Pascal Giorgi
20+
*
21+
* Written by :
22+
* Pascal Giorgi [email protected]
23+
@@ -45,7 +45,7 @@ namespace LinBox {
24+
// forward declaration
25+
template <class Field, class Storage>
26+
class BlasVector;
27+
-
28+
+
29+
30+
template <typename _Vector>
31+
class VectorEltPointer {
32+
@@ -61,7 +61,7 @@ namespace LinBox {
33+
typedef typename _Vector::Storage::const_reference reference;
34+
using Element=const typename _Vector::Field::Element;
35+
};
36+
-
37+
+
38+
template<class _Vector>
39+
class BlasSubvector {
40+
41+
@@ -88,7 +88,7 @@ namespace LinBox {
42+
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
43+
44+
protected:
45+
- pointer _ptr;
46+
+ pointer _ptr;
47+
size_t _size;
48+
size_t _inc;
49+
Field const*_field;
50+
@@ -101,7 +101,7 @@ namespace LinBox {
51+
//////////////////
52+
53+
BlasSubvector(){}
54+
-
55+
+
56+
/** Constructor from an existing @ref BlasVector and dimensions.
57+
* \param V Pointer to @ref BlasVector of which to construct subvector
58+
* \param beg Starting idx
59+
@@ -110,7 +110,7 @@ namespace LinBox {
60+
*/
61+
BlasSubvector (vectorType &V, size_t beg, size_t inc, size_t dim) :
62+
_ptr(V.getPointer()+beg), _size(dim), _inc(inc), _field(&V.field()) {}
63+
-
64+
+
65+
/** Constructor from an existing @ref BlasSubvector and dimensions.
66+
* \param V Pointer to @ref DenseSubector of which to construct subvector
67+
* \param beg Starting idx
68+
@@ -118,9 +118,9 @@ namespace LinBox {
69+
* \param inc distance between two element
70+
*/
71+
BlasSubvector (Self_t &V, size_t beg, size_t inc, size_t dim) :
72+
- _ptr(V.data()+beg), _size(dim), _inc(inc), _field(&V.field()) {}
73+
+ _ptr(V.getPointer()+beg), _size(dim), _inc(inc), _field(&V.field()) {}
74+
+
75+
76+
-
77+
/** Constructor from an existing @ref BlasVector
78+
* \param V Pointer to @ref BlasVector of which to construct submatrix
79+
*/
80+
@@ -132,17 +132,17 @@ namespace LinBox {
81+
*/
82+
BlasSubvector (const Field& F, pointer ptr, size_t inc, size_t dim) :
83+
_ptr(ptr), _size(dim), _inc(inc), _field(&F) {}
84+
-
85+
-
86+
+
87+
+
88+
89+
BlasSubvector (const Field& F, std::vector<Element>& v) :
90+
- _ptr(v.data()), _size(v.size()), _inc(1), _field(&F)
91+
+ _ptr(v.data()), _size(v.size()), _inc(1), _field(&F)
92+
{
93+
std::cerr<<"WARNING "<<__LINE__<<" ("<<__FILE__<<") : creating a BlasSubvector from a std::vector -> MUST BE DEPRECATED"<<std::endl;
94+
throw LinBoxError("Deprecated Subvector cstor from std::vector");
95+
}
96+
-
97+
-
98+
+
99+
+
100+
101+
/** Copy operator */
102+
BlasSubvector& operator= (const BlasSubvector& V){
103+
@@ -157,18 +157,18 @@ namespace LinBox {
104+
105+
template<class Vect>
106+
Self_t& copy(const Vect& A){
107+
- assert(_size == A.size());
108+
+ assert(_size == A.size());
109+
auto it=A.begin(); auto jt=begin();
110+
for( ; it!=A.end();++it,++jt)
111+
field().assign(*jt,*it);
112+
return *this;
113+
}
114+
-
115+
+
116+
//! Rebind operator
117+
template<typename _Tp1, typename _Rep2 = typename Rebind<Storage, _Tp1>::other>
118+
struct rebind {
119+
typedef BlasVector<_Tp1, _Rep2> other;
120+
-
121+
+
122+
void operator() (other & Ap, const Self_t& A) {
123+
typedef typename Self_t::const_iterator ConstSelfIterator ;
124+
typedef typename other::iterator OtherIterator ;
125+
@@ -180,14 +180,14 @@ namespace LinBox {
126+
}
127+
};
128+
129+
-
130+
+
131+
132+
/////////////////
133+
// ACCESSORS //
134+
/////////////////
135+
136+
const Field& field() const { return *_field;}
137+
-
138+
+
139+
// dimension of the vector
140+
size_t size() const{ return _size; }
141+
size_t max_size() const{ return _size; }
142+
@@ -203,14 +203,14 @@ namespace LinBox {
143+
* @return the inc value of the subvector
144+
*/
145+
size_t getInc() const {return _inc;}
146+
-
147+
+
148+
149+
void setEntry (size_t i, const Element &a_i){ field().assign(_ptr[i],a_i); }
150+
-
151+
+
152+
reference refEntry (size_t i){ return _ptr[i]; }
153+
154+
const_reference getEntry (size_t i) const { return _ptr[i]; }
155+
-
156+
+
157+
Element& getEntry (Element &x, size_t i) const{ return field().assign(x,_ptr[i]); }
158+
159+
// write
160+
@@ -226,7 +226,7 @@ namespace LinBox {
161+
case (Tag::FileFormat::Maple) :
162+
{
163+
os << '<' ;
164+
- for(size_t i=0; i<_size; i++){
165+
+ for(size_t i=0; i<_size; i++){
166+
field().write(os, *(_ptr+_inc*i));
167+
if (i != _size-1)
168+
os << ',' ;
169+
@@ -237,7 +237,7 @@ namespace LinBox {
170+
return os << "not implemented" ;
171+
}
172+
}
173+
-
174+
+
175+
//read
176+
std::istream &read ( std::istream &is, Tag::FileFormat fmt = Tag::FileFormat::Pretty ) {
177+
return is;
178+
@@ -275,10 +275,10 @@ namespace LinBox {
179+
const_reference front (void) const { return _ptr[0];}
180+
reference back (void) { return _ptr[(_size-1)*_inc];}
181+
const_reference back (void) const { return _ptr[(_size-1)*_inc];}
182+
-
183+
+
184+
bool empty() const {return (_size==0);}
185+
};
186+
-
187+
+
188+
template <class Vector>
189+
std::ostream& operator<< (std::ostream & os, const BlasSubvector<Vector> & V) {
190+
return V.write(os);
191+
@@ -296,7 +296,7 @@ namespace LinBox {
192+
193+
194+
195+
-
196+
+
197+
} // LinBox
198+
#endif
199+
// Local Variables:
200+
diff --git a/tests/test-subvector.C b/tests/test-subvector.C
201+
index be4850e233..fc1d2c658a 100644
202+
--- a/tests/test-subvector.C
203+
+++ b/tests/test-subvector.C
204+
@@ -752,6 +752,12 @@ static bool testSubvector3(Field &F, size_t n)
205+
//vector<int> ww(3, 77);
206+
w = ww;
207+
report << ww << std::endl;
208+
+
209+
+ report << "Constructing subvectors from subvector: ";
210+
+ subVector ww1(w, 0, 0, Length);
211+
+ report << ww1 << std::endl;
212+
+
213+
+
214+
#if 0
215+
report << "Constructing subvector from iterators: ";
216+
Subvect www(w.begin(), w.end());

build/pkgs/linbox/patches/323.patch

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
A subset of https://github.com/linbox-team/linbox/pull/323
2+
3+
4+
diff --git a/linbox/matrix/sparsematrix/sparse-tpl-matrix-omp.h b/linbox/matrix/sparsematrix/sparse-tpl-matrix-omp.h
5+
index feca4cf35d..e179a75aa1 100644
6+
--- a/linbox/matrix/sparsematrix/sparse-tpl-matrix-omp.h
7+
+++ b/linbox/matrix/sparsematrix/sparse-tpl-matrix-omp.h
8+
@@ -318,9 +318,9 @@ class SparseMatrix<Field_, SparseMatrixFormat::TPL_omp> : public BlackboxInterfa
9+
typedef typename selfvec::const_iterator selfiter;
10+
otheriter vp_p; selfiter v_p;
11+
12+
- Ap.data_.resize(A.data.size());
13+
+ Ap.data_.resize(A.data_.size());
14+
for (v_p = A.data_.begin(), vp_p = Ap.data_.begin();
15+
- v_p != A.data.end(); ++ v_p, ++ vp_p)
16+
+ v_p != A.data_.end(); ++ v_p, ++ vp_p)
17+
hom.image (vp_p->elt, v_p->elt);
18+
}
19+
};
20+
21+
22+
diff --git a/linbox/blackbox/block-hankel.h b/linbox/blackbox/block-hankel.h
23+
index a4bc7bfc9a..c8e27562c5 100644
24+
--- a/linbox/blackbox/block-hankel.h
25+
+++ b/linbox/blackbox/block-hankel.h
26+
@@ -345,8 +345,8 @@ namespace LinBox
27+
template<class Vector1, class Vector2>
28+
Vector1& apply(Vector1 &x, const Vector2 &y) const
29+
{
30+
- linbox_check(this->_coldim == y.size());
31+
- linbox_check(this->_rowdim == x.size());
32+
+ linbox_check(this->coldim() == y.size());
33+
+ linbox_check(this->rowdim() == x.size());
34+
BlasMatrixDomain<Field> BMD(field());
35+
#ifdef BHANKEL_TIMER
36+
_chrono.clear();
37+
38+
diff --git a/linbox/ring/polynomial-local-x.h b/linbox/ring/polynomial-local-x.h
39+
index b444ca198f..968714fc77 100644
40+
--- a/linbox/ring/polynomial-local-x.h
41+
+++ b/linbox/ring/polynomial-local-x.h
42+
@@ -61,14 +61,14 @@ namespace LinBox
43+
zero({0, _F.zero}), one({0, _F.one}), mOne({0, _F.mOne}),
44+
X({1, _F.one}), exp(exponent)
45+
{}
46+
47+
PolynomialLocalX(const PolynomialLocalX &P) : _F(P._F), zero(P.zero),
48+
one(P.one), mOne(P.mOne), X(P.X), exp(P.exp) {}
49+
50+
- PolynomialLocalX(const PolynomialLocalX &P, size_t exponent) : _F(P.F),
51+
+ PolynomialLocalX(const PolynomialLocalX &P, size_t exponent) : _F(P._F),
52+
zero(P.zero), one(P.one), mOne(P.mOne), X(P.X), exp(exponent) {}
53+
54+
void setExponent(size_t exponent) {
55+
exp = exponent;
56+
}

0 commit comments

Comments
 (0)