summaryrefslogtreecommitdiff
path: root/src/CuBaseLib/.svn/text-base/curand.h.svn-base
diff options
context:
space:
mode:
authorJoe Zhao <ztuowen@gmail.com>2014-04-14 08:14:45 +0800
committerJoe Zhao <ztuowen@gmail.com>2014-04-14 08:14:45 +0800
commitcccccbf6cca94a3eaf813b4468453160e91c332b (patch)
tree23418cb73a10ae3b0688681a7f0ba9b06424583e /src/CuBaseLib/.svn/text-base/curand.h.svn-base
downloadtnet-cccccbf6cca94a3eaf813b4468453160e91c332b.tar.gz
tnet-cccccbf6cca94a3eaf813b4468453160e91c332b.tar.bz2
tnet-cccccbf6cca94a3eaf813b4468453160e91c332b.zip
First commit
Diffstat (limited to 'src/CuBaseLib/.svn/text-base/curand.h.svn-base')
-rw-r--r--src/CuBaseLib/.svn/text-base/curand.h.svn-base40
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