Index: /linux/gdb_bdm
===================================================================
--- /linux/gdb_bdm (revision 88)
+++ /linux/gdb_bdm (revision 182)
@@ -76,8 +76,9 @@
 
 define dv
-    output $arg0.data[0]@($arg0.datasize)
-end
-define dvx
-    output $arg0.data[0]@($arg0.datasize)
+	if $arg0.datasize >0
+    	output $arg0.data[0]@($arg0.datasize)
+	else
+		printf "{}"
+	end
 end
 
@@ -86,2 +87,8 @@
    dv $arg0.D
 end
+
+define drv
+	dv $arg0.ids
+	dv $arg0.sizes
+	dv $arg0.times
+end
Index: /bdm/estim/merger.cpp
===================================================================
--- /bdm/estim/merger.cpp (revision 180)
+++ /bdm/estim/merger.cpp (revision 182)
@@ -17,4 +17,6 @@
 		case 4:
 			break;
+		default: // Approximate conditional density
+			break;
 	}
 	return vec ( 0 );
@@ -34,5 +36,5 @@
 	for ( int i=0;i<Ns;i++ ) {	set_col_part ( Smp_ex,i,Smp ( i ) );}
 
-	dbg << Name ( "Smp0" ) << Smp_ex;
+	dbg << Name ( "Smp_0" ) << Smp_ex;
 
 	// Stuff for merging
@@ -45,5 +47,5 @@
 	mat V0=1e-8*eye ( rv.count() +1 );
 	ARX A0 ( RV ( "{th_r  }", vec_1 ( rv.count() * ( rv.count() +1 ) ) ),\
-	         V0, 4.0 ); //initial guess of Mix: zero mean, large variance
+	         V0, rv.count() *rv.count() +3.0 ); //initial guess of Mix: zero mean, large variance
 
 
@@ -53,6 +55,7 @@
 	int niter = 0;
 	char str[100];
