root/bdm/itpp_ext.h @ 145

Revision 145, 1.5 kB (checked in by smidl, 16 years ago)

Oprava dokumentace

  • 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
14#ifndef ITEX_H
15#define ITEX_H
16
17using std::cout;
18using std::endl;
19
20namespace itpp {
21        Array<int> to_Arr ( const ivec &indices );
22        ivec linspace ( int from, int to );
23
24        bvec operator& ( const bvec &a, const bvec &b );
25        bvec operator| ( const bvec &a, const bvec &b );
26
27// template<class Num_T>
28// void set_subvector(vec &ov, ivec &iv, const Vec<Num_T> &v);
29
30        void set_subvector ( vec &ov, const ivec &iv, const vec &v );
31
32        /*!
33          \brief Gamma distribution
34          \ingroup randgen
35        */
36        class Gamma_RNG {
37                public:
38//! constructor. Set lambda.
39                        Gamma_RNG ( double a=1.0, double b=1.0 );
40                        //! Set lambda
41                        void setup ( double a0, double b0 ) { alpha=a0; beta=b0;}
42                        //! get lambda
43                        double get_setup() const;
44                        //! Get one sample.
45                        double operator() () { return sample(); }
46                        //! Get a sample vector.
47                        vec operator() ( int n );
48                        //! Get a sample matrix.
49                        mat operator() ( int h, int w );
50                protected:
51                private:
52                        //!
53                        double sample();
54                        //!
55                        double alpha;
56                        //!
57                        double beta;
58                        //!
59                        Random_Generator RNG;
60                        Normal_RNG NRNG;
61                        //! compatibility with R
62                        inline double exp_rand() {return -std::log ( RNG.random_01() );}
63                        inline double unif_rand() {return RNG.random_01();}
64                        inline double norm_rand() {return NRNG.sample();}
65
66        };
67
68        bool qr ( const mat &A, mat &R );
69
70}
71
72
73#endif //ITEX_H
Note: See TracBrowser for help on using the browser.