From f98b9b720f0f5c511f5cb735f0456f0d5fe3c791 Mon Sep 17 00:00:00 2001
From: Joe Zhao <ztuowen@gmail.com>
Date: Mon, 14 Apr 2014 11:18:58 +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<BaseFloat>& GetErrorInput(int pos=0)
+    const CuMatrix<BaseFloat>& GetErrorInput(int pos=0)
     {
       if (pos>=0 && pos<size)
         return *ErrInputVec[pos];
       return *ErrInputVec[0];
     }
 
-    void SetErrorInput(CuMatrix<BaseFloat>& rErrorInput,int pos=0)
+    void SetErrorInput(const CuMatrix<BaseFloat>& rErrorInput,int pos=0)
     {
       if (pos==0)
         mpErrorInput=&rErrorInput;
@@ -181,7 +181,7 @@ namespace TNet {
     }
     
     int size;
-    MatrixPtrVec ErrInputVec;
+    ConstMatrixPtrVec ErrInputVec;
     Vector<BaseFloat> Scale;
   };
   
@@ -227,13 +227,13 @@ namespace TNet {
       mErrorOutput.Init(*mpErrorInput);
     }
     
-    int GetInSect()
+    int GetInSect() const
     {
       return size;
     }
     
     /// IO Data getters
-    CuMatrix<BaseFloat>& GetInput(int pos=0)
+    const CuMatrix<BaseFloat>& GetInput(int pos=0)
     {
       if (pos>=0 && pos<size)
         return *InputVec[pos];
@@ -241,7 +241,7 @@ namespace TNet {
     }
 
     /// Set input vector (bind with the preceding NetworkComponent)
-    void SetInput(CuMatrix<BaseFloat>& rInput,int pos=0)
+    void SetInput(const CuMatrix<BaseFloat>& 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 "<divide>"; }
     
-    int GetOutSect()
+    int GetOutSect() const
     {
       return size;
     }
@@ -345,7 +345,7 @@ namespace TNet {
     
     int size;
     MatrixPtrVec OutputVec;
-    MatrixPtrVec ErrorInputVec;
+    ConstMatrixPtrVec ErrorInputVec;
     std::vector<int> SectLen;
 
   };
@@ -372,7 +372,7 @@ namespace TNet {
     const char* GetName() const
     { return "<merge>"; }
     
-    int GetInSect()
+    int GetInSect() const
     {
       return size;
     }
@@ -428,7 +428,7 @@ namespace TNet {
     
     int size;
     
-    MatrixPtrVec InputVec;
+    ConstMatrixPtrVec InputVec;
     MatrixPtrVec ErrorOutputVec;
     std::vector<int> SectLen;
 
@@ -456,12 +456,12 @@ namespace TNet {
     const char* GetName() const
     { return "<reorder>"; }
     
-    int GetInSect()
+    int GetInSect() const
     {
       return size;
     }
       
-    int GetOutSect()
+    int GetOutSect() const
     {
       return size;
     }
@@ -505,30 +505,30 @@ namespace TNet {
     }
     
     /// IO Data getters
-    CuMatrix<BaseFloat>& GetInput(int pos=0)
+    const CuMatrix<BaseFloat>& GetInput(int pos=0)
     {
       return PipeVec[pos]->GetInput();
     }
-    CuMatrix<BaseFloat>& GetOutput(int pos=0)
+    const CuMatrix<BaseFloat>& GetOutput(int pos=0)
     {
       return PipeVec[Order[pos]]->GetOutput();
     }
-    CuMatrix<BaseFloat>& GetErrorInput(int pos=0)
-    {
+    const CuMatrix<BaseFloat>& GetErrorInput(int pos=0)
+    { 
       return PipeVec[Order[pos]]->GetErrorInput();
     }
-    CuMatrix<BaseFloat>& GetErrorOutput(int pos=0)
+    const CuMatrix<BaseFloat>& GetErrorOutput(int pos=0)
     {
       return PipeVec[pos]->GetErrorOutput();
     }
 
     /// Set input vector (bind with the preceding NetworkComponent)
-    void SetInput(CuMatrix<BaseFloat>& rInput,int pos=0)
+    void SetInput(const CuMatrix<BaseFloat>& rInput,int pos=0)
     {
       PipeVec[pos]->SetInput(rInput);
     }          
     /// Set error input vector (bind with the following NetworkComponent) 
-    void SetErrorInput(CuMatrix<BaseFloat>& rErrorInput,int pos=0)
+    void SetErrorInput(const CuMatrix<BaseFloat>& rErrorInput,int pos=0)
     {
       PipeVec[Order[pos]]->SetErrorInput(rErrorInput);
     }
-- 
cgit v1.2.3-70-g09d2