-	
-	vec Mix_pdf(Ns);
+
+	epdf* Mpred;
+	vec Mix_pdf ( Ns );
 	while ( !converged ) {
 		//Re-estimate Mix
@@ -60,11 +63,12 @@
 		Mix.init ( &A0, Smp_ex, Nc );
 		Mix.bayesB ( Smp_ex );
-
+		Mpred = Mix.predictor(rv); // Allocation => must be deleted at the end!!
+	
 		// Generate new samples
-		eSmp.set_samples ( Mix.predictor ( rv ) );
+		eSmp.set_samples ( Mpred );
 		for ( int i=0;i<Ns;i++ ) {	set_col_part ( Smp_ex,i,Smp ( i ) );}
 
 		sprintf ( str,"Mpdf%d",niter );
-		for (int i=0;i<Ns;i++){Mix_pdf(i) = Mix.logpred(Smp_ex.get_col(i));}
+		for ( int i=0;i<Ns;i++ ) {Mix_pdf ( i ) = Mix.logpred ( Smp_ex.get_col ( i ) );}
 		dbg << Name ( str ) << Mix_pdf;
 
@@ -74,10 +78,44 @@
 		//Importace weighting
 		for ( int i=0;i<n;i++ ) {
+			lw_src=0.0;
+			//======== Same RVs ===========
 			//Split according to dependency in rvs
-			//======== Same RVs ===========
 			if ( rvsinrv ( i ).length() ==rv.count() ) {
 				// no need for conditioning or marginalization
-				for ( int j=0;j<Ns;j++ ) {
+				for ( int j=0;j<Ns; j++ ) { // Smp is Array<> => for cycle
 					lw_src ( j ) =mpdfs ( i )->_epdf().evalpdflog ( Smp ( j ) );
+				}
+			}
+			else {
+				vec smpk;
+				// compute likelihood of marginal on the conditional variable
+				if ( mpdfs ( i )->_rvc().count() >0 ) {
+					// Make marginal on rvc_i
+					epdf* tmp_marg = Mpred->marginal ( mpdfs ( i )->_rvc() );
+					lw_src += tmp_marg->evalpdflog_m ( get_vec(Smp(i), irv_rvcs(i) ) );
+					delete tmp_marg;
+				}
+				// Compute likelihood of the missing variable
+				if ( rv.count() > mpdfs ( i )->_rv().count() + mpdfs ( i )->_rvc().count() ) {
+					// There are variales unknown to mpdfs
+					RV z = ( rv.subt ( mpdfs ( i )->_rv() ) ).subt ( mpdfs ( i )->_rvc() );
+					mpdf* tmp_cond = Mpred->condition ( z ); 
+					// Indeces of rest rv in Smp
+					ivec zinrv=z.dataind ( rv ) ;
+					// Indeces of rest rvc in Smp
+					ivec zinrvc=tmp_cond->_rvc().dataind ( rv );
+					// Compute likelihood
+					for ( int k= 0; k<Ns; k++ ) {
+						smpk=Smp( k );
+						tmp_cond->condition ( get_vec ( smpk,zinrvc ) );
+						lw_src ( k ) += tmp_cond->_epdf().evalpdflog ( get_vec ( smpk,zinrv ) );
+					}
+					delete tmp_cond;
+				}
+				// Compute likelihood of the partial source
+				for ( int k= 0; k<Ns; k++ ) {
+					smpk=Smp( k );
+					mpdfs ( i )->condition ( get_vec ( smpk,irvcs_rv(i) ) );
+					lw_src ( k ) += mpdfs ( i )->_epdf().evalpdflog ( get_vec ( smpk, rvsinrv ( i ) ) );
 				}
 			}
@@ -92,7 +130,9 @@
 
 		w = lognorm_merge ( lW ); //merge
-
+		
 		sprintf ( str,"w%d",niter );
 		dbg << Name ( str ) << w;
+		sprintf ( str,"lw_m%d",niter );
+		dbg << Name ( str ) << lw_mix;
 
 		//Importance weighting
@@ -100,4 +140,7 @@
 		//renormalize
 		w /=sum ( w );
+
+		sprintf ( str,"w_is_%d",niter );
+		dbg << Name ( str ) << w;
 
 		eSmp.resample(); // So that it can be used in bayes
@@ -109,5 +152,5 @@
 		// ==== stopping rule ===
 		niter++;
-		converged = ( niter>3 );
+		converged = ( niter>20);
 	}
 
Index: /bdm/estim/merger.h
===================================================================
--- /bdm/estim/merger.h (revision 180)
+++ /bdm/estim/merger.h (revision 182)
@@ -60,8 +60,14 @@
 	//! weight w is a
 	vec sample ( )const { return Mix._epdf().sample();}
-	double evalpdflog ( const vec &dt ) const{ vec dtf=zeros(dt.length()+1); dtf.set_subvector(0,dt); return Mix.logpred ( dtf );}
+	double evalpdflog ( const vec &dt ) const{ 
+		vec dtf=ones(dt.length()+1); 	
+		dtf.set_subvector(0,dt); 
+		return Mix.logpred ( dtf );}
 	vec mean()const {return Mix._epdf().mean();}
 	//! for future use
 	virtual ~merger() {};
+	
+	//! Access function
+	MixEF& _Mix() {return Mix;}
 };
 
Index: /bdm/estim/arx.cpp
===================================================================
--- /bdm/estim/arx.cpp (revision 180)
+++ /bdm/estim/arx.cpp (revision 182)
@@ -62,4 +62,5 @@
 	
 	est.mean_mat(mu,R);
+	//here I know that mu can have only one column
 	tmp->set_parameters(mu.get_col(0),ldmat(R));
 	return tmp;
Index: /bdm/stat/libEF.cpp
===================================================================
--- /bdm/stat/libEF.cpp (revision 178)
+++ /bdm/stat/libEF.cpp (revision 182)
@@ -95,5 +95,5 @@
 	
 	// set mean value
-	M= iLsub*L ( xdim,end,0,xdim-1 );
+	M= L ( xdim,end,0,xdim-1 ).T()*iLsub;
 	R= ldR.to_mat()  ;
 }
@@ -207,5 +207,4 @@
 		N_babies ( j ) ++;
 	}
-
 	// We have assigned new babies for each Particle
 	// Now, we fill the resulting index such that:
