Skip to content

Commit 29fee65

Browse files
committed
Merge branch 'master' into dixon
2 parents d41a3d6 + c3785b9 commit 29fee65

25 files changed

+311
-275
lines changed

doc/mainpage.doxy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
* prolific documenters have been William J Turner, Bradford Hovinen,
124124
* David Saunders, Brice Boyer.
125125
*
126-
* \version 1.6.3
126+
* \version 1.7.0
127127
*
128128
* \par Support.
129129
* The project is supported by the National Science Foundation

doc/versionning.doxy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
* <li> \b Revision number. <br/>
3838
* Minor changes are changes that do not change any API and do not provoke
3939
* any miscompilation in LinBox. As a consequence, for instance, any release
40-
* \c 1.3.z of LinBox should compile with any givaro \c 3.7.z and any
41-
* fflas-ffpack \c 1.6.z. <br/>
40+
* \c 1.7.z of LinBox should compile with any givaro \c 4.2.z and any
41+
* fflas-ffpack \c 2.4.z. <br/>
4242
* This correspondance should be published on the website. It is however always put in
4343
* the \c auto-install.sh script.
4444
* </li>

linbox/algorithms/bbcharpoly.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ namespace LinBox
204204
FM* depend = NULL;
205205
for (size_t j = 1; j <= exp[i]; ++j){
206206
IntPoly * tmp2 = new IntPoly(*tmp);
207-
// FieldPoly *tmp2p = new FieldPoly(tmp2->size());
208-
// typename IntPoly::template rebind<Field>() (*tmp2p, *tmp2, F);
207+
// FieldPoly *tmp2p = new FieldPoly(tmp2->size());
208+
// typename IntPoly::template rebind<Field>() (*tmp2p, *tmp2, F);
209209
FieldPoly *tmp2p = new FieldPoly(*tmp2, F);
210210

211211
FFM = new FM (tmp2p, tmp2, 0, depend);
@@ -223,8 +223,8 @@ namespace LinBox
223223
leadingBlocks.insert (std::pair<FM*,bool>(FFM,false));
224224
}
225225
else {
226-
// FieldPoly* fp=new FieldPoly(intFactors[i].size());
227-
// typename IntPoly::template rebind<Field>() (*fp, (intFactors[i]), F);
226+
// FieldPoly* fp=new FieldPoly(intFactors[i].size());
227+
// typename IntPoly::template rebind<Field>() (*fp, (intFactors[i]), F);
228228
IntPoly * ip=new IntPoly(intFactors[i]);
229229
FieldPoly* fp=new FieldPoly(intFactors[i], F);
230230

@@ -286,14 +286,14 @@ namespace LinBox
286286
/* Computation of the minimal polynomial */
287287
Polynomial minPoly(F);
288288
minpoly (minPoly, A, M);
289-
// PD.write(std::cerr<<"Minpoly = ",minPoly) << std::endl;
289+
//PD.write(std::cerr<<"Minpoly = ",minPoly) << std::endl;
290290

291291
if (minPoly.size() == n+1){
292292
commentator().stop ("done", NULL, "MbbCharpoly");
293293
return P = minPoly;
294294
}
295295

296-
296+
297297

298298
Polynomial charPoly (F);
299299

linbox/algorithms/blackbox-container-base.h

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
// - wait : waits for the end of the current computation
3333
// ================================================================
3434

35-
35+
#include "linbox/solutions/constants.h"
3636
#include "linbox/vector/vector-domain.h"
3737

3838
namespace LinBox
@@ -157,11 +157,20 @@ namespace LinBox
157157
{
158158
casenumber = 1;
159159
u.resize (_BB->coldim ());
160-
for (long i = (long)u.size (); i--;)
161-
g.random (u[(size_t)i]);
162-
v.resize (_BB->rowdim ());
163-
return _VD.dot (_value, u, u);
164-
}
160+
v.resize (_BB->rowdim ());
161+
162+
size_t trials=0;
163+
do {
164+
for (long i = (long)this->u.size (); i--;)
165+
g.random (this->u[(size_t)i]);
166+
this->_VD.dot (this->_value, this->u, this->u);
167+
} while(_field->isZero(this->_value) && ++trials<= LINBOX_DEFAULT_TRIALS_BEFORE_FAILURE);
168+
169+
if (trials >= LINBOX_DEFAULT_TRIALS_BEFORE_FAILURE)
170+
std::cerr<<"ERROR in "<<__FILE__<<" at line "<<__LINE__<<" -> projection always auto-orthogonal after "<<LINBOX_DEFAULT_TRIALS_BEFORE_FAILURE<<" attempts\n";;
171+
172+
return _value;
173+
}
165174

