root/bdm/itpp_ext.h @ 32

Revision 32, 1.1 kB (checked in by smidl, 16 years ago)

test KF : estimation of R in KF is not possible! Likelihood of y_t is growing when R -> 0

  • Property svn:eol-style set to native
Line 
1//
2// C++ Interface: itpp_ext
3//
4// Description:
5//
6//
7// Author: smidl <smidl@utia.cas.cz>, (C) 2008
8//
9// Copyright: See COPYING file that comes with this distribution
10//
11//
12#include <itpp/itbase.h>
13
14using std::cout;
15using std::endl;
16
17namespace itpp {
18        Array<int> to_Arr(const ivec &indices);
19       
20  /*!
21    \brief Gamma distribution
22    \ingroup randgen
23  */
24  class Gamma_RNG {
25  public:
26    //! constructor. Set lambda.
27    Gamma_RNG(double a=1.0, double b=1.0);
28    //! Set lambda
29    void setup(double a0, double b0) { alpha=a0; beta=b0;}
30    //! get lambda
31    double get_setup() const;
32    //! Get one sample.
33    double operator()() { return sample(); }
34    //! Get a sample vector.
35    vec operator()(int n);
36    //! Get a sample matrix.
37    mat operator()(int h, int w);
38  protected:
39  private:
40    //!
41    double sample();
42    //!
43    double alpha;
44    //!
45    double beta;
46    //!
47    Random_Generator RNG;
48    Normal_RNG NRNG;
49    //! compatibility with R
50    inline double exp_rand(){return -std::log(RNG.random_01());}
51    inline double unif_rand(){return RNG.random_01();}
52    inline double norm_rand(){return NRNG.sample();}
53
54  };
55}
Note: See TracBrowser for help on using the browser.