Index: /bdm/stat/emix.cpp
===================================================================
--- /bdm/stat/emix.cpp (revision 181)
+++ /bdm/stat/emix.cpp (revision 182)
@@ -31,5 +31,18 @@
 }
 
-// mprod::mprod ( Array<mpdf*> mFacs, bool overlap) : mpdf ( RV(), RV() ), n ( mFacs.length() ), epdfs ( n ), mpdfs ( mFacs ), rvinds ( n ), rvcinrv ( n ), rvcsinrvc ( n ) {
+emix* emix::marginal(const RV &rv) const{
+	Array<epdf*> Cn(Coms.length());
+	for(int i=0;i<Coms.length();i++){Cn(i)=Coms(i)->marginal(rv);}
+	emix* tmp = new emix(rv);
+	tmp->set_parameters(w,Coms,false);
+	tmp->ownComs();
+	return tmp;
+}
+
+mratio* emix::condition(const RV &rv) const{
+	return new mratio(this,rv);
+};
+
+// mprod::mprod ( Array<mpdf*> mFacs, bool overlap) : mpdf ( RV(), RV() ), n ( mFacs.length() ), epdfs ( n ), mpdfs ( mFacs ), rvinds ( n ), rvcinrv ( n ), irvcs_rvc ( n ) {
 // 		int i;
 // 		bool rvaddok;
@@ -54,8 +67,8 @@
 // 			rvcinrv ( i ) = mpdfs ( i )->_rvc().dataind ( rv );
 // 			// find ith rvc in common rv
-// 			rvcsinrvc ( i ) = mpdfs ( i )->_rvc().dataind ( rvc );
+// 			irvcs_rvc ( i ) = mpdfs ( i )->_rvc().dataind ( rvc );
 // 			//
 // /*			if ( rvcinrv ( i ).length() >0 ) {independent = false;}
-// 			if ( rvcsinrvc ( i ).length() >0 ) {independent = false;}*/
+// 			if ( irvcs_rvc ( i ).length() >0 ) {independent = false;}*/
 // 		}
 // 	};
Index: /bdm/stat/libBM.cpp
===================================================================
--- /bdm/stat/libBM.cpp (revision 181)
+++ /bdm/stat/libBM.cpp (revision 182)
@@ -151,6 +151,38 @@
 		}
 	}
+	it_assert_debug(res.length()==tsize,"this rv is not fully present in crv!");
 	return res;
 
+}
+
+void RV::dataind (const RV &rv2, ivec &selfi, ivec &rv2i) const {
+	//clean results
+	selfi.set_size(0);
+	rv2i.set_size(0);
+	
+	// just in case any rv is empty
+	if ((len==0)||(rv2.length()==0)){return;} 
+	
+	//find comon rv
+	ivec cids=itpp::find(this->findself(rv2)>=0);
+	
+	// index of 
+	if ( cids.length()>0 ) {
+		str str1 = tostr();
+		str str2 = rv2.tostr();	
+		
+		ivec part1;
+		ivec part2;
+		int i,j;
+		// find common rv in strs
+		for ( j=0; j < cids.length();j++ ) {
+			i = cids(j);
+			part1 = itpp::find ( ( str1.ids == ids ( i ) ) & ( str1.times == times ( i ) ) );
+			part2 = itpp::find ( ( str2.ids == ids ( i ) ) & ( str2.times == times ( i ) ) );
+			selfi = concat ( selfi, part1 );
+			rv2i = concat ( rv2i, part2 );
+		}
+	}
+	it_assert_debug(selfi.length() == rv2i.length(),"this should not happen!");
 }
 
@@ -206,8 +238,6 @@
 		// find ith rv in common rv
 		rvsinrv ( i ) = mpdfs ( i )->_rv().dataind ( rv );
-		rvcsinrv ( i ) = mpdfs ( i )->_rvc().dataind ( rv );
-		rvinrvcs ( i ) = rv.dataind(mpdfs ( i )->_rvc());
-		//rvcsinrv and rvinrvcs must be 1-to-1
-		it_assert_debug(rvcsinrv ( i ).length()==rvinrvcs(i).length(),"" );
+		// establish link between rv and rvc
+		rv.dataind(mpdfs(i)->_rvc(), irv_rvcs(i), irvcs_rv(i));
 	}
 }
