Index: bdm/stat/libEF.h
===================================================================
--- bdm/stat/libEF.h (revision 281)
+++ bdm/stat/libEF.h (revision 283)
@@ -94,5 +94,5 @@
 //	virtual void flatten ( double nu0 ) {it_error ( "Not implemented" );}
 
-	BMEF* _copy_ ( bool changerv=false ) {it_error ( "function _copy_ not implemented for this BM" ); return NULL;};
+	BMEF* _copy_ ( bool changerv=false ) const {it_error ( "function _copy_ not implemented for this BM" ); return NULL;};
 };
 
@@ -348,4 +348,6 @@
  \f]
 
+Vector \f$\beta\f$ has different meaning (in fact it is 1/beta as used in definition of iG)
+
  Inverse Gamma can be converted to Gamma using \f[
  x\sim iG(a,b) => 1/x\sim G(a,1/b)
@@ -354,30 +356,16 @@
  */
 
-class eigamma : public eEF {
-protected:
-	//!internal egamma
-	egamma eg;
-	//! Vector \f$\alpha\f$
-	vec &alpha;
-	//! Vector \f$\beta\f$ (in fact it is 1/beta as used in definition of iG)
-	vec &beta;
+class eigamma : public egamma {
+protected:
 public :
 	//! \name Constructors
-	//!@{
-	eigamma ( ) :eEF ( ), eg(),alpha ( eg._alpha() ), beta ( eg._beta() ) {};
-	eigamma ( const vec &a, const vec &b ) :eEF ( ), eg(),alpha ( eg._alpha() ), beta ( eg._beta() ) {eg.set_parameters ( a,b );};
-	void set_parameters ( const vec &a, const vec &b ) {eg.set_parameters ( a,b );};
-	//!@}
-
-	vec sample() const {return 1.0/eg.sample();};
-	//! TODO: is it used anywhere?
-//	mat sample ( int N ) const;
-	double evallog ( const vec &val ) const {return eg.evallog ( val );};
-	double lognc () const {return eg.lognc();};
+	//! All constructors are inherited
+	//!@{
+	//!@}
+
+	vec sample() const {return 1.0/egamma::sample();};
 	//! Returns poiter to alpha and beta. Potentially dangerous: use with care!
 	vec mean() const {return elem_div ( beta,alpha-1 );}
 	vec variance() const {vec mea=mean(); return elem_div ( elem_mult ( mea,mea ),alpha-2 );}
-	vec& _alpha() {return alpha;}
-	vec& _beta() {return beta;}
 };
 /*
@@ -490,5 +478,5 @@
 	mgnorm() :mu ( epdf._mu() ) {ep=&epdf;}
 	//!set mean function
-	void set_parameters ( fnc* g0, const sq_T &R0 ) {g=g0; epdf.set_parameters ( zeros ( g->_dimy() ), R0 );}
+	void set_parameters ( fnc* g0, const sq_T &R0 ) {g=g0; epdf.set_parameters ( zeros ( g->dimension() ), R0 );}
 	void condition ( const vec &cond ) {mu=g->eval ( cond );};
 };
@@ -686,9 +674,11 @@
 
 	//! Set samples and weights
-	void set_parameters ( const vec &w0, const epdf* pdf0 );
+	void set_statistics ( const vec &w0, const epdf* pdf0 );
+	//! Set samples and weights
+	void set_statistics ( const epdf* pdf0 , int n ) {set_statistics ( ones ( n ) /n,pdf0 );};
 	//! Set sample
 	void set_samples ( const epdf* pdf0 );
 	//! Set sample
-	void set_n ( int n0, bool copy=true ) {n=n0; w.set_size ( n0,copy );samples.set_size ( n0,copy );};
+	void set_parameters ( int n0, bool copy=true ) {n=n0; w.set_size ( n0,copy );samples.set_size ( n0,copy );};
 	//! Potentially dangerous, use with care.
 	vec& _w()  {return w;};
@@ -700,5 +690,5 @@
 	const Array<vec>& _samples() const {return samples;};
 	//! Function performs resampling, i.e. removal of low-weight samples and duplication of high-weight samples such that the new samples represent the same density.
-	ivec resample ( RESAMPLING_METHOD method = SYSTEMATIC );
+	ivec resample ( RESAMPLING_METHOD method=SYSTEMATIC );
 	//! inherited operation : NOT implemneted
 	vec sample() const {it_error ( "Not implemented" );return 0;}
@@ -714,4 +704,19 @@
 		for ( int i=0;i<n;i++ ) {pom+=pow ( samples ( i ),2 ) *w ( i );}
 		return pom-pow ( mean(),2 );
+	}
+	//! For this class, qbounds are minimum and maximum value of the population!
+	void qbounds ( vec &lb, vec &ub, double perc=0.95 ) const {
+		// lb in inf so than it will be pushed below;
+		lb.set_size(dim);
+		ub.set_size(dim);
+		lb = std::numeric_limits<double>::infinity();
+		ub = -std::numeric_limits<double>::infinity();
+		int j;
+		for ( int i=0;i<n;i++ ) {
+			for ( j=0;j<dim; j++ ) {
+				if ( samples ( i ) ( j ) <lb ( j ) ) {lb ( j ) =samples ( i ) ( j );}
+				if ( samples ( i ) ( j ) >ub ( j ) ) {ub ( j ) =samples ( i ) ( j );}
+			}
+		}
 	}
 };
