- Main Page
- Related Pages
- Classes
- Files

# work/git/mixpp/bdm/itpp_ext.h

    00001 //
    00002 // C++ Interface: itpp_ext
    00003 //
    00004 // Description:
    00005 //
    00006 //
    00007 // Author: smidl <smidl@utia.cas.cz>, (C) 2008
    00008 //
    00009 // Copyright: See COPYING file that comes with this distribution
    00010 //
    00011 //
    00012 #include <itpp/itbase.h>
    00013
    00014 #ifndef ITEX_H
    00015 #define ITEX_H
    00016
    00017 using std::cout;
    00018 using std::endl;
    00019
    00020 namespace itpp {
    00021         Array<int> to_Arr ( const ivec &indices );
    00022         ivec linspace ( int from, int to );
    00023
    00024         bvec operator& ( const bvec &a, const bvec &b );
    00025         bvec operator| ( const bvec &a, const bvec &b );
    00026
    00027 // template<class Num_T>
    00028 // void set_subvector(vec &ov, ivec &iv, const Vec<Num_T> &v);
    00029
    00030         void set_subvector ( vec &ov, const ivec &iv, const vec &v );
    00031
    00036         class Gamma_RNG {
    00037                 public:
    00039                         Gamma_RNG ( double a=1.0, double b=1.0 );
    00041                         void setup ( double a0, double b0 ) { alpha=a0; beta=b0;}
    00043                         double get_setup() const;
    00045                         double operator() () { return sample(); }
    00047                         vec operator() ( int n );
    00049                         mat operator() ( int h, int w );
    00050                 protected:
    00051                 private:
    00053                         double sample();
    00055                         double alpha;
    00057                         double beta;
    00059                         Random_Generator RNG;
    00060                         Normal_RNG NRNG;
    00062                         inline double exp_rand() {return -std::log ( RNG.random_01() );}
    00063                         inline double unif_rand() {return RNG.random_01();}
    00064                         inline double norm_rand() {return NRNG.sample();}
    00065
    00066         };
    00067
    00068         bool qr ( const mat &A, mat &R );
    00069
    00070 }
    00071
    00072
    00073 #endif //ITEX_H