Index: tests/testSmp.cpp
===================================================================
--- tests/testSmp.cpp (revision 262)
+++ tests/testSmp.cpp (revision 270)
@@ -32,5 +32,5 @@
 	
 	cout << "====== ENorm ====== " <<endl;
-	enorm<ldmat> eN(x);
+	enorm<ldmat> eN;
 	eN.set_parameters(mu0,R);
 	mat Smp = eN.sample(N);
@@ -40,8 +40,7 @@
 	cout << "====== MlNorm ====== " <<endl;
 	mat I = eye(2);
-	vec lik(N);
-	mlnorm<ldmat> ML(x,x);
+	mlnorm<ldmat> ML;
 	ML.set_parameters(I,zeros(2),R);
-	Smp = ML.samplecond_m(mu0,lik,N);
+	Smp = ML.samplecond_m(mu0,N);
 	
 	disp(mu0,R.to_mat(),Smp);
@@ -50,5 +49,5 @@
 	vec a = "100000,10000";
 	vec b = a/10.0;
-	egamma eG(x);
+	egamma eG;
 	eG.set_parameters(a,b);
 	
@@ -61,13 +60,13 @@
 
 	cout << "====== MGamma ====== " <<endl;	
-	mgamma mG(x,x);
+	mgamma mG;
 	double k = 10.0;
-	mG.set_parameters(k);
+	mG.set_parameters(k,mu0);
 
-	Smp=mG.samplecond_m(mu0,lik,N);
+	Smp=mG.samplecond_m(mu0,N);
 	disp(mu0,pow(mu0,2.0)/k,Smp);
 	
 	cout << "======= EMix ======== " << endl;
-	emix eMix(x);
+	emix eMix;
 	Array<epdf*> Coms(2);
 	Coms(0) = &eG;
@@ -82,9 +81,9 @@
 	mepdf meMix(&eMix);
 	
-	Smp = meMix.samplecond_m(mu0,lik,N);
+	Smp = meMix.samplecond_m(mu0,N);
 	disp(eMix.mean(),zeros(2),Smp);
 
 	cout << "======= MMix ======== " << endl;
-	mmix mMix(x,x);
+	mmix mMix;
 	Array<mpdf*> mComs(2);
 	mComs(0) = &mG;
@@ -94,15 +93,15 @@
 	mMix.set_parameters(vec_2(0.5,0.5),mComs);
 	
-	Smp = mMix.samplecond_m(mu0,lik,N);
+	Smp = mMix.samplecond_m(mu0,N);
 	disp(mMix._epdf().mean(),zeros(2),Smp);
 
 	cout << "======= EProd ======== " << endl;
 	// we have to change eG.rv to y
-	egamma eGy(x);
-	eGy.set_parameters(a,b);
+	eN.set_rv(x);
+	eG.set_rv(y);
 	//create array 
 	Array<mpdf*> A(2);
 	mepdf meN(&eN);
-	mepdf meG(&eGy);
+	mepdf meG(&eG);
 	A(0) = &meN;
 	A(1) = &meG;
@@ -114,6 +113,6 @@
 	
 	vec v0=vec(0);
-	Smp = eP.samplecond(v0,lik,N);
-	disp(concat(eN.mean(),eGy.mean()), epV,Smp);
+	Smp = eP.samplecond(v0,N);
+	disp(concat(eN.mean(),eG.mean()), epV,Smp);
 	
 	//Exit program:
Index: tests/testKF.cpp
===================================================================
--- tests/testKF.cpp (revision 262)
+++ tests/testKF.cpp (revision 270)
@@ -54,5 +54,5 @@
 
 	//Chol
-	KalmanCh KF(rx,ry,ru);
+	KalmanCh KF;
 	KF.set_parameters(A,B,C,D,chmat(R),chmat(Q));
 	KF.set_est(mu0,chmat(P0) ); //prediction!
