changeset 852:d15683416ebf

some fix to the c code of FillMissing. It was not compiling.
author Frederic Bastien <nouiz@nouiz.org>
date Tue, 03 Nov 2009 09:50:54 -0500
parents ab7d598f5579
children 972303bef0bf
files pylearn/sandbox/scan_inputs_groups.py
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/sandbox/scan_inputs_groups.py	Mon Oct 26 16:33:16 2009 -0400
+++ b/pylearn/sandbox/scan_inputs_groups.py	Tue Nov 03 09:50:54 2009 -0500
@@ -691,7 +691,7 @@
                 ]
 
     def c_headers(self):
-        return ['"Python.h"', '"numpy/noprefix.h"', '<math.h>']
+        return ['"Python.h"', '"numpy/noprefix.h"', '<math.h>', '<sstream>']
 
     def c_support_code(self):
         return """                      
@@ -776,7 +776,12 @@
   }
 }
 
-assert(input->nd==value->nd==mask->nd);
+if(input->nd!=value->nd || input->nd!=mask->nd){
+   PyErr_Format(PyExc_ValueError,
+   "FillMissing input have %%d dims, the mask have %%d dims and the value have %%d dims. They should all be equals \\n",
+   input->nd, value->nd, mask->nd);
+   %(fail)s;
+}
 #if %(self.fill_with_is_array)s
   if(input->nd==1){
     %(type)s* value_  = (%(type)s*)(value->data);
@@ -809,7 +814,7 @@
     }
   }else{//not implemented!
 //SHOULD not happen as c_code should revert to the python  version in that case
-    std:stringstream temp;
+    std::stringstream temp;
     temp << "In FillMissing, we try to fill with an array and the input ndim is implemented only for 1 and 2. This case is not implemented."<<endl;
     temp << " ndim="<<input->nd<<endl;;
     std::string param = temp.str();
@@ -866,7 +871,7 @@
     }
   }else{//not implemented!
 //SHOULD not happen as c_code should revert to the python  version in that case
-    std:stringstream temp;
+    std::stringstream temp;
     temp << "In FillMissing, we try to fill with a constant and the input ndim is implemented only for 1, 2 and 3.";
     temp << " ndim="<<input->nd<<endl;;
     std::string param = temp.str();