RE: [boost] regex lib: regex_grep w/ match_posix broken?

Actually, now that I look at the code, should it simply be
< if(((m_match_flags & match_not_null) == 0) && (m_presult->length() == 0)) ---
if(((m_match_flags & match_not_null) == 0) && (m_result.length() == 0))
just below the original patch? That _seems_ to work.
I've no time now, but I'll look into it, thanks,
John.
Thanks. BTW, meanwhile I noticed that it's not as simple as that. Above change helps with consecutive matches, but breaks empty matches, i.e. grepping "a*" over "---" gets stuck in an infinite loop. Ralph

Hi, to fulfill Jens Maurers wg21-proposal (C++ TR proposal) for random number facilities, a "Pseudo-random number engine" has to implement a 'seed()' method as written in chapter IV, "Proposed Text". Some of the boost generators don't implement this method, these are * linear_feedback_shift * additive_combine * inversive_congruential * discard_block * shuffle_output I added the missing method as seen in the diff quotes below. To test the changes I used the post-condition which has to be fulfilled after seed() has been called, namely u.seed() == X() (same state as after default constructor called) // test's //**************************************************************************** ecuyer1988 ec, ec1; rngTest.register_rng<ecuyer1988>("Ecuyer 1988"); ec.seed(); if (ec == ec1) std::cout << "* additive_combine -> OK \n"; else std::cout << "- additive_combine \n"; taus88 taus; rngTest.register_rng<taus88>("Tausworthe 88"); taus.seed(); taus88 taus1; if (taus == taus1) std::cout << "* linear_feedback -> OK \n"; else std::cout << "- linear_feedback \n"; boost::hellekalek1995 helle, helle1; rngTest.register_rng<boost::hellekalek1995>("Hellekalek 1995"); helle.seed(); if (helle == helle1) std::cout << "* inverse_cong -> OK \n"; else std::cout << "- inverse_cong \n"; boost::ranlux64_3_01 ranlux, ranlux1; rngTest.register_rng<boost::ranlux64_3_01>("RanLux 64 Base"); ranlux.seed(); if (ranlux == ranlux1) std::cout << "* discard_block -> OK \n"; else std::cout << "- discard_block \n"; boost::kreutzer1986 kreutz, kreutz1; rngTest.register_rng<boost::kreutzer1986>("Kreutzers Generator"); kreutz.seed(); if (kreutz == kreutz1) std::cout << "* shuffle_output -> OK \n"; else std::cout << "- shuffle_output \n"; //**************************************************************************** output: * additive_combine -> OK * linear_feedback -> OK * inverse_cong -> OK * discard_block -> OK * shuffle_output -> OK Bye Mario Ruetti Index: linear_feedback_shift.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/random/linear_feedback_shift.hpp,v retrieving revision 1.7 diff -r1.7 linear_feedback_shift.hpp 83c83 < void seed(UIntType s0) { assert(s0 >= (1 << (w-k))); value = s0; } ---
void seed(UIntType s0 = 341) { assert(s0 >= (1 << (w-k))); value = s0; }
Index: additive_combine.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/random/additive_combine.hpp,v retrieving revision 1.5 diff -r1.5 additive_combine.hpp 62a63,68
void seed() { _mlcg1.seed(); _mlcg2.seed(); }
Index: inversive_congruential.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/random/inversive_congruential.hpp,v retrieving revision 1.6 diff -r1.6 inversive_congruential.hpp 63c63 < void seed(IntType y0) { value = y0; if(b == 0) assert(y0 > 0); } ---
void seed(IntType y0 = 1) { value = y0; if(b == 0) assert(y0 > 0); }
Index: discard_block.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/random/discard_block.hpp,v retrieving revision 1.7 diff -r1.7 discard_block.hpp 52a53
void seed() { _rng.seed(); _n = 0; }
Index: shuffle_output.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/random/shuffle_output.hpp,v retrieving revision 1.6 diff -r1.6 shuffle_output.hpp 65a66
void seed() { _rng.seed(); init(); }
-- NEU : GMX Internet.FreeDSL Ab sofort DSL-Tarif ohne Grundgebühr: http://www.gmx.net/info

