Index: library/bdm/estim/arx.h
===================================================================
--- library/bdm/estim/arx.h (revision 679)
+++ library/bdm/estim/arx.h (revision 700)
@@ -54,6 +54,6 @@
 	//! \name Constructors
 	//!@{
-	ARX ( const double frg0 = 1.0 ) : BMEF ( frg0 ),  have_constant(true), dyad(), est() {};
-	ARX ( const ARX &A0 ) : BMEF (A0.frg),  have_constant(A0.have_constant), dyad(A0.dyad),est(est) { };
+	ARX ( const double frg0 = 1.0 ) : BMEF ( frg0 ),  have_constant(true), dyad(), est(), alter_est() {};
+	ARX ( const ARX &A0 ) : BMEF (A0),  have_constant(A0.have_constant), dyad(A0.dyad),est(A0.est),alter_est(A0.alter_est) { };
 	ARX* _copy_() const;
 	void set_parameters ( double frg0 ) {
@@ -167,4 +167,6 @@
 /*! ARX model conditined by knowledge of the forgetting factor
 \f[ f(\theta| d_1 \ldots d_t , \phi_t) \f]
+
+The symbol \f$ \phi \f$ is assumed to be the last of the conditioning variables.
 */
 class ARXfrg : public ARX{
@@ -174,6 +176,13 @@
 		ARXfrg(const ARXfrg &A0):ARX(A0){};
 		ARXfrg* _copy_() const {ARXfrg *A = new ARXfrg(*this); return A;}
-	void condition(const vec &val){
-		frg = val(0);
+
+	void bayes(const vec &val, const vec &cond){
+		frg = cond(dimc-1); //  last in cond is phi
+		ARX::bayes(val,cond);
+	}
+	void validate() {
+		ARX::validate();
+		rvc.add(RV("{phi }",vec_1(1)));
+		dimc +=1;
 	}
 };
Index: library/bdm/estim/particles.cpp
===================================================================
--- library/bdm/estim/particles.cpp (revision 679)
+++ library/bdm/estim/particles.cpp (revision 700)
@@ -78,4 +78,5 @@
 	int n=pf->__w().length();
 	vec &lls = pf->_lls();
+	Array<vec> &samples=pf->__samples();
 	
 	// generate samples - time step
@@ -84,5 +85,8 @@
 	#pragma parallel for
 	for ( i = 0; i < n; i++ ) {
-		BMs(i) -> bayes(this2bm.pushdown(yt), this2bm.get_cond(yt,cond));
+		vec bm_cond(BMs(i)->dimensionc());
+		this2bm.fill_cond(yt,cond, bm_cond);
+		pf2bm.filldown(samples(i), bm_cond);
+		BMs(i) -> bayes(this2bm.pushdown(yt), bm_cond);
 		lls ( i ) += BMs(i)->_ll();
 	}
Index: library/bdm/estim/arx.cpp
===================================================================
--- library/bdm/estim/arx.cpp (revision 679)
+++ library/bdm/estim/arx.cpp (revision 700)
@@ -2,5 +2,8 @@
 namespace bdm {
 
-	void ARX::bayes_weighted ( const vec &yt, const vec &cond, const double w ) {
+void ARX::bayes_weighted ( const vec &yt, const vec &cond, const double w ) {
+		
+	bdm_assert_debug(yt.length()>=dimy,"ARX::bayes yt is smaller then dimc");	
+	bdm_assert_debug(cond.length()>=dimc,"ARX::bayes cond is smaller then dimc");	
 	double lnc;
 	//cache
Index: library/bdm/estim/particles.h
===================================================================
--- library/bdm/estim/particles.h (revision 693)
+++ library/bdm/estim/particles.h (revision 700)
@@ -157,5 +157,5 @@
 			res_threshold=0.5;
 		}
-		validate();
+		//validate();
 	}
 	//! load prior information from set and set internal structures accordingly
@@ -177,6 +177,8 @@
 	
 	void validate(){
+		bdm_assert(par,"PF::parameter_pdf not specified.");
 		n=_w.length();
 		lls=zeros(n);
+		
 		if (par->_rv()._dsize()>0) {
 			bdm_assert(par->_rv()._dsize()==est.dimension(),"Mismatch of RV and dimension of posterior" );
@@ -301,4 +303,6 @@
 	//! datalink from global yt and cond (Up) to PFs yt and cond (Down)
 	datalink_m2m this2pf;
+	//!datalink from PF part to BM
+	datalink_part pf2bm;
 	
 public:
@@ -367,12 +371,16 @@
 		}
 		//set drv
+		//??set_yrv(concat(BM0->_yrv(),u) );
+		set_yrv(BM0->_yrv() );
+		rvc = BM0->_rvc().subt(par->_rv());
 		//find potential input - what remains in rvc when we subtract rv
-		RV u = par->_rvc().remove_time().subt( par->_rv() ); 		
-		set_yrv(concat(BM0->_yrv(),u) );
+		RV u = par->_rvc().subt( par->_rv().copy_t(-1) ); 		
+		rvc.add(u);
+		dimc = rvc._dsize();
 		validate();
 	}
 	void validate(){
 		try{
-		pf->validate();
+			pf->validate();
 		} catch (std::exception &e){
 			throw UIException("Error in PF part of MPF:");
@@ -380,5 +388,6 @@
 		jest.read_parameters();
 		this2bm.set_connection(BMs(0)->_yrv(), BMs(0)->_rvc(), yrv, rvc);
-		this2bm.set_connection(pf->_yrv(), pf->_rvc(), yrv, rvc);
+		this2pf.set_connection(pf->_yrv(), pf->_rvc(), yrv, rvc);
+		pf2bm.set_connection(BMs(0)->_rvc(), pf->posterior()._rv());
 	}
 
Index: library/bdm/math/square_mat.h
===================================================================
--- library/bdm/math/square_mat.h (revision 619)
+++ library/bdm/math/square_mat.h (revision 700)
@@ -221,4 +221,6 @@
 	//! print full matrix
 	friend std::ostream &operator<< ( std::ostream &os, const fsqmat &sq );
+	//!access function
+	mat & _M (  ) {return M;};
 
 };
Index: library/bdm/mex/config2mxstruct.h
===================================================================
--- library/bdm/mex/config2mxstruct.h (revision 665)
+++ library/bdm/mex/config2mxstruct.h (revision 700)
@@ -2,5 +2,5 @@
 #define CFGSTR_H
 
-#include "../base/libconfig/libconfig.h++"
+#include "../base/libconfig/lib/libconfig.h++"
 #include <itpp/itbase.h>
 #include <itpp/itmex.h>
Index: library/bdm/mex/mex_parser.h
===================================================================
--- library/bdm/mex/mex_parser.h (revision 691)
+++ library/bdm/mex/mex_parser.h (revision 700)
@@ -3,5 +3,5 @@
 
 
-#include "../base/libconfig/lib/lib/libconfig.h++"
+#include "base/libconfig/lib/libconfig.h++"
 #include <itpp/itbase.h>
 #include <itpp/itmex.h>
Index: library/bdm/base/bdmbase.h
===================================================================
--- library/bdm/base/bdmbase.h (revision 693)
+++ library/bdm/base/bdmbase.h (revision 700)
@@ -266,5 +266,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 (times(belong)) : 0;
 	}
 	//!@}
@@ -598,5 +606,5 @@
 			logrec->L.logit( logrec->ids(0), mean() );
 		}
-		if (log_level>2) {
+		if (log_level>1) {
 			vec lb; vec ub;
 			qbounds(lb,ub);
@@ -913,5 +921,5 @@
 		//establish c2c connection
 		rvc.dataind ( rvc_up, c2c_lo, c2c_up );
-		bdm_assert_debug ( c2c_lo.length() + v2c_lo.length() == condsize, "cond is not fully given" );
+// 		bdm_assert_debug ( c2c_lo.length() + v2c_lo.length() == condsize, "cond is not fully given" );
 	}
 
@@ -919,7 +927,12 @@
 	vec get_cond ( const vec &val_up, const vec &cond_up ) {
 		vec tmp ( condsize );
-		set_subvector ( tmp, v2c_lo, val_up ( v2c_up ) );
-		set_subvector ( tmp, c2c_lo, cond_up ( c2c_up ) );
+		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");
+		set_subvector ( cond_out, v2c_lo, val_up ( v2c_up ) );
+		set_subvector ( cond_out, c2c_lo, cond_up ( c2c_up ) );
 	}
 	//! Fill
@@ -1077,5 +1090,5 @@
 
 	BM() : yrv(),dimy(0),rvc(),dimc(0), ll ( 0 ), evalll ( true ) { };
-	BM ( const BM &B ) :  yrv ( B.yrv ), dimy(B.dimy), rvc ( B.rvc ), ll ( B.ll ), evalll ( B.evalll ) {}
+//	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
Index: library/bdm/base/datasources.h
===================================================================
--- library/bdm/base/datasources.h (revision 697)
+++ library/bdm/base/datasources.h (revision 700)
@@ -132,4 +132,5 @@
 			dt =  zeros(iepdf->dimension());
 			dtsize=dt.length();
+			ytsize=dt.length();
 			set_drv(iepdf->_rv(),RV());
 			utsize =0;
@@ -365,7 +366,7 @@
 		class = "stateDS";
 		//Internal model
-		IM = { type = "mpdf-offspring"; };
+		IM = { type = "pdf-offspring"; };
 		//Observation model
-		OM = { type = "mpdf-offspring"; }
+		OM = { type = "pdf-offspring"; }
 		//initial state
 		x0 = [...]; //vector of data
Index: library/bdm/base/bdmbase.cpp
===================================================================
--- library/bdm/base/bdmbase.cpp (revision 693)
+++ library/bdm/base/bdmbase.cpp (revision 700)
@@ -53,5 +53,5 @@
 		id = iter->second;
 		if (size>0){
-			bdm_assert ( SIZES ( id ) == size, "RV " + name + " of different size already exists" );
+			bdm_assert ( SIZES ( id ) == size, "RV " + name + " of size " + num2str(SIZES(id)) + " exists, requested size " + num2str(size) + "can not be assigned" );
 		}
 	}
Index: library/tests/CMakeLists.txt
===================================================================
--- library/tests/CMakeLists.txt (revision 693)
+++ library/tests/CMakeLists.txt (revision 700)
@@ -41,5 +41,5 @@
 # using UnitTest++
 
-SET(unit_test_configurations  mepdf.cfg egiw.cfg mlnorm.cfg edirich.cfg mprod.cfg generator.cfg epdfds.cfg pdfds.cfg test_user_info_input.cfg merger.cfg erroneous.cfg egamma.cfg test_user_info_external.cfg merger_error.cfg mgamma.cfg enorm.cfg)
+SET(unit_test_configurations  egiw.cfg mlnorm.cfg edirich.cfg mprod.cfg generator.cfg epdfds.cfg pdfds.cfg test_user_info_input.cfg merger.cfg erroneous.cfg egamma.cfg test_user_info_external.cfg merger_error.cfg mgamma.cfg enorm.cfg)
 
 add_executable(testsuite arx_straux_test.cpp datalink_test.cpp  datasource_test.cpp egiw_test.cpp emix_test.cpp epdf_test.cpp logger_test.cpp LQG_test.cpp merger_test.cpp 
Index: library/tests/mepdf.cfg
===================================================================
--- library/tests/mepdf.cfg (revision 693)
+++  (revision )
@@ -1,20 +1,0 @@
-data = (
-{
-  class = "pdf_harness";
-  pdf = {
-      class = "enorm<ldmat>";
-      mu = [ 1.1, -1.0 ];
-      R = ( "matrix", 2, 2, [ 1.0, -0.5, -0.5, 2.0 ] );
-      rv : 
-      {
-	class = "RV";
-	names = ( "x", "y" );
-      };
-  };
-  cond = [ 1.5, 1.7 ];
-  mean = [ 1.1, -1.0 ];
-  R = ( "matrix", 2, 2, [ 1.0, -0.5, -0.5, 2.0 ] );
-  variance = [ 1.0, 2.0 ];
-  tolerance = 0.1;
-} );
-
