diff options
Diffstat (limited to 'src/CuBaseLib/.svn/text-base/curand.h.svn-base')
-rw-r--r-- | src/CuBaseLib/.svn/text-base/curand.h.svn-base | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/CuBaseLib/.svn/text-base/curand.h.svn-base b/src/CuBaseLib/.svn/text-base/curand.h.svn-base new file mode 100644 index 0000000..8aa66d5 --- /dev/null +++ b/src/CuBaseLib/.svn/text-base/curand.h.svn-base @@ -0,0 +1,40 @@ +#ifndef _CU_RAND_H_ +#define _CU_RAND_H_ + + +#include "cumatrix.h" + + +namespace TNet { + + template<typename T> + class CuRand { + public: + + CuRand(size_t rows, size_t cols) + { SeedGpu(rows,cols); } + + ~CuRand() { } + + void SeedGpu(size_t rows, size_t cols); + void Rand(CuMatrix<T>& tgt); + void GaussRand(CuMatrix<T>& tgt); + + void BinarizeProbs(const CuMatrix<T>& probs, CuMatrix<T>& states); + void AddGaussNoise(CuMatrix<T>& tgt, T gscale = 1.0); + + private: + static void SeedRandom(Matrix<unsigned>& mat); + + private: + CuMatrix<unsigned> z1, z2, z3, z4; + CuMatrix<T> tmp; + }; + +} + + +#include "curand.tcc" + + +#endif |