From cccccbf6cca94a3eaf813b4468453160e91c332b Mon Sep 17 00:00:00 2001 From: Joe Zhao Date: Mon, 14 Apr 2014 08:14:45 +0800 Subject: First commit --- src/CuBaseLib/.svn/text-base/curand.h.svn-base | 40 ++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/CuBaseLib/.svn/text-base/curand.h.svn-base (limited to 'src/CuBaseLib/.svn/text-base/curand.h.svn-base') 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 + 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& tgt); + void GaussRand(CuMatrix& tgt); + + void BinarizeProbs(const CuMatrix& probs, CuMatrix& states); + void AddGaussNoise(CuMatrix& tgt, T gscale = 1.0); + + private: + static void SeedRandom(Matrix& mat); + + private: + CuMatrix z1, z2, z3, z4; + CuMatrix tmp; + }; + +} + + +#include "curand.tcc" + + +#endif -- cgit v1.2.3-70-g09d2