diff options
author | Joe Zhao <ztuowen@gmail.com> | 2014-04-14 11:18:58 +0800 |
---|---|---|
committer | Joe Zhao <ztuowen@gmail.com> | 2014-04-14 11:18:58 +0800 |
commit | f98b9b720f0f5c511f5cb735f0456f0d5fe3c791 (patch) | |
tree | cb9398f27458348c9f1b43fb1a734ded16a5507a /src/CuBaseLib | |
parent | cccccbf6cca94a3eaf813b4468453160e91c332b (diff) | |
download | tnet-f98b9b720f0f5c511f5cb735f0456f0d5fe3c791.tar.gz tnet-f98b9b720f0f5c511f5cb735f0456f0d5fe3c791.tar.bz2 tnet-f98b9b720f0f5c511f5cb735f0456f0d5fe3c791.zip |
Supporting const rev.
Diffstat (limited to 'src/CuBaseLib')
-rw-r--r-- | src/CuBaseLib/cumatrix.h | 4 | ||||
-rw-r--r-- | src/CuBaseLib/cumatrix.tcc | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/CuBaseLib/cumatrix.h b/src/CuBaseLib/cumatrix.h index 887b92d..dd76bb2 100644 --- a/src/CuBaseLib/cumatrix.h +++ b/src/CuBaseLib/cumatrix.h @@ -76,9 +76,9 @@ namespace TNet { /// Allocate the memory ThisType& Init(size_t rows, size_t cols); /// Copy the ptr of rSrc starting at x with span of cols - ThisType& Init(CuMatrix<_ElemT>& rSrc, size_t x, size_t cols); + ThisType& Init(const CuMatrix<_ElemT>& rSrc, size_t x, size_t cols); /// Copy the settings of rSrc - ThisType& Init(CuMatrix<_ElemT>& rSrc); + ThisType& Init(const CuMatrix<_ElemT>& rSrc); /// Deallocate the memory void Destroy(); diff --git a/src/CuBaseLib/cumatrix.tcc b/src/CuBaseLib/cumatrix.tcc index 7d6a136..66e335d 100644 --- a/src/CuBaseLib/cumatrix.tcc +++ b/src/CuBaseLib/cumatrix.tcc @@ -41,13 +41,13 @@ namespace TNet { template<typename _ElemT> CuMatrix<_ElemT>& CuMatrix<_ElemT>:: - Init(CuMatrix<_ElemT>& rSrc, size_t x, size_t cols) + Init(const CuMatrix<_ElemT>& rSrc, size_t x, size_t cols) { mRows = rSrc.Rows(); mCols = cols; mStride = rSrc.Stride(); - mpCUData = rSrc.pCUData() + x; - isOwn=false; + mpCUData = const_cast<_ElemT*>(rSrc.pCUData()) + x; + isOwn = false; return *this; } @@ -57,13 +57,13 @@ namespace TNet { template<typename _ElemT> CuMatrix<_ElemT>& CuMatrix<_ElemT>:: - Init(CuMatrix<_ElemT>& rSrc) + Init(const CuMatrix<_ElemT>& rSrc) { mRows = rSrc.Rows(); mCols = rSrc.Cols(); mStride = rSrc.Stride(); - mpCUData = rSrc.pCUData(); - isOwn=false; + mpCUData = const_cast<_ElemT*>(rSrc.pCUData()); + isOwn = false; return *this; } |