00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
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         vec get_vec(const vec &v, const ivec &indexlist);
00025         
00026         bvec operator& ( const bvec &a, const bvec &b );
00027         bvec operator| ( const bvec &a, const bvec &b );
00028 
00029 
00030 
00031 
00032         void set_subvector ( vec &ov, const ivec &iv, const vec &v );
00033 
00034         template<class Num_T> inline
00035         void set_col_part(mat &M, int c, const Vec<Num_T> &v)
00036         {
00037                 copy_vector(v.size(), v._data(), M._data() + c*M.rows());
00038         }
00039 
00040 #ifdef TTT
00041 
00045         class Gamma_RNG {
00046                 public:
00048                         Gamma_RNG ( double a=1.0, double b=1.0 );
00050                         void setup ( double a0, double b0 ) { alpha=a0; beta=b0;}
00052                         double get_setup() const;
00054                         double operator() () { return sample(); }
00056                         vec operator() ( int n );
00058                         mat operator() ( int h, int w );
00059                 protected:
00060                 private:
00062                         double sample();
00064                         double alpha;
00066                         double beta;
00068                         Random_Generator RNG;
00069                         Normal_RNG NRNG;
00071                         inline double exp_rand() {return -std::log ( RNG.random_01() );}
00072                         inline double unif_rand() {return RNG.random_01();}
00073                         inline double norm_rand() {return NRNG.sample();}
00074 
00075         };
00076 #endif
00077         bool qr ( const mat &A, mat &R );
00078 
00080         std::string num2str(double d);
00081 
00083         std::string num2str(int i);
00084 }
00085 
00086 
00087 #endif //ITEX_H