From 0653afe62c109f333677f9fd90d19d4727e7cca5 Mon Sep 17 00:00:00 2001 From: Joe Zhao Date: Mon, 14 Apr 2014 11:15:21 +0800 Subject: Supporting const rev. --- src/CuTNetLib/cuMisc.h | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'src/CuTNetLib/cuMisc.h') diff --git a/src/CuTNetLib/cuMisc.h b/src/CuTNetLib/cuMisc.h index 7319adf..b93a983 100644 --- a/src/CuTNetLib/cuMisc.h +++ b/src/CuTNetLib/cuMisc.h @@ -148,19 +148,19 @@ namespace TNet { mOutput.Init(*mpInput); } - int GetOutSect() + int GetOutSect() const { return size; } - CuMatrix& GetErrorInput(int pos=0) + const CuMatrix& GetErrorInput(int pos=0) { if (pos>=0 && pos& rErrorInput,int pos=0) + void SetErrorInput(const CuMatrix& rErrorInput,int pos=0) { if (pos==0) mpErrorInput=&rErrorInput; @@ -181,7 +181,7 @@ namespace TNet { } int size; - MatrixPtrVec ErrInputVec; + ConstMatrixPtrVec ErrInputVec; Vector Scale; }; @@ -227,13 +227,13 @@ namespace TNet { mErrorOutput.Init(*mpErrorInput); } - int GetInSect() + int GetInSect() const { return size; } /// IO Data getters - CuMatrix& GetInput(int pos=0) + const CuMatrix& GetInput(int pos=0) { if (pos>=0 && pos& rInput,int pos=0) + void SetInput(const CuMatrix& rInput,int pos=0) { if (pos==0) mpInput=&rInput; @@ -264,7 +264,7 @@ namespace TNet { } int size; - MatrixPtrVec InputVec; + ConstMatrixPtrVec InputVec; }; /** @@ -289,7 +289,7 @@ namespace TNet { const char* GetName() const { return ""; } - int GetOutSect() + int GetOutSect() const { return size; } @@ -345,7 +345,7 @@ namespace TNet { int size; MatrixPtrVec OutputVec; - MatrixPtrVec ErrorInputVec; + ConstMatrixPtrVec ErrorInputVec; std::vector SectLen; }; @@ -372,7 +372,7 @@ namespace TNet { const char* GetName() const { return ""; } - int GetInSect() + int GetInSect() const { return size; } @@ -428,7 +428,7 @@ namespace TNet { int size; - MatrixPtrVec InputVec; + ConstMatrixPtrVec InputVec; MatrixPtrVec ErrorOutputVec; std::vector SectLen; @@ -456,12 +456,12 @@ namespace TNet { const char* GetName() const { return ""; } - int GetInSect() + int GetInSect() const { return size; } - int GetOutSect() + int GetOutSect() const { return size; } @@ -505,30 +505,30 @@ namespace TNet { } /// IO Data getters - CuMatrix& GetInput(int pos=0) + const CuMatrix& GetInput(int pos=0) { return PipeVec[pos]->GetInput(); } - CuMatrix& GetOutput(int pos=0) + const CuMatrix& GetOutput(int pos=0) { return PipeVec[Order[pos]]->GetOutput(); } - CuMatrix& GetErrorInput(int pos=0) - { + const CuMatrix& GetErrorInput(int pos=0) + { return PipeVec[Order[pos]]->GetErrorInput(); } - CuMatrix& GetErrorOutput(int pos=0) + const CuMatrix& GetErrorOutput(int pos=0) { return PipeVec[pos]->GetErrorOutput(); } /// Set input vector (bind with the preceding NetworkComponent) - void SetInput(CuMatrix& rInput,int pos=0) + void SetInput(const CuMatrix& rInput,int pos=0) { PipeVec[pos]->SetInput(rInput); } /// Set error input vector (bind with the following NetworkComponent) - void SetErrorInput(CuMatrix& rErrorInput,int pos=0) + void SetErrorInput(const CuMatrix& rErrorInput,int pos=0) { PipeVec[Order[pos]]->SetErrorInput(rErrorInput); } -- cgit v1.2.3-70-g09d2