@@ -63,5 +63,5 @@
 	//	
 	// FSQMAT
-	Kalman<ldmat> KFf(rx,ry,ru);
+	Kalman<ldmat> KFf;
 	KFf.set_parameters(A,B,C,D,ldmat(R),ldmat(Q));
 	KFf.set_est(mu0,ldmat(P0) );
@@ -77,7 +77,7 @@
 	
 	// EKF
-	bilinfn fxu(rx,ru,A,B);
-	bilinfn hxu(rx,ru,C,D);
-	EKFCh KFE(rx,ry,ru);
+	bilinfn fxu(A,B);
+	bilinfn hxu(C,D);
+	EKFCh KFE;
 	KFE.set_parameters(&fxu,&hxu,Q,R);
 	KFE.set_est(mu0,chmat(P0));
Index: tests/emix_test.cpp
===================================================================
--- tests/emix_test.cpp (revision 254)
+++ tests/emix_test.cpp (revision 270)
@@ -32,5 +32,5 @@
 	RV xy=concat(x,y);
 	
-	enorm<ldmat> E1 ( xy );
+	enorm<ldmat> E1; E1.set_rv ( xy );
 		
 	it_file iti("xxx");
@@ -41,5 +41,5 @@
 	cout << mu << R <<endl;
 	E1.set_parameters( mu, R);//"1.00054 1.0455" , mat ( "0.740142 -0.259015; -0.259015 1.0302" ));
-	enorm<ldmat> E2 ( xy );
+	enorm<ldmat> E2;E2.set_rv ( xy );
 	E2.set_parameters( "-1.2 -0.1" , mat ( "1 0.4; 0.4 0.5" ));
 
@@ -47,5 +47,5 @@
 	A1(0) = &E1;
 	
-	emix M1(xy);
+	emix M1; M1.set_rv(xy);
 	M1.set_parameters(vec("1"), A1, false);
 	cout << "======== test if ARX and emix with one ARX are the same ==="<<endl;
@@ -68,5 +68,5 @@
 	A2(1) = &E2;
 	
-	emix M2(xy);
+	emix M2; M2.set_rv(xy);
 	M2.set_parameters(vec("1"), A2, false);
 	
Index: tests/testKF_QR.cpp
===================================================================
--- tests/testKF_QR.cpp (revision 262)
+++ tests/testKF_QR.cpp (revision 270)
@@ -48,18 +48,18 @@
 	RV rQR("{Q,R }","3");
 	//
-	KFcondQR KF(rx,ry,ru,rQR);
+	KFcondQR KF;
 	// KF with R unknown
 	KF.set_parameters(A,B,C,D,ldmat(R),ldmat(Q));
 	KF.set_est(mu0,ldmat(P0) );
 	//
-	Kalman<ldmat> KFtr(rx,ry,ru);
+	Kalman<ldmat> KFtr;
 	// KF with R unknown
 	KFtr.set_parameters(A,B,C,D,ldmat(R),ldmat(Q));
 	KFtr.set_est(mu0,ldmat(P0) );
 		
-	mgamma evolQR(rQR,rQR);
-	evolQR.set_parameters(10.0); //sigma = 1/10 mu
+	mgamma evolQR;
+	evolQR.set_parameters(10.0,"1 1 1"); //sigma = 1/10 mu
 	
-	MPF<KFcondQR > KF_QR(rx,rQR,evolQR,evolQR,100,KF);
+	MPF<KFcondQR > KF_QR(&evolQR,&evolQR,100,KF);
 	evolQR.condition("1 1 1");
 	epdf& pfinit=evolQR._epdf();
Index: tests/merger_iter_test.cpp
===================================================================
--- tests/merger_iter_test.cpp (revision 262)
+++ tests/merger_iter_test.cpp (revision 270)
@@ -18,7 +18,7 @@
 	RV xy=x; xy.add(y);
 	
