Index: library/bdm/stat/exp_family.h
===================================================================
--- library/bdm/stat/exp_family.h (revision 870)
+++ library/bdm/stat/exp_family.h (revision 878)
@@ -369,4 +369,5 @@
 	egiw ( int dimx0, ldmat V0, double nu0 = -1.0 ) : eEF() {
 		set_parameters ( dimx0, V0, nu0 );
+		validate();
 	};
 
@@ -465,7 +466,9 @@
 			UI::get ( dV, set, "dV", UI::compulsory );
 			set_parameters ( dimx, ldmat ( dV ), nu );
+			validate();
 
 		} else {
 			set_parameters ( dimx, V, nu );
+			validate();
 		}
 	}
@@ -479,5 +482,7 @@
 
 	void validate() {
-		// check sizes, rvs etc.
+	dim = dimx * ( dimx + nPsi ); 	
+	
+	    // check sizes, rvs etc.
 		// also check if RV are meaningful!!!
 		// meaningful =  rv for theta  and rv for r are split!
@@ -510,7 +515,9 @@
 	eDirich ( const eDirich &D0 ) : eEF () {
 		set_parameters ( D0.beta );
+		validate();
 	};
 	eDirich ( const vec &beta0 ) {
 		set_parameters ( beta0 );
+		validate();
 	};
 	void set_parameters ( const vec &beta0 ) {
@@ -718,8 +725,8 @@
 	egamma ( const vec &a, const vec &b ) {
 		set_parameters ( a, b );
+		validate();
 	};
 	void set_parameters ( const vec &a, const vec &b ) {
 		alpha = a, beta = b;
-		dim = alpha.length();
 	};
 	//!@}
@@ -845,5 +852,4 @@
 		nk = prod ( 1.0 / distance );
 		lnk = log ( nk );
-		dim = low.length();
 	}
 	//!@}
@@ -909,9 +915,12 @@
 		UI::get ( delta, set, "delta", UI::compulsory );
 		mean = UI::build<fnc> ( set, "mean", UI::compulsory );
-
 		iepdf.set_parameters ( -delta, delta );
+	}
+	
+	void validate(){
 		dimc = mean->dimensionc();
-		validate();
-	}
+		iepdf.validate();
+	}
+
 };
 UIREGISTER ( mguni );
@@ -935,4 +944,5 @@
 	mlnorm ( const mat &A, const vec &mu0, const sq_T &R ) : pdf_internal< TEpdf<sq_T> >() {
 		set_parameters ( A, mu0, R );
+		validate();
 	}
 
@@ -942,6 +952,6 @@
 		A = A0;
 		mu_const = mu0;
-		this->dimc = A0.cols();
-	}
+	}
+
 	//!@}
 	//! Set value of \c rvc . Result of this operation is stored in \c epdf use function \c _ep to access it.
@@ -1002,4 +1012,5 @@
 		bdm_assert ( A.rows() == mu_const.length(), "mlnorm: A vs. mu mismatch" );
 		bdm_assert ( A.rows() == _R().rows(), "mlnorm: A vs. R mismatch" );
+		this->dimc = A.cols();
 
 	}
@@ -1061,4 +1072,7 @@
 	void validate() {
 		bdm_assert ( g->dimension() == this->dimension(), "incompatible function" );
+		this->dim = g->dimension();
+		this->dimc = g->dimensionc();
+		this->iepdf.validate();
 	}
 };
@@ -1202,7 +1216,12 @@
 	void set_parameters ( int len, double k0 ) {
 		k = k0;
-		iepdf.set_parameters ( ( 1.0 / ( k*k ) + 2.0 ) *ones ( len ) /*alpha*/, ones ( len ) /*beta*/ );
+		iepdf.set_parameters ( ( 1.0 / ( k*k ) + 2.0 ) *ones ( len ) /*alpha*/, ones ( len ) /*beta*/ );		
+	};
+
+	void 	validate (){
+		iepdf.validate();
 		dimc = dimension();
-	};
+};
+
 	void condition ( const vec &val ) {
 		_beta = elem_mult ( val, ( _alpha - 1.0 ) );
@@ -1235,5 +1254,9 @@
 		mgamma::set_parameters ( k0, ref0 );
 		refl = pow ( ref0, 1.0 - l0 );
-		l = l0;
+		l = l0;	
+	};
+
+	void 	validate (){
+		mgamma::validate();
 		dimc = dimension();
 	};
@@ -1273,7 +1296,11 @@
 		refl = pow ( ref0, 1.0 - l0 );
 		l = l0;
+	};
+
+	void validate(){
+		migamma::validate();
 		dimc = dimension();
 	};
-
+	
 	void condition ( const vec &val ) {
 		vec mean = elem_mult ( refl, pow ( val, l ) );
@@ -1349,7 +1376,10 @@
 		sig2 = 0.5 * log ( k * k + 1 );
 		iepdf.set_parameters ( zeros ( size ), 2*sig2*eye ( size ) );
-
-		dimc = size;
-	};
+	};
+	
+	void validate(){
+		iepdf.validate();
+		dimc = iepdf.dimension();
+	}
 
 	void condition ( const vec &val ) {
@@ -1393,6 +1423,5 @@
 		Y = chmat ( Y0 );
 		delta = delta0;
-		p = Y.rows();
-		dim = p * p;
+		p = Y.rows();	
 	}
 	//! Set internal structures
@@ -1401,6 +1430,10 @@
 		delta = delta0;
 		p = Y.rows();
+		}
+	
+	virtual void validate (){
 		dim = p * p;
 	}
+
 	//! Sample matrix argument
 	mat sample_mat() const {
@@ -1470,5 +1503,6 @@
 	
 	virtual void 	validate (){
-      dim = W.dimension();
+		W.validate();
+		dim = W.dimension();
 	}
 	
@@ -1540,8 +1574,12 @@
 		l = l0;
 		refl = pow ( ref0, 1 - l );
-
 		iepdf.set_parameters ( eye ( p ), delta );
+	};
+	
+	void validate(){
+		iepdf.validate();
 		dimc = iepdf.dimension();
 	}
+	
 	void condition ( const vec &c ) {
 		vec z = c;
@@ -1841,6 +1879,4 @@
 void mgnorm<sq_T >::set_parameters ( const shared_ptr<fnc> &g0, const sq_T &R0 ) {
 	g = g0;
-	this->dim = g->dimension();
-	this->dimc = g->dimensionc();
 	this->iepdf.set_parameters ( zeros ( g->dimension() ), R0 );
 }
