int multivariate_normal_draw(dcovector & X, gsl_rng * r, const dsymatrix & Q){
      X.resize(Q.n);
      dgematrix L;
      int i;
      for (i=0;i<X.l;i++)
	    X(i)=gsl_ran_gaussian(r,1.);
      if(  cholesky(Q,L)){
	    X.zero();
	    return 1;
      }
      X=L*X;
      return 0;
}
int multivariate_normal_draw(dcovector & X, gsl_rng * r, const dgematrix & Q){
      X.resize(Q.n);
      dgematrix L;
      int i;
      int j;
      int N=Q.m;
      dsymatrix S(N);
      for (i=0;i<X.l;i++)
	    X(i)=gsl_ran_gaussian(r,1.);
      
      for (j=0;j<N;j++)
	    for(i=j;i<N;i++)
		  S(i,j)=Q(i,j);

      if(  cholesky(S,L)){
	    X.zero();
	    return 1;
      }
      X=L*X;
      return 0;
}