Index: library/bdm/stat/exp_family.h
===================================================================
--- library/bdm/stat/exp_family.h (revision 388)
+++ library/bdm/stat/exp_family.h (revision 395)
@@ -48,5 +48,9 @@
 			virtual double evallog_nn ( const vec &val ) const{it_error ( "Not implemented" );return 0.0;};
 			//!Evaluate normalized log-probability
-			virtual double evallog ( const vec &val ) const {double tmp;tmp= evallog_nn ( val )-lognc();it_assert_debug ( std::isfinite ( tmp ),"Infinite value" ); return tmp;}
+			virtual double evallog ( const vec &val ) const {
+				double tmp;
+				tmp= evallog_nn ( val )-lognc();
+				it_assert_debug ( std::isfinite ( tmp ),"Infinite value" ); 
+				return tmp;}
 			//!Evaluate normalized log-probability for many samples
 			virtual vec evallog ( const mat &Val ) const
@@ -125,4 +129,8 @@
 			void set_parameters ( const vec &mu,const sq_T &R );
 			void from_setting(const Setting &root);
+			void validate() {
+				it_assert(mu.length()==R.rows(),"parameters mismatch");
+				dim = mu.length();
+			}
 			//!@}
 
@@ -225,6 +233,17 @@
 			double& _nu()  {return nu;}
 			const double& _nu() const {return nu;}
-			//!@}
-	};
+			void from_setting(const Setting &set){
+				set.lookupValue("nu",nu);
+				set.lookupValue("dimx",dimx);
+				mat V;
+				UI::get(V,set,"V");
+				set_parameters(dimx, V, nu);
+				RV* rv=UI::build<RV>(set,"rv");
+				set_rv(*rv);
+				delete rv;
+			}
+			//!@}
+	};
+	UIREGISTER(egiw);
 
 	/*! \brief Dirichlet posterior density
@@ -370,6 +389,25 @@
 			vec mean() const {return elem_div ( alpha,beta );}
 			vec variance() const {return elem_div ( alpha,elem_mult ( beta,beta ) ); }
-	};
-
+			
+			//! Load from structure with elements:
+			//!  \code
+			//! { alpha = [...];         // vector of alpha
+			//!   beta = [...];          // vector of beta
+			//!   rv = {class="RV",...}  // description
+			//! }
+			//! \endcode
+			//!@}
+			void from_setting(const Setting &set){
+				epdf::from_setting(set); // reads rv
+				UI::get(alpha,set,"alpha");
+				UI::get(beta,set,"beta");
+				validate();
+			}
+			void validate(){
+				it_assert(alpha.length() ==beta.length(), "parameters do not match");
+				dim =alpha.length();
+			}
+	};
+UIREGISTER(egamma);
 	/*!
 	 \brief Inverse-Gamma posterior density
@@ -462,4 +500,17 @@
 			vec mean() const {return ( high-low ) /2.0;}
 			vec variance() const {return ( pow ( high,2 ) +pow ( low,2 ) +elem_mult ( high,low ) ) /3.0;}
+			//! Load from structure with elements:
+			//!  \code
+			//! { high = [...];          // vector of upper bounds
+			//!   low = [...];           // vector of lower bounds
+			//!   rv = {class="RV",...}  // description of RV
+			//! }
+			//! \endcode
+			//!@}
+			void from_setting(const Setting &set){
+				epdf::from_setting(set); // reads rv and rvc
+				UI::get(high,set,"high");
+				UI::get(low,set,"low");
+			}
 	};
 
@@ -650,6 +701,23 @@
 			void set_parameters ( double k, const vec &beta0 );
 			void condition ( const vec &val ) {_beta=k/val;};
-	};
-
+			//! Load from structure with elements:
+			//!  \code
+			//! { alpha = [...];         // vector of alpha
+			//!   k = 1.1;               // multiplicative constant k
+			//!   rv = {class="RV",...}  // description of RV
+			//!   rvc = {class="RV",...} // description of RV in condition
+			//! }
+			//! \endcode
+			//!@}
+			void from_setting(const Setting &set){
+				mpdf::from_setting(set); // reads rv and rvc
+				vec betatmp; // ugly but necessary
+				UI::get(betatmp,set,"beta");
+				set.lookupValue("k",k);
+				set_parameters(k,betatmp);
+			}
+	};
+	UIREGISTER(mgamma);
+	
 	/*!
 	\brief  Inverse-Gamma random walk
@@ -1088,18 +1156,16 @@
 		mu = mu0;
 		R = R0;
-		dim = mu0.length();
-	};
-
-	template<class sq_T>
-	void enorm<sq_T>::from_setting(const Setting &root){
-		vec mu;
-		UI::get(mu,root,"mu");
-		mat R;
-		UI::get(R,root,"R");
-		set_parameters(mu,R);
+		validate();
+	};
+
+	template<class sq_T>
+	void enorm<sq_T>::from_setting(const Setting &set){
+		epdf::from_setting(set); //reads rv
 		
-		RV* r = UI::build<RV>(root,"rv");
-		set_rv(*r); 
-		delete r;
+		UI::get(mu,set,"mu");
+		mat Rtmp;// necessary for conversion
+		UI::get(Rtmp,set,"R");
+		R=Rtmp; // conversion
+		validate();
 	}
 
