MNormal.h

00001 /*  _________________________________________________________________________
00002  *
00003  *  UTILIB: A utility library for developing portable C++ codes.
00004  *  Copyright (c) 2001, Sandia National Laboratories.
00005  *  This software is distributed under the GNU Lesser General Public License.
00006  *  For more information, see the README file in the top UTILIB directory.
00007  *  _________________________________________________________________________
00008  */
00009 
00010 //
00011 // MNormal.h
00012 //
00020 #ifndef _MNormal_h
00021 #define _MNormal_h
00022 
00023 #include "CRandVec.h"
00024 #include "Normal.h"
00025 #include "DoubleMatrix.h"
00026 #include "DoubleVector.h"
00027 
00028 
00029 class UTILIB_API MNormal: public CRandVec {
00030 
00031 public:
00032 
00034     MNormal();
00036     MNormal(RNG *gen, DoubleVector& mean_vec, DoubleMatrix& covariance);
00038     MNormal(RNG *gen, DoubleVector& mean_vec, DoubleVector& covariance);
00040     MNormal(RNG *gen, DoubleVector& mean_vec, double covariance);
00041 
00043     int set(DoubleVector& mean_vec, DoubleMatrix& covariance);
00045     int set(DoubleVector& mean_vec, DoubleVector& covariance);
00047     int set(DoubleVector& mean_vec, double covariance);
00048 
00050     virtual RNG *generator() {return CRandVec::generator();}
00052     virtual void generator(RNG *p);
00053 
00055     DoubleVector& operator()() {return this->CRandVec::operator()(); }
00057     void operator()(DoubleVector& new_vec);
00058 
00059 protected:
00060 
00062     Normal      norm_rng;
00064     DoubleMatrix CF_matrix;
00065 
00067     DoubleVector        mean_vec;
00069     DoubleVector        diag_covariance;
00071     double              const_covariance;
00073     int                 pd_flag;
00074 
00075 };
00076 
00077 
00078 inline void MNormal::generator(RNG *p)
00079 {
00080 CRandVec::generator(p);
00081 norm_rng.generator(p);
00082 }
00083 #endif
00084