166175
/// User Left vectors, Zero Right vector
167176
template<class Vector>

linbox/algorithms/blackbox-container.h

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "linbox/randiter/archetype.h"
3434
#include "linbox/algorithms/blackbox-container-base.h"
3535
#include "linbox/util/timer.h"
36+
#include "linbox/solutions/constants.h"
3637

3738
namespace LinBox
3839
{
@@ -87,13 +88,23 @@ namespace LinBox
8788
{
8889
this->casenumber = 1;
8990
this->u.resize (this->_BB->coldim ());
90-
for (long i = (long)this->u.size (); i--;)
91-
g.random (this->u[(size_t)i]);
92-
this->w.resize (this->_BB->coldim ());
93-
for (long i = (long)this->w.size (); i--;)
94-
g.random (this->w[(size_t)i]);
95-
this->v.resize (this->_BB->rowdim ());
96-
this->_VD.dot (this->_value, this->u, this->w);
91+
this->w.resize (this->_BB->coldim ());
92+
this->v.resize (this->_BB->rowdim ());
93+
94+
size_t trials=0;
95+
do {
96+
for (long i = (long)this->u.size (); i--;)
97+
g.random (this->u[(size_t)i]);
98+
99+
for (long i = (long)this->w.size (); i--;)
100+
g.random (this->w[(size_t)i]);
101+
102+
this->_VD.dot (this->_value, this->u, this->w);
103+
} while(F.isZero(this->_value) && ++trials<= LINBOX_DEFAULT_TRIALS_BEFORE_FAILURE);
104+
105+
if (trials >= LINBOX_DEFAULT_TRIALS_BEFORE_FAILURE)
106+
std::cerr<<"ERROR in "<<__FILE__<<" at line "<<__LINE__<<" -> projection always orthogonal after "<<LINBOX_DEFAULT_TRIALS_BEFORE_FAILURE<<" attempts\n";;
107+
97108
#ifdef INCLUDE_TIMING
98109
_applyTime = _dotTime = 0.0;
99110
#endif

linbox/algorithms/gauss/gauss-gf2.inl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* linbox/algorithms/gauss-gf2.inl
22
* Copyright (C) 2009 The LinBox group
33
*
4-
* Time-stamp: <27 Aug 20 15:19:20 [email protected]>
4+
* Time-stamp: <03 Dec 21 09:06:58 [email protected]>
55
*
66
*
77
* ========LICENCE========
@@ -75,8 +75,8 @@ namespace LinBox
7575

7676
// assignment of LigneA with the domain object
7777
for (size_t jj = 0; jj < Ni; ++jj)
78-
for (size_t k = 0; k < LigneA[jj].size (); k++)
79-
++col_density[LigneA[jj][(size_t)k]];
78+
for (size_t k = 0; k < LigneA[jj].size(); ++k)
79+
++col_density[LigneA[jj][k]];
8080

8181
long last = (long)Ni - 1;
8282
long c;

linbox/algorithms/massey-domain.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@ namespace LinBox
348348

349349
commentator().stop ("done", NULL, "masseyd");
350350
// commentator().stop ("Done", "Done", "LinBox::MasseyDomain::massey");
351-
352351
return L;
353352
}
354353

@@ -398,7 +397,14 @@ namespace LinBox
398397
{
399398
long dp = massey (phi, full_poly);
400399
rank = (size_t) (v_degree(phi) - v_val (phi));
401-
if (phi.size () > 0) {
400+
//std::cerr<<"dp="<<dp<<" rank="<<rank<<" -> "<<phi.size()<<" : "<<phi<<std::endl;
401+
402+
if (dp==0){// empty sequence, its minpoly is 1
403+
phi.resize(1);
404+
field().assign(phi[0],field().one);
405+
return;
406+
}
407+
if (phi.size () > 0) {
402408
phi.resize ((size_t)dp+1);
403409
for (long i = dp >> 1; i > 0; --i)
404410
std::swap (phi[(size_t)i], phi[(size_t)(dp-i)]);

linbox/algorithms/polynomial-matrix/polynomial-matrix-domain.h

100755100644
File mode changed.

linbox/algorithms/wiedemann.h

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ namespace LinBox
9292
{
9393
typedef typename Blackbox::Field Field;
9494
typename Field::RandIter i (A.field());
95-
size_t deg;
95+
size_t seqrank;
9696

9797
commentator().start ("Wiedemann Minimal polynomial", "minpoly");
9898

@@ -103,21 +103,21 @@ namespace LinBox
103103
BlackboxContainer<Field, Squarize<Blackbox> > TF (&B, A.field(), i);
104104
MasseyDomain< Field, BlackboxContainer<Field, Squarize<Blackbox> > > WD (&TF, M.earlyTerminationThreshold);
105105

106-
WD.minpoly (P, deg);
106+
WD.minpoly (P, seqrank);
107107
}
108108
else if (M.shapeFlags == Shape::Symmetric) {
109109
typedef BlackboxContainerSymmetric<Field, Blackbox> BBContainerSym;
110110
BBContainerSym TF (&A, A.field(), i);
111111
MasseyDomain< Field, BBContainerSym > WD (&TF, M.earlyTerminationThreshold);
112112

113-
WD.minpoly (P, deg);
113+
WD.minpoly (P, seqrank);
114114
}
115115
else {
116116
typedef BlackboxContainer<Field, Blackbox> BBContainer;
117117
BBContainer TF (&A, A.field(), i);
118118
MasseyDomain< Field, BBContainer > WD (&TF, M.earlyTerminationThreshold);
119119

120-
WD.minpoly (P, deg);
120+
WD.minpoly (P, seqrank);
121121
#ifdef INCLUDE_TIMING
122122
commentator().report (Commentator::LEVEL_IMPORTANT, TIMING_MEASURE)
123123
<< "Time required for applies: " << TF.applyTime () << std::endl;
@@ -130,15 +130,6 @@ namespace LinBox
130130
#endif // INCLUDE_TIMING
131131
}
132132

133-
// std::cerr << "P: " << P << std::endl;
134-
// std::cerr << "WD deg: " << deg << std::endl;
135-
if (!deg) {
136-
// zero sequence, matrix minpoly is X
137-
P.resize(2);
138-
A.field().assign(P[0],A.field().zero);
139-
A.field().assign(P[1],A.field().one);
140-
}
141-
142133
commentator().stop ("done", NULL, "minpoly");
143134

144135
return P;

linbox/algorithms/wiedemann.inl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ namespace LinBox
197197
commentator().start ("Solving nonsingular system (Wiedemann)", "WiedemannSolver::solveNonsingular");
198198

199199
Polynomial m_A(A.field());
200-
Vector z(A.field());
200+
Vector z(A.field(),0);
201201
bool ret = true;
202202

203203
{
@@ -289,7 +289,7 @@ namespace LinBox
289289
{
290290
commentator().start ("Solving singular system (Wiedemann)", "WiedemannSolver::solveSingular");
291291

292-
Vector Ax(A.field());
292+
Vector Ax(A.field(),0);
293293
ReturnStatus status = OK, sfrs = OK;
294294

295295

@@ -430,7 +430,7 @@ namespace LinBox
430430
commentator().start ("Solving singular system with generic rank profile (Wiedemann)",
431431
"WiedemannSolver::findRandomSolution");
432432

433-
Vector v(A.field()), Avpb(A.field()), PAvpb(A.field()), bp(A.field()), xp(A.field()), Qinvx(A.field());
433+
Vector v(A.field(),0), Avpb(A.field(),0), PAvpb(A.field(),0), bp(A.field(),0), xp(A.field(),0), Qinvx(A.field(),0);
434434

435435
RandomDenseStream<Field, Vector> stream (field(), _randiter, A.coldim ());
436436

@@ -503,7 +503,7 @@ namespace LinBox
503503
{
504504
commentator().start ("Finding a nullspace element (Wiedemann)", "WiedemannSolver::findNullspaceElement");
505505

506-
Vector v(A.field()), Av(A.field()), PAv(A.field()), vp(A.field()), xp(A.field()), Qinvx(A.field());
506+
Vector v(A.field(),0), Av(A.field(),0), PAv(A.field(),0), vp(A.field(),0), xp(A.field(),0), Qinvx(A.field(),0);
507507

508508
RandomDenseStream<Field, Vector> stream (field(), _randiter, A.coldim ());
509509

0 commit comments

Comments
 (0)