Index: library/bdm/base/bdmbase.h
===================================================================
--- library/bdm/base/bdmbase.h (revision 733)
+++ library/bdm/base/bdmbase.h (revision 737)
@@ -149,6 +149,10 @@
 	friend std::ostream &operator<< ( std::ostream &os, const RV &rv );
 
-	string to_string() const {ostringstream o; o << *this; return o.str();}
-	
+	string to_string() const {
+		ostringstream o;
+		o << *this;
+		return o.str();
+	}
+
 	//! total size of a random variable
 	int _dsize() const {
@@ -183,13 +187,16 @@
 	//! returns name of a scalar at position scalat, i.e. it can be in the middle of vector name, in that case it adds "_%d" to it
 	std::string scalarname ( int scalat ) const {
-		bdm_assert(scalat<dsize,"Wrong input index");
-		int id=0;
-		int scalid=0;
-		while (scalid+SIZES(ids(id))<=scalat)  { scalid+=SIZES(ids(id)); id++;};
+		bdm_assert ( scalat < dsize, "Wrong input index" );
+		int id = 0;
+		int scalid = 0;
+		while ( scalid + SIZES ( ids ( id ) ) <= scalat )  {
+			scalid += SIZES ( ids ( id ) );
+			id++;
+		};
 		//now id is the id of variable of interest
-		if (size(id)==1)
+		if ( size ( id ) == 1 )
 			return  NAMES ( ids ( id ) );
 		else
-			return  NAMES ( ids ( id ) )+ "_" + num2str(scalat-scalid);
+			return  NAMES ( ids ( id ) ) + "_" + num2str ( scalat - scalid );
 
 	}
@@ -233,7 +240,7 @@
 	}
 	//! create new RV from the current one with time shifted by given value