-	enorm<fsqmat> f1 ( xy );
-	enorm<fsqmat> f2 ( xy );
-	enorm<fsqmat> f3(y);
+	enorm<fsqmat> f1;f1.set_rv ( xy );
+	enorm<fsqmat> f2;f2.set_rv ( xy );
+	enorm<fsqmat> f3;f3.set_rv(y);
 		
  	f1.set_parameters ( "4 3",mat ( "0.4 0.3; 0.3 0.4" ) );
@@ -45,5 +45,5 @@
 	
 	merger M ( A );
-	enorm<fsqmat> g0(xy);
+	enorm<fsqmat> g0; g0.set_rv(xy);
 	g0.set_parameters(vec("4 4"),mat("1 0; 0 1"));
 	
@@ -52,5 +52,5 @@
 	
 	MixEF &MM = M._Mix();
-	epdf* MP = MM.predictor(xy);
+	epdf* MP = MM.epredictor();//xy
 	
 	vec Res1 = M.evallog_m(Grid);
Index: tests/testPF.cpp
===================================================================
--- tests/testPF.cpp (revision 262)
+++ tests/testPF.cpp (revision 270)
@@ -20,6 +20,6 @@
 	ldmat R(vR);
 		
-	eEmp emp(x,10);
-	euni eun(x);
+	eEmp emp;
+	euni eun;
 	eun.set_parameters("0","1");
 	emp.set_parameters(ones(10),&eun);
Index: tests/merger_2d_test.cpp
===================================================================
--- tests/merger_2d_test.cpp (revision 262)
+++ tests/merger_2d_test.cpp (revision 270)
@@ -18,6 +18,6 @@
 	RV xy=x; xy.add(y);
 	
-	enorm<fsqmat> f1 ( xy );
-	enorm<fsqmat> f2 ( xy );
+	enorm<fsqmat> f1; f1.set_rv ( xy );
+	enorm<fsqmat> f2; f1.set_rv ( xy );
 		
 	mat R1 ( "0.5 0.48; 0.48 0.5" );
@@ -43,5 +43,5 @@
 	
 	merger M ( A );
-	enorm<fsqmat> g0(xy);
+	enorm<fsqmat> g0; g0.set_rv(xy);
 	g0.set_parameters(vec("1 1"),mat("10 0; 0 10"));
 	
@@ -50,5 +50,5 @@
 	
 	MixEF &MM = M._Mix();
-	emix* MP = MM.predictor(xy);
+	emix* MP = MM.epredictor(); //xy
 	
 	vec Res1 = M.evallog_m(Grid);
Index: tests/testKF_QRexh.cpp
===================================================================
--- tests/testKF_QRexh.cpp (revision 262)
+++ tests/testKF_QRexh.cpp (revision 270)
@@ -53,5 +53,5 @@
 	//
 	//
