Changeset 3056
- Timestamp:
- 09/30/08 17:04:20 (2 months ago)
- Location:
- trunk/linbox
- Files:
-
- 4 modified
-
linbox/util/commentator.C (modified) (12 diffs)
-
linbox/util/commentator.h (modified) (8 diffs)
-
linbox/vector/vector-domain.h (modified) (1 diff)
-
tests/test-minpoly.C (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/linbox/linbox/util/commentator.C
r2814 r3056 81 81 82 82 Commentator::Commentator () 83 : cnull (new nullstreambuf), _estimationMethod (BEST_ESTIMATE), _format (OUTPUT_CONSOLE), 83 //: cnull (new nullstreambuf), _estimationMethod (BEST_ESTIMATE), _format (OUTPUT_CONSOLE), 84 : cnull ("/dev/null"), _estimationMethod (BEST_ESTIMATE), _format (OUTPUT_CONSOLE), 84 85 _show_timing (true), _show_progress (true), _show_est_time (true) 85 86 { … … 95 96 } 96 97 Commentator::Commentator (std::ostream& out) 97 : cnull (new nullstreambuf), _estimationMethod (BEST_ESTIMATE), _format (OUTPUT_CONSOLE), 98 //: cnull (new nullstreambuf), _estimationMethod (BEST_ESTIMATE), _format (OUTPUT_CONSOLE), 99 : cnull ("/dev/null"), _estimationMethod (BEST_ESTIMATE), _format (OUTPUT_CONSOLE), 98 100 _show_timing (true), _show_progress (true), _show_est_time (true) 99 101 { 100 registerMessageClass (BRIEF_REPORT, out, 1, LEVEL_IMPORTANT);102 //registerMessageClass (BRIEF_REPORT, out, 1, LEVEL_IMPORTANT); 101 103 registerMessageClass (BRIEF_REPORT, out, 1, LEVEL_IMPORTANT); 102 104 registerMessageClass (PROGRESS_REPORT, _report); … … 110 112 111 113 Commentator::~Commentator() { 112 std::map <const char *, MessageClass * , LessThanString>::iterator i;114 std::map <const char *, MessageClass * >::iterator i; 113 115 for (i = _messageClasses.begin (); i != _messageClasses.end (); ++i) 114 116 delete i->second; … … 182 184 if (isPrinted (_activities.size (), LEVEL_IMPORTANT, BRIEF_REPORT, fn)) 183 185 { 184 //std::cout << "calling finishA ";185 186 finishActivityReport (*top_act, msg); 186 //std::cout << std::endl;187 187 } 188 188 … … 282 282 { 283 283 MessageClass &briefReportClass = getMessageClass (BRIEF_REPORT); 284 std::map <const char *, MessageClass * , LessThanString>::iterator i;284 std::map <const char *, MessageClass *>::iterator i; 285 285 286 286 for (i = _messageClasses.begin (); i != _messageClasses.end (); ++i) … … 292 292 { 293 293 MessageClass &briefReportClass = getMessageClass (BRIEF_REPORT); 294 std::map <const char *, MessageClass * , LessThanString>::iterator i;294 std::map <const char *, MessageClass *>::iterator i; 295 295 296 296 for (i = _messageClasses.begin (); i != _messageClasses.end (); ++i) … … 336 336 { 337 337 MessageClass &briefReportClass = getMessageClass (BRIEF_REPORT); 338 std::map <const char *, MessageClass * , LessThanString>::iterator i;338 std::map <const char *, MessageClass *>::iterator i; 339 339 340 340 for (i = _messageClasses.begin (); i != _messageClasses.end (); ++i) … … 366 366 void Commentator::setReportStream (std::ostream &stream) 367 367 { 368 setMessageClassStream (BRIEF_REPORT, stream); 368 369 setMessageClassStream (PROGRESS_REPORT, stream); 369 370 setMessageClassStream (TIMING_MEASURE, stream); … … 472 473 void Commentator::finishActivityReport (Activity &activity, const char *msg) 473 474 { 474 //std::cout << "finishA " << _show_progress << _show_timing << std::endl;475 475 MessageClass &messageClass = getMessageClass (BRIEF_REPORT); 476 476 unsigned int i; … … 584 584 bool MessageClass::isPrinted (unsigned long depth, unsigned long level, const char *fn) 585 585 { 586 return 587 checkConfig (_configuration[""], depth, level) 588 || 589 ( fn != (const char *) 0 590 && 591 checkConfig (_configuration[fn], depth, level) 592 ); 593 /* 586 594 if (checkConfig (_configuration[""], depth, level)) 587 { //std::cout << " fn=\"\", d " << depth << ", l " << level << " false" << std::endl;588 595 return true; 589 }590 596 else if (fn != (const char *) 0) 591 597 //return checkConfig (_configuration[fn], depth, level); 592 598 { bool ans = checkConfig (_configuration[fn], depth, level); 593 599 if (ans) 594 { //std::c out<< " fn=" << fn << ", d " << depth << ", l " << level << " true" << std::endl;600 { //std::cerr << " fn=" << fn << ", d " << depth << ", l " << level << " true" << std::endl; 595 601 return true; 596 602 } 597 603 else 598 { //std::c out<< " fn=" << fn << ", d " << depth << ", l " << level << " false" << std::endl;604 { //std::cerr << " fn=" << fn << ", d " << depth << ", l " << level << " false" << std::endl; 599 605 return false; 600 606 } … … 602 608 603 609 else 604 { //std::c out<< " fn=0, d " << depth << ", l " << level << " false" << std::endl;610 { //std::cerr << " fn=0, d " << depth << ", l " << level << " false" << std::endl; 605 611 return false; 606 612 } 613 */ 607 614 } 608 615 … … 630 637 std::list <std::pair <unsigned long, unsigned long> >::iterator i; 631 638 632 i = config.begin (); 633 while (i != config.end ()) { 639 for ( i = config.begin (); i != config.end (); ++i) { 634 640 if (depth < i->first) { 635 if (level <= i->second)636 return true;637 else638 return false;639 }640 641 i++;641 //// uninitialized value error goes away if we ignore level. 642 //if (level <= i->second) 643 // return true; 644 //else 645 // return false; 646 return true; 647 } 642 648 } 643 649 -
trunk/linbox/linbox/util/commentator.h
r2962 r3056 83 83 class MessageClass; 84 84 class Commentator; 85 86 // Utility object needed for associative containers87 struct LessThanString88 {89 bool operator () (const char *str1, const char *str2) const90 { return strcmp (str1, str2) < 0; }91 };92 85 93 86 // \class ActivityState commentator.h linbox/util/commentator.h … … 528 521 /** Use this stream to disable a message class entirely 529 522 */ 530 std::o stream cnull;523 std::ofstream cnull; 531 524 532 525 private: 526 /* 533 527 // Null std::ostream prints nothing 534 528 struct nullstreambuf : public std::streambuf { … … 541 535 void imbue(const std::locale &loc) {} 542 536 }; 537 */ 543 538 544 539 protected: … … 567 562 std::stack<Activity *> _activities; // Stack of activity structures 568 563 569 std::map<const char *, MessageClass * , LessThanString>564 std::map<const char *, MessageClass *> 570 565 _messageClasses; 571 566 EstimationMethod _estimationMethod; // Activity estimator … … 668 663 669 664 private: 670 typedef std::map <const char *, std::list<std::pair <unsigned long, unsigned long> > , LessThanString> Configuration;665 typedef std::map <const char *, std::list<std::pair <unsigned long, unsigned long> > > Configuration; 671 666 672 667 class smartStreambuf : public std::streambuf … … 743 738 class Commentator { 744 739 public: 745 inline Commentator () : cnull (new nullstreambuf) {} 740 //inline Commentator () : cnull (new nullstreambuf) {} 741 inline Commentator () : cnull ("/dev/null") {} 746 742 inline ~Commentator () {} 747 743 inline void start (const char *description, const char *fn = (const char *) 0, unsigned long len = 0) {} … … 800 796 inline bool printed (long msglevel, const char *msgclass) { return false; } 801 797 802 std::o stream cnull;798 std::ofstream cnull; 803 799 804 800 private: 801 /* 805 802 // Null std::ostream prints nothing 806 803 struct nullstreambuf : public std::streambuf { … … 813 810 inline void imbue (const std::locale &loc) {} 814 811 }; 812 */ 815 813 816 814 MessageClass _msgcls; -
trunk/linbox/linbox/vector/vector-domain.h
r3027 r3056 423 423 //@} Implementation-Specific Methods 424 424 425 template <class Vector> 426 Vector& random(Vector& v) 427 { 428 typename Field::RandIter r(field()); 429 430 typedef typename Vector::iterator iterator; 431 for (iterator p = v.begin(); p != v.end(); ++p) r.random(*p); 432 return v; 433 } 434 425 435 protected: 426 436 -
trunk/linbox/tests/test-minpoly.C
r3031 r3056 363 363 364 364 static size_t n = 10; 365 static integer q = 2147483647U; 365 //static integer q = 2147483647U; 366 static integer q = 1000003; // ok for both Modular<int> and Modular<double> 366 367 static int iterations = 1; 367 368 static int numVectors = 1; … … 386 387 if (q > 5 && q % 2 != 0 && q % 3 != 0 && q % 5 != 0 ) 387 388 { 388 typedef Modular<LinBox::uint32> Field; 389 // typedef Modular<double> Field; 389 //typedef Modular<LinBox::uint32> Field; 390 //typedef Modular<int> Field; 391 typedef Modular<double> Field; 390 392 Field F (q); 391 393 srand (time (NULL));