-	RV copy_t(int dt) const {
-		RV tmp=*this;
-		tmp.t_plus(dt);
+	RV copy_t ( int dt ) const {
+		RV tmp = *this;
+		tmp.t_plus ( dt );
 		return tmp;
 	}
@@ -266,13 +273,13 @@
 	//! Minimum time-offset
 	int mint() const {
-		return times.length()>0 ? min (times) : 0;
+		return times.length() > 0 ? min ( times ) : 0;
 	}
 	//! Minimum time-offset of ids of given RVs
-	int mint(const RV &rv) const {
-		bvec belong=zeros_b(len);
-		for (int r=0; r<rv.length(); r++){
-			belong = belong | (ids == rv.id(r));
-		}
-		return times.length()>0 ? min (get_from_bvec(times,belong)) : 0;
+	int mint ( const RV &rv ) const {
+		bvec belong = zeros_b ( len );
+		for ( int r = 0; r < rv.length(); r++ ) {
+			belong = belong | ( ids == rv.id ( r ) );
+		}
+		return times.length() > 0 ? min ( get_from_bvec ( times, belong ) ) : 0;
 	}
 	//!@}
@@ -281,7 +288,7 @@
 
 	\code
-	class = 'RV';                   
+	class = 'RV';
 	names = {'a', 'b', 'c', ...};   // UNIQUE IDENTIFIER same names = same variable
-									// names are also used when storing results 
+									// names are also used when storing results
 	--- optional ---
 	sizes = [1, 2, 3, ...];         // size of each name. default = ones()
@@ -292,5 +299,5 @@
 	void from_setting ( const Setting &set );
 
-	void to_setting( Setting &set ) const;
+	void to_setting ( Setting &set ) const;
 
 	//! Invalidate all named RVs. Use before initializing any RV instances, with care...
@@ -312,70 +319,74 @@
 */
 class logger : public root {
-	protected:
-		//! RVs of all logged variables.
-		Array<RV> entries;
-		//! Names of logged quantities, e.g. names of algorithm variants
-		Array<string> names;
-		//!separator of prefixes of entries
-		const string separator;
-		//! Root Setting for storing Settings
-		Config setting_conf;
-		//! list of Settings for specific ids
-		Array<Setting*> settings;
-	public:
-		//!Default constructor
-		logger(const string separator0) : entries ( 0 ), names ( 0 ), separator(separator0) {}
-		
-		//! returns an identifier which will be later needed for calling the \c logit() function
-		//! For empty RV it returns -1, this entry will be ignored by \c logit().
-		virtual int add_vector ( const RV &rv, string prefix = "" ) {
-			int id;
-			if ( rv._dsize() > 0 ) {
-				id = entries.length();
-				names = concat ( names, prefix ); // diff
-				entries.set_length ( id + 1, true );
-				entries ( id ) = rv;
-			} else {
-				id = -1;
-			}
-			return id; // identifier of the last entry
-		}
-		virtual int add_setting(const string &prefix){
-			Setting &root=setting_conf.getRoot();
-			int id=root.getLength(); //root must be group!!
-			if (prefix.length()>0){
-				settings.set_length(id+1,true);
-				settings(id) = &root.add(prefix, Setting::TypeList);
-			} else {id=-1;}
-			return id;
-		}
-		
-		//! log this vector
-		virtual void log_vector ( int id, const vec &v ) {
-			bdm_error ( "Not implemented" );
-		};
-		
-		virtual Setting & log_to_setting (int id){
-			return settings(id)->add(Setting::TypeGroup);
-		}
-		
-		//! log this double
-		virtual void logit ( int id, const double &d ) {
-			bdm_error ( "Not implemented" );
-		};
-		
-		//! Shifts storage position for another time step.
-		virtual void step() {
-			bdm_error ( "Not implemneted" );
-		};
-		
-		//! Finalize storing information
-		virtual void finalize() {};
-		
-		//! Initialize the storage
-		virtual void init() {};
-		
-		//!separator of prefixes for this logger
-		const string& prefix_sep() {return separator;}
+protected:
+	//! RVs of all logged variables.
+	Array<RV> entries;
+	//! Names of logged quantities, e.g. names of algorithm variants
+	Array<string> names;
+	//!separator of prefixes of entries
+	const string separator;
+	//! Root Setting for storing Settings
+	Config setting_conf;
+	//! list of Settings for specific ids
+	Array<Setting*> settings;
+public:
+	//!Default constructor
+	logger ( const string separator0 ) : entries ( 0 ), names ( 0 ), separator ( separator0 ) {}
+
+	//! returns an identifier which will be later needed for calling the \c logit() function
+	//! For empty RV it returns -1, this entry will be ignored by \c logit().
+	virtual int add_vector ( const RV &rv, string prefix = "" ) {
+		int id;
+		if ( rv._dsize() > 0 ) {
+			id = entries.length();
+			names = concat ( names, prefix ); // diff
+			entries.set_length ( id + 1, true );
+			entries ( id ) = rv;
+		} else {
+			id = -1;
+		}
+		return id; // identifier of the last entry
+	}
+	virtual int add_setting ( const string &prefix ) {
+		Setting &root = setting_conf.getRoot();
+		int id = root.getLength(); //root must be group!!
+		if ( prefix.length() > 0 ) {
+			settings.set_length ( id + 1, true );
+			settings ( id ) = &root.add ( prefix, Setting::TypeList );
+		} else {
+			id = -1;
+		}
+		return id;
+	}
+
+	//! log this vector
+	virtual void log_vector ( int id, const vec &v ) {
+		bdm_error ( "Not implemented" );
+	};
+
+	virtual Setting & log_to_setting ( int id ) {
+		return settings ( id )->add ( Setting::TypeGroup );
+	}
+
+	//! log this double
+	virtual void logit ( int id, const double &d ) {
+		bdm_error ( "Not implemented" );
+	};
+
+	//! Shifts storage position for another time step.
+	virtual void step() {
+		bdm_error ( "Not implemneted" );
+	};
+
+	//! Finalize storing information
+	virtual void finalize() {};
+
+	//! Initialize the storage
+	virtual void init() {};
+
+	//!separator of prefixes for this logger
+	const string& prefix_sep() {
+		return separator;
+	}
 };
 
@@ -429,10 +440,12 @@
 	//! @{
 
-	pdf() : dimc ( 0 ), rvc(), dim(0), rv() { }
-
-	pdf ( const pdf &m ) : dimc ( m.dimc ), rvc ( m.rvc ), dim( m.dim), rv( m.rv ) { }
-	
+	pdf() : dimc ( 0 ), rvc(), dim ( 0 ), rv() { }
+
+	pdf ( const pdf &m ) : dimc ( m.dimc ), rvc ( m.rvc ), dim ( m.dim ), rv ( m.rv ) { }
+
 	//! copy of the current object - make sure to implement
-	virtual pdf* _copy_() const {return new pdf(*this);}
+	virtual pdf* _copy_() const {
+		return new pdf ( *this );
+	}
 	//!@}
 
@@ -488,7 +501,11 @@
 
 	//! access function
-	void set_dim(int d) {dim=d;}
+	void set_dim ( int d ) {
+		dim = d;
+	}
 	//! access function
-	void set_dimc(int d) {dimc=d;}
+	void set_dimc ( int d ) {
+		dimc = d;
+	}
 	//! Load from structure with elements:
 	//!  \code
@@ -535,9 +552,11 @@
 	@{*/
 	epdf() {};
-	epdf ( const epdf &e ) : pdf(e) {};
+	epdf ( const epdf &e ) : pdf ( e ) {};
 	void set_parameters ( int dim0 ) {
 		dim = dim0;
 	}
-	epdf* _copy_() const {return new epdf(*this);}
+	epdf* _copy_() const {
+		return new epdf ( *this );
+	}
 	//!@}
 
@@ -603,5 +622,5 @@
 	//!  #1 mean
 	//!  #2 mean + lower & upper bound
-	void log_register(logger &L, const string &prefix){
+	void log_register ( logger &L, const string &prefix ) {
 		RV r;
 		if ( isnamed() ) {
@@ -610,34 +629,35 @@
 			r = RV ( "", dimension() );
 		};
-		root::log_register(L,prefix);
-		
+		root::log_register ( L, prefix );
+
 		// log full data
-		if (log_level==10) {
-			logrec->ids.set_size(1);
-			logrec->ids(0) = logrec->L.add_setting(prefix);
+		if ( log_level == 10 ) {
+			logrec->ids.set_size ( 1 );
+			logrec->ids ( 0 ) = logrec->L.add_setting ( prefix );
 		} else {
-			// log only 
-			logrec->ids.set_size(3);
-			if (log_level >0){
-				logrec->ids(0) = logrec->L.add_vector ( r, prefix + logrec->L.prefix_sep()+ "mean" );
+			// log only
+			logrec->ids.set_size ( 3 );
+			if ( log_level > 0 ) {
+				logrec->ids ( 0 ) = logrec->L.add_vector ( r, prefix + logrec->L.prefix_sep() + "mean" );
 			}
-			if (log_level >1){
-				logrec->ids(1) = logrec->L.add_vector ( r, prefix + logrec->L.prefix_sep()+ "lb" );
-				logrec->ids(2) = logrec->L.add_vector ( r, prefix + logrec->L.prefix_sep()+ "ub" );
+			if ( log_level > 1 ) {
+				logrec->ids ( 1 ) = logrec->L.add_vector ( r, prefix + logrec->L.prefix_sep() + "lb" );
+				logrec->ids ( 2 ) = logrec->L.add_vector ( r, prefix + logrec->L.prefix_sep() + "ub" );
 			}
 		}
 	}
 	void log_write() const {
-		if (log_level==10){
-			to_setting(logrec->L.log_to_setting(logrec->ids(0)));
+		if ( log_level == 10 ) {
+			to_setting ( logrec->L.log_to_setting ( logrec->ids ( 0 ) ) );
 		} else {
-			if (log_level>0) {
-				logrec->L.log_vector( logrec->ids(0), mean() );
+			if ( log_level > 0 ) {
+				logrec->L.log_vector ( logrec->ids ( 0 ), mean() );
 			}
-			if (log_level>1) {
-				vec lb; vec ub;
-				qbounds(lb,ub);
-				logrec->L.log_vector( logrec->ids(1), lb );
-				logrec->L.log_vector( logrec->ids(2), ub );
+			if ( log_level > 1 ) {
+				vec lb;
+				vec ub;
+				qbounds ( lb, ub );
+				logrec->L.log_vector ( logrec->ids ( 1 ), lb );
+				logrec->L.log_vector ( logrec->ids ( 2 ), ub );
 			}
 		}
@@ -704,8 +724,10 @@
 	//! Efficient version of samplecond
 	virtual mat samplecond_mat ( const vec &cond, int N );
-	
+
 	void validate() {
 		iepdf.validate();
-		if (rv._dsize()< iepdf._rv()._dsize()) {rv=iepdf._rv();};
+		if ( rv._dsize() < iepdf._rv()._dsize() ) {
+			rv = iepdf._rv();
+		};
 		dim = iepdf.dimension();
 	}
@@ -789,5 +811,5 @@
 	}
 	//! for future use
-	virtual ~datalink(){}
+	virtual ~datalink() {}
 };
 
@@ -829,5 +851,5 @@
 		if ( v2h_up.length() > 0 ) {
 			history.shift_right ( 0, v2h_up.length() );
-		  history.set_subvector ( 0, val_up(v2h_up) ); 
+			history.set_subvector ( 0, val_up ( v2h_up ) );
 		}
 	}
@@ -854,15 +876,15 @@
 		ivec valid_ids = rv.findself_ids ( rv_up );
 		RV rv_hist = rv.subselect ( find ( valid_ids >= 0 ) ); // select only rvs that are in rv_up
-		RV rv_hist0 =rv_hist.remove_time();  // these RVs will form history at time =0
+		RV rv_hist0 = rv_hist.remove_time(); // these RVs will form history at time =0
 		// now we need to know what is needed from Up
 		rv_hist = rv_hist.expand_delayes(); // full regressor - including time 0
-		Hrv=rv_hist.subt(rv_hist0);   // remove time 0
+		Hrv = rv_hist.subt ( rv_hist0 );   // remove time 0
 		history = zeros ( Hrv._dsize() );
 
 		// decide if we need to copy val to history
-		if (Hrv._dsize() >0) {
-			v2h_up = rv_hist0.dataind(rv_up); // indeces of elements of rv_up to be copied
+		if ( Hrv._dsize() > 0 ) {
+			v2h_up = rv_hist0.dataind ( rv_up ); // indeces of elements of rv_up to be copied
 		} // else v2h_up is empty
-		
+
 		Hrv.dataind ( rv, h2v_hist, h2v_down );
 
@@ -871,10 +893,10 @@
 	}
 	//! set history of variable given by \c rv1 to values of \c hist.
-	void set_history(const RV& rv1, const vec &hist0){
-		bdm_assert(rv1._dsize()==hist0.length(),"hist is not compatible with given rv1");
+	void set_history ( const RV& rv1, const vec &hist0 ) {
+		bdm_assert ( rv1._dsize() == hist0.length(), "hist is not compatible with given rv1" );
 		ivec ind_H;
 		ivec ind_h0;
-		Hrv.dataind(rv1, ind_H, ind_h0); // find indeces of rv in 
-		set_subvector(history, ind_H, hist0(ind_h0)); // copy given hist to appropriate places
+		Hrv.dataind ( rv1, ind_H, ind_h0 ); // find indeces of rv in
+		set_subvector ( history, ind_H, hist0 ( ind_h0 ) ); // copy given hist to appropriate places
 	}
 };
@@ -957,10 +979,10 @@
 	vec get_cond ( const vec &val_up, const vec &cond_up ) {
 		vec tmp ( condsize );
-		fill_cond (val_up, cond_up, tmp );
+		fill_cond ( val_up, cond_up, tmp );
 		return tmp;
 	}
-	//! fill condition 
-	void fill_cond ( const vec &val_up, const vec &cond_up, vec& cond_out){
-		bdm_assert_debug(cond_out.length()>=condsize,"dl.fill_cond: cond_out is too small");
+	//! fill condition
+	void fill_cond ( const vec &val_up, const vec &cond_up, vec& cond_out ) {
+		bdm_assert_debug ( cond_out.length() >= condsize, "dl.fill_cond: cond_out is too small" );
 		set_subvector ( cond_out, v2c_lo, val_up ( v2c_up ) );
 		set_subvector ( cond_out, c2c_lo, cond_up ( c2c_up ) );
@@ -976,12 +998,12 @@
 /*! \brief Abstract class for discrete-time sources of data.
 
-The class abstracts operations of: 
-\li  data aquisition, 
-\li  data-preprocessing, such as  scaling of data, 
+The class abstracts operations of:
+\li  data aquisition,
+\li  data-preprocessing, such as  scaling of data,
 \li  data resampling from the task of estimation and control.
 Moreover, for controlled systems, it is able to receive the desired control action and perform it in the next step. (Or as soon as possible).
 
 The DataSource has three main data interaction structures:
-\li input, \f$ u_t \f$, 
+\li input, \f$ u_t \f$,
 \li output \f$ y_t \f$,
 \li data, \f$ d_t=[y_t,u_t, \ldots ]\f$ a collection of all inputs and outputs and possibly some internal variables too.
@@ -991,22 +1013,26 @@
 class DS : public root {
 protected:
-		//! size of data returned by \c getdata()
+	//! size of data returned by \c getdata()
 	int dtsize;
-		//! size of data
+	//! size of data
 	int utsize;
-		//!size of output
-		int ytsize;
+	//!size of output
+	int ytsize;
 	//!Description of data returned by \c getdata().
 	RV Drv;
 	//!Description of data witten by by \c write().
 	RV Urv; //
-		//!Description of output data
-		RV Yrv; //
+	//!Description of output data
+	RV Yrv; //
 public:
 	//! default constructors
-	DS() : dtsize(0),utsize(0),ytsize(0),Drv(), Urv(),Yrv() {log_level=1;};
+	DS() : dtsize ( 0 ), utsize ( 0 ), ytsize ( 0 ), Drv(), Urv(), Yrv() {
+		log_level = 1;
+	};
 
 	//! Returns maximum number of provided data, by default it is set to maximum allowed length, shorter DS should overload this method! See, MemDS.max_length().
-	virtual int max_length() {return std::numeric_limits< int >::max();}
+	virtual int max_length() {
+		return std::numeric_limits< int >::max();
+	}
 	//! Returns full vector of observed data=[output, input]
 	virtual void getdata ( vec &dt ) const {
@@ -1019,41 +1045,40 @@
 
 	//! Accepts action variable and schedule it for application.
-	virtual void write (const vec &ut ) {
+	virtual void write ( const vec &ut ) {
 		bdm_error ( "abstract class" );
 	}
 
 	//! Accepts action variables at specific indeces
-	virtual void write (const vec &ut, const ivec &indeces ) {
+	virtual void write ( const vec &ut, const ivec &indeces ) {
 		bdm_error ( "abstract class" );
 	}
 
 	//! Moves from \f$ t \f$ to \f$ t+1 \f$, i.e. perfroms the actions and reads response of the system.
-	virtual void step() 
-	{
+	virtual void step() {
 		bdm_error ( "abstract class" );
 	}
 
 	//! Register DS for logging into logger L
-	virtual void log_register (logger &L,  const string &prefix ) {
+	virtual void log_register ( logger &L,  const string &prefix ) {
 		bdm_assert ( ytsize == Yrv._dsize(), "invalid DS: ytsize (" + num2str ( ytsize ) + ") different from Drv " + num2str ( Yrv._dsize() ) );
 		bdm_assert ( utsize == Urv._dsize(), "invalid DS: utsize (" + num2str ( utsize ) + ") different from Urv " + num2str ( Urv._dsize() ) );
 
-		root::log_register(L,prefix);
-		//we know that 
-		if (log_level >0){
-			logrec->ids.set_size(2);
-			logrec->ids(0) = logrec->L.add_vector ( Yrv, prefix );
-			logrec->ids(1) = logrec->L.add_vector ( Urv, prefix );
+		root::log_register ( L, prefix );
+		//we know that
+		if ( log_level > 0 ) {
+			logrec->ids.set_size ( 2 );
+			logrec->ids ( 0 ) = logrec->L.add_vector ( Yrv, prefix );
+			logrec->ids ( 1 ) = logrec->L.add_vector ( Urv, prefix );
 		}
 	}
 	//! Register DS for logging into logger L
 	virtual void log_write ( ) const {
-		if (log_level >0) {
-			vec tmp ( Yrv._dsize() + Urv._dsize());
+		if ( log_level > 0 ) {
+			vec tmp ( Yrv._dsize() + Urv._dsize() );
 			getdata ( tmp );
 			// d is first in getdata
-			logrec->L.log_vector ( logrec->ids(0), tmp.left ( Yrv._dsize() ) );
+			logrec->L.log_vector ( logrec->ids ( 0 ), tmp.left ( Yrv._dsize() ) );
 			// u follows after d in getdata
-			logrec->L.log_vector ( logrec->ids(1), tmp.mid ( Yrv._dsize(), Urv._dsize() ) );
+			logrec->L.log_vector ( logrec->ids ( 1 ), tmp.mid ( Yrv._dsize(), Urv._dsize() ) );
 		}
 	}
@@ -1071,7 +1096,7 @@
 	}
 	//! set random variables
-	virtual void set_drv (const  RV &yrv, const RV &urv) {
+	virtual void set_drv ( const  RV &yrv, const RV &urv ) {
 		Yrv = yrv;
-		Drv = concat(yrv,urv);
+		Drv = concat ( yrv, urv );
 		Urv = urv;
 	}
@@ -1085,5 +1110,5 @@
 \f]
 where:
- * \f$ y_t \f$ is the variable 
+ * \f$ y_t \f$ is the variable
 Access to the resulting posterior density is via function \c posterior().
 
@@ -1109,5 +1134,5 @@
 	//! size of the conditioning vector
 	int dimc;
-	
+
 	//!Logarithm of marginalized data likelihood.
 	double ll;
@@ -1119,9 +1144,11 @@
 	//! @{
 
-	BM() : yrv(),dimy(0),rvc(),dimc(0), ll ( 0 ), evalll ( true ) { };
+	BM() : yrv(), dimy ( 0 ), rvc(), dimc ( 0 ), ll ( 0 ), evalll ( true ) { };
 //	BM ( const BM &B ) :  yrv ( B.yrv ), dimy(B.dimy), rvc ( B.rvc ),dimc(B.dimc), ll ( B.ll ), evalll ( B.evalll ) {}
 	//! \brief Copy function required in vectors, Arrays of BM etc. Have to be DELETED manually!
 	//! Prototype: \code BM* _copy_() const {return new BM(*this);} \endcode
-	virtual BM* _copy_() const { return NULL; };
+	virtual BM* _copy_() const {
+		return NULL;
+	};
 	//!@}
 
@@ -1132,12 +1159,12 @@
 	@param dt vector of input data
 	*/
-	virtual void bayes ( const vec &yt, const vec &cond=empty_vec ) = 0;
+	virtual void bayes ( const vec &yt, const vec &cond = empty_vec ) = 0;
 	//! Batch Bayes rule (columns of Dt are observations)
-	virtual void bayes_batch ( const mat &Dt, const vec &cond=empty_vec );
+	virtual void bayes_batch ( const mat &Dt, const vec &cond = empty_vec );
 	//! Batch Bayes rule (columns of Dt are observations, columns of Cond are conditions)
 	virtual void bayes_batch ( const mat &Dt, const mat &Cond );
 	//! Evaluates predictive log-likelihood of the given data record
-	//! I.e. marginal likelihood of the data with the posterior integrated out. 
-	//! This function evaluates only \f$ y_t \f$, condition is assumed to be the last used in bayes(). 
+	//! I.e. marginal likelihood of the data with the posterior integrated out.
+	//! This function evaluates only \f$ y_t \f$, condition is assumed to be the last used in bayes().
 	//! See bdm::BM::predictor for conditional version.
 	virtual double logpred ( const vec &yt ) const {
@@ -1170,21 +1197,21 @@
 	//! \name Access to attributes
 	//!@{
-		//! access function
-		const RV& _rvc() const {
-			return rvc;
-		}
-		//! access function
-		int dimensionc() const {
-			return dimc;
-		}
-		//! access function
-		int dimensiony() const {
-			return dimy;
-		}
-		//! access function
-		int dimension() const {
-			return posterior().dimension();
-		}
-		//! access function
+	//! access function
+	const RV& _rvc() const {
+		return rvc;
+	}
+	//! access function
+	int dimensionc() const {
+		return dimc;
+	}
+	//! access function
+	int dimensiony() const {
+		return dimy;
+	}
+	//! access function
+	int dimension() const {
+		return posterior().dimension();
+	}
+	//! access function
 	const RV& _yrv() const {
 		return yrv;
@@ -1196,9 +1223,9 @@
 	//! access to rv of the posterior
 	void set_rv ( const RV &rv ) {
-		const_cast<epdf&>(posterior()).set_rv ( rv );
+		const_cast<epdf&> ( posterior() ).set_rv ( rv );
 	}
 	//! access function
 	void set_dim ( int dim ) {
-		const_cast<epdf&>(posterior()).set_dim ( dim );
+		const_cast<epdf&> ( posterior() ).set_dim ( dim );
 	}
 	//! return internal log-likelihood of the last data vector
@@ -1220,10 +1247,10 @@
 	virtual void set_options ( const string &opt ) {
 		if ( opt.find ( "logfull" ) != string::npos ) {
-			const_cast<epdf&>(posterior()).set_log_level(10) ;
+			const_cast<epdf&> ( posterior() ).set_log_level ( 10 ) ;
 		} else {
 			if ( opt.find ( "logbounds" ) != string::npos ) {
-				const_cast<epdf&>(posterior()).set_log_level(2) ;
+				const_cast<epdf&> ( posterior() ).set_log_level ( 2 ) ;
 			} else {
-				const_cast<epdf&>(posterior()).set_log_level(1) ;
+				const_cast<epdf&> ( posterior() ).set_log_level ( 1 ) ;
 			}
 			if ( opt.find ( "logll" ) != string::npos ) {
@@ -1238,11 +1265,11 @@
 	//!  * x = level of the posterior (typically 0/1/2 for nothing/mean/bounds)
 	virtual void log_register ( logger &L, const string &prefix = "" ) {
-		root::log_register(L,prefix);		
-
-		const_cast<epdf&>(posterior()).log_register(L, prefix+L.prefix_sep()+"apost"); 
-		
-		if ((log_level) > 0){
-			logrec->ids.set_size(1);
-			logrec->ids(0) = L.add_vector(RV("",1), prefix+L.prefix_sep()+"ll");
+		root::log_register ( L, prefix );
+
+		const_cast<epdf&> ( posterior() ).log_register ( L, prefix + L.prefix_sep() + "apost" );
+
+		if ( ( log_level ) > 0 ) {
+			logrec->ids.set_size ( 1 );
+			logrec->ids ( 0 ) = L.add_vector ( RV ( "", 1 ), prefix + L.prefix_sep() + "ll" );
 		}
 	}
@@ -1250,5 +1277,7 @@
 	virtual void log_write ( ) const {
 		posterior().log_write();
-		if (log_level >0) { logrec->L.logit ( logrec->ids ( 0 ), ll );}
+		if ( log_level > 0 ) {
+			logrec->L.logit ( logrec->ids ( 0 ), ll );
+		}
 	}
 	//!@}
@@ -1264,7 +1293,7 @@
 		shared_ptr<RV> r3 = UI::build<RV> ( set, "rv", UI::optional );
 		if ( r3 ) {
-			set_rv(*r3);
-		}
-		
+			set_rv ( *r3 );
+		}
+
 		string opt;
 		if ( UI::get ( opt, set, "options", UI::optional ) ) {