-	Kalman<ldmat> KFtr ( rx,ry,ru );
+	Kalman<ldmat> KFtr;
 
 	for ( int i =0; i<vQ1.length();i++ ) {
Index: tests/mixef_test.cpp
===================================================================
--- tests/mixef_test.cpp (revision 254)
+++ tests/mixef_test.cpp (revision 270)
@@ -52,11 +52,11 @@
 	fsqmat V2 ( mat ( "2 -0.1; -0.1 2" ) );
 
-	enorm<fsqmat> C1 ( x );
+	enorm<fsqmat> C1; C1.set_rv ( x );
 	C1.set_parameters ( m1,V1 );
-	enorm<fsqmat> C2 ( x );
+	enorm<fsqmat> C2; C2.set_rv ( x );
 	C2.set_parameters ( m2,V2 );
 
 	Array<epdf*> Sim ( 2 ); Sim ( 0 ) =&C1;Sim ( 1 ) =&C2;
-	emix Simul ( x );
+	emix Simul;Simul.set_rv ( x );
 	Simul.set_parameters ( "0.5 0.6", Sim, false );
 
@@ -76,6 +76,6 @@
 	Vp*=5*1e-5;
 
-	ARX M1 ( RV ( "{Th1 }","6" ),V0 - Vp,8 );
-	ARX M2 ( RV ( "{Th2 }","6" ),V0 + Vp,8 );
+	ARX M1;M1.set_statistics(2,V0 - Vp,8 );
+	ARX M2;M2.set_statistics (2, V0 + Vp,8 );
 	
 	// Build mixture model
@@ -94,5 +94,6 @@
 	//TEST random initialization
 	RNG_randomize();
-	ARX Aflat=ARX(RV("{Th3 }",vec_1(6)),V0,7);
+	ARX Aflat;
+	Aflat.set_statistics(2,V0,7);
 	MixEF RND;
 	RND.init(&Aflat,Data,10); // already initialized!
Index: tests/testResample.cpp
===================================================================
--- tests/testResample.cpp (revision 262)
+++ tests/testResample.cpp (revision 270)
@@ -20,6 +20,6 @@
 	ldmat R(vR);
 		
-	eEmp emp(x,10);
-	euni eun(x);
+	eEmp emp;
+	euni eun;
 	eun.set_parameters("0","1");
 	emp.set_parameters(ones(10),&eun);
Index: tests/testEpdf.cpp
===================================================================
--- tests/testEpdf.cpp (revision 262)
+++ tests/testEpdf.cpp (revision 270)
@@ -20,5 +20,5 @@
 
 	cout << "====== ENorm ====== " <<endl;
-	enorm<fsqmat> eN ( rv );
+	enorm<fsqmat> eN;eN.set_rv ( rv );
 	eN.set_parameters ( mu0,R );
 	vec pdf = zeros ( x.length() );
Index: tests/enorm_test.cpp
===================================================================
--- tests/enorm_test.cpp (revision 254)
+++ tests/enorm_test.cpp (revision 270)
@@ -36,5 +36,6 @@
 	RV y ( "{y }" );
 
-	enorm<ldmat> E ( concat ( x,y ) );
+	enorm<ldmat> E;
+	E.set_rv(concat(x,y));
 	E.set_parameters ( mu,R );
 	cout << "enorm mean value:" << E.mean() <<endl;
@@ -65,5 +66,5 @@
 	mprod mEp ( A );
 
-	Smp=mEp.samplecond ( vec ( 0 ),ll,1000 );
+	Smp=mEp.samplecond ( vec ( 0 ),1000 );
 	Emu = sum ( Smp,2 ) /N;
 	Er = ( Smp*Smp.transpose() ) /N - outer_product ( Emu,Emu );
@@ -73,5 +74,5 @@
 	
 	cout << endl << " test of pdflog at zero "<<endl;
-	cout << "original: " << exp(E.evallog(vec("0 0"))) <<endl;
+	cout << "original: " << E.evallog(vec("0 0")) <<endl;
 	cout << "composite: " << mEp.evallogcond(vec("0 0"),vec(0)) << endl;
 }
Index: tests/merger_test.cpp
===================================================================
--- tests/merger_test.cpp (revision 262)
+++ tests/merger_test.cpp (revision 270)
@@ -12,11 +12,11 @@
 
 	RNG_randomize();
-	
+
 	RV x ( "{x }","1" );
 
-	RV z(x);
-	
-	enorm<fsqmat> f1 ( x );
-	enorm<fsqmat> f2 ( x );
+	RV z ( x );
+
+	enorm<fsqmat> f1; f1.set_rv ( x );
+	enorm<fsqmat> f2; f2.set_rv ( x );
 
 	f1.set_parameters ( "-5",mat ( "2" ) );
@@ -24,9 +24,9 @@
 
 	Array<mpdf* > A ( 2 );
-	mepdf A1(&f1);
-	mepdf A2(&f2);
+	mepdf A1 ( &f1 );
+	mepdf A2 ( &f2 );
 	A ( 0 ) =&A1;
 	A ( 1 ) =&A2;
