Skip to content

Commit 9eb98c9

Browse files
authored
Merge pull request linbox-team#286 from linbox-team/zoempty
Zoempty
2 parents d500ee8 + ab4571d commit 9eb98c9

File tree

7 files changed

+25
-22
lines changed

7 files changed

+25
-22
lines changed

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/polynomial-matrix/polynomial-matrix-domain.h

100755100644
File mode changed.

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

linbox/blackbox/zo-gf2.inl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ namespace LinBox
243243

244244
value_type operator*() const
245245
{
246-
return _elem;
246+
return _elem;
247247
}
248248

249249
private:
@@ -298,16 +298,18 @@ namespace LinBox
298298
_row(rowidx),
299299
_col(colidx)
300300
{
301-
302301
if( _rowbeg == _rowend ) return;
303302

304303
while ( _colbeg == _rowbeg->end() ) {
305304

306305
if (++_rowbeg == _rowend) return;
307306

307+
++_row;
308+
308309
_colbeg = _rowbeg->begin();
309310

310311
}
312+
_col = *_colbeg;
311313

312314
}
313315

@@ -375,12 +377,12 @@ namespace LinBox
375377

376378
inline ZeroOne<GF2>::IndexedIterator ZeroOne<GF2>::indexBegin()
377379
{
378-
return ZeroOne<GF2>::IndexedIterator(0, this->begin(), this->end(), this->front().front(), this->front().begin() );
380+
return ZeroOne<GF2>::IndexedIterator(0, this->begin(), this->end(), 0, this->front().begin() );
379381
}
380382

381383
inline const ZeroOne<GF2>::IndexedIterator ZeroOne<GF2>::indexBegin() const
382384
{
383-
return ZeroOne<GF2>::IndexedIterator(0, this->begin(), this->end(), this->front().front(), this->front().begin() );
385+
return ZeroOne<GF2>::IndexedIterator(0, this->begin(), this->end(), 0, this->front().begin() );
384386
}
385387

386388
inline ZeroOne<GF2>::IndexedIterator ZeroOne<GF2>::indexEnd()

linbox/randiter/gf2.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434

3535
#include <time.h>
3636
#include "linbox/linbox-config.h"
37-
#include "linbox/integer.h"
38-
// #include "linbox/field/modular.h"
3937
#include "linbox/element/abstract.h"
4038
#include "linbox/element/envelope.h"
4139
#include "linbox/util/commentator.h"
@@ -48,6 +46,7 @@ namespace LinBox
4846
class GF2RandIter {
4947
public:
5048
typedef bool Element;
49+
typedef size_t Residu_t;
5150

5251
/** Constructor from field, sampling size, and seed.
5352
* The random field element iterator works in the field F, is seeded
@@ -63,13 +62,13 @@ namespace LinBox
6362
* generator (default = 0)
6463
*/
6564
GF2RandIter (const GF2 & F,
66-
const integer &size = 0 ,
67-
const integer &seed = 0)
65+
const size_t &seed = 0,
66+
const size_t &size = 0)
6867
{
69-
int32_t _seed = seed;
68+
size_t _seed = seed;
7069

71-
if (_seed == 0) _seed = (int32_t)time (NULL);
72-
MT.setSeed ((uint32_t)_seed);
70+
if (_seed == 0) _seed = (size_t)time (NULL);
71+
MT.setSeed (_seed);
7372
}
7473

7574
/// constructor
@@ -132,7 +131,7 @@ namespace LinBox
132131
}
133132

134133

135-
uint32_t& random (uint32_t& a) const
134+
size_t& random (size_t& a) const
136135
{ return a = MT.randomInt(); }
137136

138137
MersenneTwister& getMT() { return MT; }

tests/test-local-smith-form-sparseelim.C

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,10 @@ int main (int argc, char **argv) {
300300
FFLAS::writeCommandString(report << argv[0] << ' ', args) << std::endl;
301301
{ // sparseelim
302302
pass0 &= test_sparse_local_smith(rseed,r,m,n,Givaro::Integer(2),e,d);
303+
pass0 &= test_sparse_local_smith(rseed,r,m,n,Givaro::Integer(2),e,0.01); // to check code against issue #286 (first row is zero)
303304
pass0 &= test_sparse_local_smith(rseed,r,m,n,Givaro::Integer(q),e,d/2.);
304305
pass0 &= test_sparse_local_smith(rseed,r,m,n,uint64_t(2),e,d);
306+
pass0 &= test_sparse_local_smith(rseed,r,m,n,uint64_t(2),e,0.01); // to check code against issue #286 (first row is zero)
305307
pass0 &= test_sparse_local_smith(rseed,r,m,n,uint64_t(q),e,d/2.);
306308
pass0 &= ruint_test<6>(rseed,r,m,n,2,e,d);
307309
pass0 &= ruint_test<6>(rseed,r,m,n,q,e,d/2.);

tests/test-regression2.C

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,16 @@ int main (int argc, char **argv)
8787
commentator().setReportStream(std::cout);
8888
}
8989

90-
using GFt = GF2;
91-
using ZMatrix=ZeroOne<GFt>;
9290
using GMd = Givaro::Modular<double>;
9391
using MMatrix = SparseMatrix<GMd>;
9492

9593

9694
pass &= testWiedemannSingular<GMd,MMatrix>();
9795

9896
// Still failing: see https://github.com/linbox-team/linbox/issues/233
99-
// pass &= testWiedemannSingular<GFt,ZMatrix>();
97+
// using GFt = GF2;
98+
// using ZMatrix=ZeroOne<GFt>;
99+
// pass &= testWiedemannSingular<GFt,ZMatrix>();
100100

101101
return pass ? 0 : -1;
102102
}

0 commit comments

Comments
 (0)