OK, for real tests, one should first generate some thousand random numbers before calling seed()....
To test the changes I used the post-condition which has to be fulfilled after seed() has been called, namely u.seed() == X() (same state as after default constructor called)
// test's
//****************************************************************************
ecuyer1988 ec, ec1; rngTest.register_rng<ecuyer1988>("Ecuyer 1988"); ec.seed(); if (ec == ec1) std::cout << "* additive_combine -> OK \n"; else std::cout << "- additive_combine \n";
taus88 taus; rngTest.register_rng<taus88>("Tausworthe 88"); taus.seed(); taus88 taus1; if (taus == taus1) std::cout << "* linear_feedback -> OK \n"; else std::cout << "- linear_feedback \n";
boost::hellekalek1995 helle, helle1; rngTest.register_rng<boost::hellekalek1995>("Hellekalek 1995"); helle.seed(); if (helle == helle1) std::cout << "* inverse_cong -> OK \n"; else std::cout << "- inverse_cong \n";
boost::ranlux64_3_01 ranlux, ranlux1; rngTest.register_rng<boost::ranlux64_3_01>("RanLux 64 Base"); ranlux.seed(); if (ranlux == ranlux1) std::cout << "* discard_block -> OK \n"; else std::cout << "- discard_block \n";
boost::kreutzer1986 kreutz, kreutz1; rngTest.register_rng<boost::kreutzer1986>("Kreutzers Generator"); kreutz.seed(); if (kreutz == kreutz1) std::cout << "* shuffle_output -> OK \n"; else std::cout << "- shuffle_output \n";
//****************************************************************************
output: * additive_combine -> OK * linear_feedback -> OK * inverse_cong -> OK * discard_block -> OK * shuffle_output -> OK
Bye Mario Ruetti
Index: linear_feedback_shift.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/random/linear_feedback_shift.hpp,v retrieving revision 1.7 diff -r1.7 linear_feedback_shift.hpp 83c83 < void seed(UIntType s0) { assert(s0 >= (1 << (w-k))); value = s0; } ---
void seed(UIntType s0 = 341) { assert(s0 >= (1 << (w-k))); value = s0; }
Index: additive_combine.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/random/additive_combine.hpp,v retrieving revision 1.5 diff -r1.5 additive_combine.hpp 62a63,68
void seed() { _mlcg1.seed(); _mlcg2.seed(); }
Index: inversive_congruential.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/random/inversive_congruential.hpp,v retrieving revision 1.6 diff -r1.6 inversive_congruential.hpp 63c63 < void seed(IntType y0) { value = y0; if(b == 0) assert(y0 > 0); } ---
void seed(IntType y0 = 1) { value = y0; if(b == 0) assert(y0 > 0); }
Index: discard_block.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/random/discard_block.hpp,v retrieving revision 1.7 diff -r1.7 discard_block.hpp 52a53
void seed() { _rng.seed(); _n = 0; }
Index: shuffle_output.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/random/shuffle_output.hpp,v retrieving revision 1.6 diff -r1.6 shuffle_output.hpp 65a66
void seed() { _rng.seed(); init(); }
-- NEU : GMX Internet.FreeDSL Ab sofort DSL-Tarif ohne Grundgebühr: http://www.gmx.net/info
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- NEU : GMX Internet.FreeDSL Ab sofort DSL-Tarif ohne Grundgebühr: http://www.gmx.net/info

Now I call the rng 10'000 times befor seeding like in the example below. All changed generators passed the test. ecuyer1988 ec, ec1; for(int i=0; i<10000; ++i) ec(); ec.seed(); if (ec == ec1) std::cout << "* additive_combine -> OK \n"; else std::cout << "- additive_combine \n";
OK, for real tests, one should first generate some thousand random numbers before calling seed()....
To test the changes I used the post-condition which has to be fulfilled after seed() has been called, namely u.seed() == X() (same state as after default constructor called)
-- NEU : GMX Internet.FreeDSL Ab sofort DSL-Tarif ohne Grundgebühr: http://www.gmx.net/info
participants (2)
-
Benzinger, Ralph
-
Mario Ruetti