From e09bb5551bd6160ba0fed79a150f2da13d8e958b Mon Sep 17 00:00:00 2001 From: nojhan Date: Thu, 17 Nov 2011 13:40:26 +0100 Subject: [PATCH 1/2] assert that the decimals parameters of the round repairer is <= 1.0 --- edo/src/edoRepairerRound.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/edo/src/edoRepairerRound.h b/edo/src/edoRepairerRound.h index c370a03c..a882021c 100644 --- a/edo/src/edoRepairerRound.h +++ b/edo/src/edoRepairerRound.h @@ -86,7 +86,11 @@ public: typedef typename EOT::AtomType ArgType; //! Generally speaking, we expect decimals being <= 1, but it can work for higher values - edoRepairerRoundDecimals( ArgType decimals ) : edoRepairerApplyBinary( edoRound, 1 / decimals ) {} + edoRepairerRoundDecimals( ArgType decimals ) : edoRepairerApplyBinary( edoRound, 1 / decimals ) + { + assert( decimals <= 1.0 ); + assert( 1/decimals >= 1.0 ); + } }; From 164a81a10caeba5ed1964cd817b1761108d91e11 Mon Sep 17 00:00:00 2001 From: nojhan Date: Thu, 17 Nov 2011 13:41:32 +0100 Subject: [PATCH 2/2] output pretty formated matrix in debug mode in the multi-normal sampler --- edo/src/edoSamplerNormalMulti.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/edo/src/edoSamplerNormalMulti.h b/edo/src/edoSamplerNormalMulti.h index 6099ed95..dc3519eb 100644 --- a/edo/src/edoSamplerNormalMulti.h +++ b/edo/src/edoSamplerNormalMulti.h @@ -29,6 +29,7 @@ Authors: #define _edoSamplerNormalMulti_h #include +#include #include #include @@ -110,6 +111,22 @@ public: return _L; } + template + std::string format(const MT& mat ) + { + std::ostringstream out; + + for( unsigned int i=0; i(Vl,Vl); + eo::log << eo::debug << std::endl << "Covariance matrix:" << format( V ) << std::endl; + #ifndef NDEBUG assert(Vl > 0); @@ -164,6 +183,8 @@ public: } else if( _use == robust ) { factorize_LDLT( V ); } + + eo::log << eo::debug << std::endl << "Decomposed matrix:" << format( _L ) << std::endl; } @@ -289,7 +310,7 @@ public: if( V(i,i) - sum >= 0 ) { _L(i,i) = sqrt( V(i,i) - sum); } else { - _L(i,i) = 0; + _L(i,i) = std::numeric_limits::epsilon(); } for ( j = i + 1; j < N; ++j ) { // rows