-	
+
 	int Npoints=100;
 	mat x_grid ( 1,Npoints );
@@ -36,23 +36,23 @@
 
 	vec l_f2=f2.evallog_m ( x_grid );
-	mat lW(2,Npoints);
-	lW.set_row(0, l_f1);
-	lW.set_row(1, l_f2 );
+	mat lW ( 2,Npoints );
+	lW.set_row ( 0, l_f1 );
+	lW.set_row ( 1, l_f2 );
 
 	merger M ( A );
-	enorm<fsqmat> g0(x);
-	g0.set_parameters(vec("0.0"),mat("100.0"));
-	
-	M.set_parameters(1.2,200,3);
-	M.merge(&g0);
-	
-	vec m2 = M.lognorm_merge(lW);
-	vec mm2 = M.evallog_m(x_grid);
-	
-	it_file it("merger_test.it");
-	it << Name("x_grid") << x_grid;
-	it << Name("lf1") << l_f1;
-	it << Name("lf2") << l_f2;
-	it << Name("m2") << m2;
-	it << Name("mm2") << mm2;
+	enorm<fsqmat> g0; g0.set_rv ( x );
+	g0.set_parameters ( vec ( "0.0" ),mat ( "100.0" ) );
+
+	M.set_parameters ( 1.2,200,3 );
+	M.merge ( &g0 );
+
+	vec m2 = M.lognorm_merge ( lW );
+	vec mm2 = M.evallog_m ( x_grid );
+
+	it_file it ( "merger_test.it" );
+	it << Name ( "x_grid" ) << x_grid;
+	it << Name ( "lf1" ) << l_f1;
+	it << Name ( "lf2" ) << l_f2;
+	it << Name ( "m2" ) << m2;
+	it << Name ( "mm2" ) << mm2;
 }
Index: tests/datalink_test.cpp
===================================================================
--- tests/datalink_test.cpp (revision 262)
+++ tests/datalink_test.cpp (revision 270)
@@ -1,12 +1,4 @@
-
-#include "../bdm/stat/libBM.h"
-#include "../bdm/math/libDC.h"
-#include "../bdm/math/chmat.h"
-
+#include "../bdm/stat/libEF.h"
 using namespace bdm;
-
-//These lines are needed for use of cout and endl
-using std::cout;
-using std::endl;
 
 int main() {
@@ -15,8 +7,5 @@
 	RV c = RV ( "{c }" );
 
-	mpdf M1 ( concat ( a,b ),c );
-	mpdf M2 ( a, concat ( b,c ) );
-
-	datalink_m2m dl ( a,M2._rvc(),M1._rv(), M1._rvc() );
+	datalink_m2m dl ( a,concat(b,c),concat(a,b), c );
 
 	vec val ( "1 1.5 2" );
@@ -26,5 +15,5 @@
 	cout << "cond: " << cond  << endl;
 
-	cout << "lo val: " << dl.get_val ( val ) <<endl;
+	cout << "lo val: " << dl.pushdown ( val ) <<endl;
 	cout << "lo cond: " << dl.get_cond ( val,cond ) <<endl;
 
Index: tests/arx_test.cpp
===================================================================
--- tests/arx_test.cpp (revision 263)
+++ tests/arx_test.cpp (revision 270)
@@ -24,6 +24,6 @@
 	double nu0 = ord+5.0;
 
-	RV thr ( "{theta_and_r }",vec_1 ( ord+1 ) );   // Descriptive random variable
-	ARX Ar ( thr, V0, nu0 );                 // Estimator
+	ARX Ar;
+	Ar.set_statistics(1, V0, nu0 );                 // Estimator
 	const epdf& f_thr = Ar._epdf();          // refrence to posterior of the estimator
 
@@ -50,5 +50,5 @@
 
 		// Build predictor
-		mlstudent* 	Pr = Ar.predictor_student ( RV ( "{y }" ),RV ( "{y1 y2 y3 y4 }" ) );
+		mlstudent* 	Pr = Ar.predictor_student ( );
 		// Test similarity of likelihoods from the Bayes rule and the predictor
 		cout << "BR log-lik: " << Ar._ll();
@@ -63,4 +63,4 @@
 	
 	cout << "Structure estimation: " <<endl;
-	cout <<Ar.structure_est ( egiw ( thr,V0,nu0 ) ) <<endl;
+	cout <<Ar.structure_est ( egiw ( 1,V0,nu0 ) ) <<endl;
 }