Index: /bdm/stat/libEF.h
===================================================================
--- /bdm/stat/libEF.h (revision 181)
+++ /bdm/stat/libEF.h (revision 182)
@@ -130,6 +130,6 @@
 	double lognc () const;
 	vec mean() const {return mu;}
-	mlnorm<sq_T>* condition ( const RV &rvn );
-	enorm<sq_T>* marginal ( const RV &rv );
+	mlnorm<sq_T>* condition ( const RV &rvn ) const ;
+	enorm<sq_T>* marginal ( const RV &rv ) const;
 //Access methods
 	//! returns a pointer to the internal mean value. Use with Care!
@@ -384,4 +384,7 @@
 	//! Set value of \c rvc . Result of this operation is stored in \c epdf use function \c _ep to access it.
 	void condition (const vec &cond );
+	
+/*	template<class sq_M>
+	friend std::ostream &operator<< ( std::ostream &os, const mlnorm<sq_M> &ml );*/
 };
 
@@ -594,5 +597,5 @@
 
 template<class sq_T>
-enorm<sq_T>* enorm<sq_T>::marginal ( const RV &rvn ) {
+enorm<sq_T>* enorm<sq_T>::marginal ( const RV &rvn ) const {
 	ivec irvn = rvn.dataind ( rv );
 
@@ -604,5 +607,5 @@
 
 template<class sq_T>
-mlnorm<sq_T>* enorm<sq_T>::condition ( const RV &rvn ) {
+mlnorm<sq_T>* enorm<sq_T>::condition ( const RV &rvn ) const {
 
 	RV rvc = rv.subt ( rvn );
@@ -620,5 +623,5 @@
 	int end=R.rows()-1;
 	mat S11 = S.get ( 0,n, 0, n );
-	mat S12 = S.get ( rvn.count(), end, 0, n );
+	mat S12 = S.get (0, n , rvn.count(), end );
 	mat S22 = S.get ( rvn.count(), end, rvn.count(), end );
 
@@ -636,4 +639,12 @@
 ///////////
 
+// template<class sq_T>
+// std::ostream &operator<< ( std::ostream &os, const mlnorm<sq_T> &ml ){
+// 	os << "A:"<< ml.A<<endl;
+// 	os << "mu:"<< ml.mu_const<<endl;
+// 	os << "R:" << ml.est._R().to_mat() <<endl;
+// 	return os;
+// }
+// ;
 
 #endif //EF_H
Index: /bdm/stat/emix.h
===================================================================
--- /bdm/stat/emix.h (revision 181)
+++ /bdm/stat/emix.h (revision 182)
@@ -19,4 +19,50 @@
 
 using namespace itpp;
+
+//this comes first because it is used inside emix!
+
+/*! \brief Class representing ratio of two densities
+which arise e.g. by applying the Bayes rule.
+It represents density in the form:
+\f[
+f(rv|rvc) = \frac{f(rv,rvc)}{f(rvc)}
+\f]
+where \f$ f(rvc) = \int f(rv,rvc) d\ rv \f$.
+
+In particular this type of arise by conditioning of a mixture model.
+
+At present the only supported operation is evalcond().
+ */
+class mratio: public mpdf {
+	protected:
+	//! Nominator in the form of mpdf
+		const epdf* nom;
+	//!Denominator in the form of epdf
+		epdf* den;
+	//!flag for destructor 
+		bool destroynom;
+	public:
+	//!Default constructor. By default, the given epdf is not copied! 
+	//! It is assumed that this function will be used only temporarily.
+		mratio(const epdf* nom0, const RV &rv, bool copy=false):mpdf(rv,RV()){
+			if (copy){
+//			nom = nom0->_copy_();
+				destroynom=true;
+			} else {
+				nom = nom0;
+				destroynom = false;
+			}
+			rvc = nom->_rv().subt(rv);
+			it_assert_debug(rvc.length()>0,"Makes no sense to use this object!");
+			den = nom->marginal(rvc);
+		};
+		double evalcond(const vec &val, const vec &cond) const {
+			return exp(nom->evalpdflog(concat(val,cond)) - den->evalpdflog(cond));
+		}
+	//! Object takes ownership of nom and will destroy it
+		void ownnom(){destroynom=true;}
+	//! Default destructor
+		~mratio(){delete den; if (destroynom) {delete nom;}}
+};
 
 /*!
@@ -41,5 +87,6 @@
 	//!Default constructor
 	emix ( const RV &rv ) : epdf ( rv ) {};
-	//! Set weights \c w and components \c Coms , Coms are not copied!
+	//! Set weights \c w and components \c Coms
+	//!By default Coms are copied inside. \param copy can be set to false if Coms live externally. Use method ownComs() if Coms should be destroyed by the destructor.
 	void set_parameters ( const vec &w, const Array<epdf*> &Coms, bool copy=true );
 
@@ -56,4 +103,16 @@
 		return log ( sum );
 	};
+	vec evalpdflog_m ( const mat &Val ) const {
+		vec x=ones(Val.cols());
+		vec y(Val.cols());
+		for (int i = 0; i < w.length(); i++ ) {
+			y = w ( i )*exp(Coms ( i )->evalpdflog_m ( Val ) );
+			elem_mult_inplace(y,x); //result is in x
+		}
+		return log(x);
+	};
+
+	emix* marginal ( const RV &rv ) const;
+	mratio* condition ( const RV &rv ) const; //why not mratio!!
 
 //Access methods
@@ -78,18 +137,16 @@
 	Array<epdf*> epdfs;
 	//! Indeces of rvc in common rvc
-	Array<ivec> rvcsinrvc;
+	Array<ivec> irvcs_rvc;
 	//! Indeces of common rvc in rvcs
-	Array<ivec> rvcinrvcs;
+	Array<ivec> irvc_rvcs;
 public:
 	/*!\brief Constructor from list of mFacs,
 	*/
-	mprod ( Array<mpdf*> mFacs ) : compositepdf ( mFacs ), mpdf ( getrv ( true ),RV() ), epdfs ( n ), rvcsinrvc ( n ) {
+	mprod ( Array<mpdf*> mFacs ) : compositepdf ( mFacs ), mpdf ( getrv ( true ),RV() ), epdfs ( n ), irvcs_rvc ( n ), irvc_rvcs ( n ) {
 		setrvc ( rv,rvc );
 		setindices ( rv );
 		for ( int i = 0;i < n;i++ ) {
-			// find ith rvc in common rv
-			rvcsinrvc ( i ) = mpdfs ( i )->_rvc().dataind ( rvc );
-			//and vice-versa
-			rvcinrvcs ( i ) = rvc.dataind ( mpdfs ( i )->_rvc() );
+			// establish link between rvc and rvcs
+			rvc.dataind ( mpdfs ( i )->_rvc(), irvc_rvcs ( i ), irvcs_rvc ( i ) );
 		}
 
@@ -99,15 +156,15 @@
 	};
 
-	double evalcond ( const vec &val, const vec &cond ) const {
+	double evalcond ( const vec &val, const vec &cond ) {
 		int i;
 		double res = 0.0;
 		vec condi;
-		for ( i = n - 1;i > 0;i++ ) {
-			if ( ( rvcsinrvc ( i ).length() > 0 ) || ( rvcsinrv ( i ).length() > 0 ) ) {
-				condi = zeros ( rvcsinrvc ( i ).length() +rvcsinrv ( i ).length() );
+		for ( i = n - 1;i >= 0;i-- ) {
+			if ( ( irvcs_rvc ( i ).length() > 0 ) || ( irvcs_rv ( i ).length() > 0 ) ) {
+				condi = zeros ( irvcs_rvc ( i ).length() +irvcs_rv ( i ).length() );
 				//copy part of the rvc into condi
-				set_subvector ( condi, rvcinrvcs ( i ), get_vec ( cond,rvcsinrvc ( i ) ) );
+				set_subvector ( condi, irvcs_rvc ( i ), get_vec ( cond,irvc_rvcs ( i ) ) );
 				//copy part of the rv into condi
-				set_subvector ( condi, rvinrvcs ( i ), get_vec ( val,rvcsinrv ( i ) ) );
+				set_subvector ( condi, irvcs_rv ( i ), get_vec ( val,irv_rvcs ( i ) ) );
 				mpdfs ( i )->condition ( condi );
 			}
@@ -115,5 +172,5 @@
 			res += epdfs ( i )->evalpdflog ( val ( rvsinrv ( i ) ) );
 		}
-		return res;
+		return exp ( res );
 	}
 	vec samplecond ( const vec &cond, double &ll ) {
@@ -123,10 +180,10 @@
 		ll = 0;
 		for ( int i = ( n - 1 );i >= 0;i-- ) {
-			if ( ( rvcsinrvc ( i ).length() > 0 ) || ( rvcsinrv ( i ).length() > 0 ) ) {
-				condi = zeros ( rvcsinrv ( i ).length() + rvcsinrvc ( i ).length() );
+			if ( ( irvcs_rvc ( i ).length() > 0 ) || ( irvcs_rv ( i ).length() > 0 ) ) {
+				condi = zeros ( irvcs_rv ( i ).length() + irvcs_rvc ( i ).length() );
 				// copy data in condition
-				set_subvector ( condi,rvcsinrvc ( i ), cond );
+				set_subvector ( condi,irvcs_rvc ( i ), get_vec ( cond, irvc_rvcs ( i ) ) );
 				// copy data in already generated sample
-				set_subvector ( condi,rvinrvcs ( i ), get_vec ( smp,rvcsinrv ( i ) ) );
+				set_subvector ( condi,irvcs_rv ( i ), get_vec ( smp,irv_rvcs ( i ) ) );
 
 				mpdfs ( i )->condition ( condi );
@@ -220,3 +277,4 @@
 	};
 };
+
 #endif //MX_H
Index: /bdm/stat/libBM.h
===================================================================
--- /bdm/stat/libBM.h (revision 181)
+++ /bdm/stat/libBM.h (revision 182)
@@ -92,6 +92,10 @@
 	//! generate \c str from rv, by expanding sizes
 	str tostr() const;
-	//! generate indeces into \param crv data vector that form data vector of self.
+	//! when this rv is a part of bigger rv, this function returns indeces of self in the data vector of the bigger crv.  
+	//! Then, data can be copied via: data_of_this = cdata(ind);
 	ivec dataind(const RV &crv) const;
+	//! generate mutual indeces when copying data betwenn self and crv. 
+	//! Data are copied via: data_of_this(selfi) = data_of_rv2(rv2i)
+	void dataind(const RV &rv2, ivec &selfi, ivec &rv2i) const;
 
 	//!access function
@@ -178,7 +182,7 @@
 	}
 	//! Return conditional density on the given RV, the remaining rvs will be in conditioning
-	mpdf* condition(const RV &rv){it_warning("Not implemented"); return NULL;}
+	virtual mpdf* condition(const RV &rv) const {it_warning("Not implemented"); return NULL;}
 	//! Return marginal density on the given RV, the remainig rvs are intergrated out
-	epdf* marginal(const RV &rv){it_warning("Not implemented"); return NULL;}
+	epdf* marginal(const RV &rv) const {it_warning("Not implemented"); return NULL;}
 
 	//! return expected value
@@ -248,4 +252,5 @@
 	//!Default constructor
 	mepdf (epdf &em ) :mpdf ( em._rv(),RV() ) {ep=&em;};
+	void condition(const vec &cond){}
 };
 
@@ -260,9 +265,9 @@
 		Array<ivec> rvsinrv;
 		//! Indeces of rvc in common rv
-		Array<ivec> rvcsinrv;
+		Array<ivec> irvcs_rv;
 		//! Indeces of common rv in rvc
-		Array<ivec> rvinrvcs;
+		Array<ivec> irv_rvcs;
 	public:
-		compositepdf(Array<mpdf*> A0): n(A0.length()), mpdfs(A0), rvsinrv(n), rvcsinrv(n),rvinrvcs(n){};
+		compositepdf(Array<mpdf*> A0): n(A0.length()), mpdfs(A0), rvsinrv(n), irvcs_rv(n),irv_rvcs(n){};
 		//! find common rv, flag \param checkoverlap modifies whether overlaps are acceptable
 		RV getrv(bool checkoverlap=false);
Index: /tests/enorm_test.cpp
===================================================================
--- /tests/enorm_test.cpp (revision 179)
+++ /tests/enorm_test.cpp (revision 182)
@@ -71,3 +71,7 @@
 	cout << "composite mean: " <<Emu <<endl;
 	cout << "composite variance: " <<Er <<endl;
+	
+	cout << endl << " test of pdflog at zero "<<endl;
+	cout << "original: " << exp(E.evalpdflog(vec("0 0"))) <<endl;
+	cout << "composite: " << mEp.evalcond(vec("0 0"),vec(0)) << endl;
 }
Index: /tests/merger_test.cpp
===================================================================
--- /tests/merger_test.cpp (revision 180)
+++ /tests/merger_test.cpp (revision 182)
@@ -48,29 +48,8 @@
 	vec mm2 = M.evalpdflog_m(x_grid);
 	
-/*	M.set_parameters(1.0,10,3);
-	vec m1 = M.lognorm_merge(lW);
-	M.merge(&g0);
-	vec mm1 = M.evalpdflog_m(x_grid);
-	
-	M.set_parameters(3.0,10,3);
-	vec m3 = M.lognorm_merge(lW);
-	M.merge(&g0);
-	vec mm3 = M.evalpdflog_m(x_grid);
-	
-	M.set_parameters(300.0,10,3);
-	vec m300 = M.lognorm_merge(lW);
-	M.merge(&g0);
-	vec mm300 = M.evalpdflog_m(x_grid);*/
-		
 	it_file it("merger_test.it");
 	it << Name("lf1") << l_f1;
 	it << Name("lf2") << l_f2;
-/*	it << Name("m1") << m1;
-	it << Name("mm1") << mm1;*/
 	it << Name("m2") << m2;
 	it << Name("mm2") << mm2;
-/*	it << Name("m3") << m3;
-	it << Name("mm3") << mm3;
-	it << Name("m300") << m300;
-	it << Name("mm300") << mm300;*/
 }
Index: /tests/rv_test.cpp
===================================================================
--- /tests/rv_test.cpp (revision 162)
+++ /tests/rv_test.cpp (revision 182)
@@ -42,4 +42,13 @@
 	cout << ac.dataind(abc) <<endl;
 	
+	cout<< "copy indeces between ba and ab" << endl;
+	RV ba = b;
+	ba.add(a);
+	
+	ivec ai;
+	ivec bi;
+	ba.dataind(ac,ai,bi);
+	cout << "ba(" << ai <<")=ac(" << bi <<")"<<endl;
+	
 	//Exit program:
 	
Index: /tests/CMakeLists.txt
===================================================================
--- /tests/CMakeLists.txt (revision 179)
+++ /tests/CMakeLists.txt (revision 182)
@@ -23,20 +23,27 @@
 # Add executable called "helloDemo" that is built from the source files
 # "demo.cxx" and "demo_b.cxx".  The extensions are automatically found.
+
+# BASIC TESTS
+TEST(rv_test)
+TEST(loggers_test)
+
 TEST(chmat_test)
 TEST(ldmat_test)
 TEST(fsqmat_test)
-TEST(arx_test)
-TEST(loggers_test)
-TEST(rv_test)
-TEST(merger_test)
-TEST(mixef_test)
 TEST(enorm_test)
 TEST(egiw_test)
 TEST(test0)
+TEST(testResample)
+
+# ESTIM TESTS
+TEST(arx_test)
+TEST(merger_test)
+TEST(merger_iter_test)
+TEST(mixef_test)
+
 TEST(testKF)
 TEST(testPF)
 TEST(testSmp)
 TEST(testEpdf)
-TEST(testResample)
 TEST(testKF_QR)
 TEST(testKF_QRexh)