Index: tests/egiw_test.cpp
===================================================================
--- tests/egiw_test.cpp (revision 254)
+++ tests/egiw_test.cpp (revision 270)
@@ -25,6 +25,5 @@
 		double nu=10;
 
-		RV thr ( "{thr }", "2" );
-		egiw E ( thr,nu*V,nu );
+		egiw E ( 1,nu*V,nu );
 		cout << "egiw mean value:" << E.mean() <<endl;
 		cout << "egiw normalizing constant:" << E.lognc() <<endl;
@@ -79,6 +78,5 @@
 		double nu=20;
 
-		RV thr ( "{thr }", "3" );
-		egiw E ( thr,nu*V,nu );
+		egiw E ( 1,nu*V,nu );
 		cout << "egiw mean value:" << E.mean() <<endl;
 		cout << "egiw normalizing constant:" << E.lognc() <<endl;
Index: tests/arx_elem_test.cpp
===================================================================
--- tests/arx_elem_test.cpp (revision 254)
+++ tests/arx_elem_test.cpp (revision 270)
@@ -1,9 +1,4 @@
 #include <estim/arx.h>
-#include <stat/libEF.h>
 using namespace bdm;
-
-//These lines are needed for use of cout and endl
-using std::cout;
-using std::endl;
 
 int main() {
@@ -11,6 +6,5 @@
 	//Test constructor
 	mat V0 = 0.00001*eye(2); V0(0,0)= 0.1; //
-	RV thr("{th r }");
-	ARX Ar(thr, V0, -1.0);
+	ARX Ar; Ar.set_statistics(1, V0, -1.0);
 				
 	mat mu(1,1);
@@ -39,9 +33,9 @@
 	X2.set_row(0,x);
 	
-	mlstudent* Ap = Ar.predictor_student(RV("{y }"),RV("{1 }"));
+	mlstudent* Ap = Ar.predictor_student();
 	vec Ap_x=Ap->evallogcond_m(X,vec_1(1.0));
 	vec ll_x = Ar.logpred_m(X2);
 	
-	cout << "normalize : " << xstep*sum(Ap_x) << endl;
+	cout << "normalize : " << xstep*sum(exp(Ap_x)) << endl;
 	cout << "normalize : " << xstep*sum(exp(ll_x)) << endl;
 	
Index: tests/UI/UIArxDS_test.cpp
===================================================================
--- tests/UI/UIArxDS_test.cpp (revision 268)
+++ tests/UI/UIArxDS_test.cpp (revision 270)
@@ -37,11 +37,11 @@
 	L->init();
 
-	vec dt=zeros ( DS->_drv().count() );   //data variable
-	datalink_e2e dl ( E->_drv(),DS->_drv() ); //datalink between a datasource and estimator
+	vec dt=zeros ( DS->_drv()._dsize() );   //data variable
+	datalink dl ( E->_drv(),DS->_drv() ); //datalink between a datasource and estimator
 
 	for ( int tK=1;tK<Ndat;tK++ ) {
 		DS->step();							// simulator step
 		DS->getdata ( dt );					// read data
-		E->bayes ( dl.get_val ( dt ) );		// update estimates
+		E->bayes ( dl.pushdown ( dt ) );		// update estimates
 
 		DS->logit ( *L );
