[Frederik Eaton] Two small patches for src/jtree.cpp and utils/createfg.cpp
authorJoris Mooij <joris.mooij@tuebingen.mpg.de>
Sun, 6 Dec 2009 17:27:58 +0000 (18:27 +0100)
committerJoris Mooij <joris.mooij@tuebingen.mpg.de>
Sun, 6 Dec 2009 17:27:58 +0000 (18:27 +0100)
src/jtree.cpp
utils/createfg.cpp

index 8d96691..9a0cac9 100644 (file)
@@ -158,8 +158,9 @@ void JTree::GenerateJT( const std::vector<VarSet> &Cliques ) {
     }
 
     // Check counting numbers
-    if( DAI_DEBUG )
-        checkCountingNumbers();
+#ifdef DAI_DEBUG
+    checkCountingNumbers();
+#endif
 
     if( props.verbose >= 3 )
         cerr << "Regiongraph generated by JTree::GenerateJT: " << *this << endl;
index 421b0c8..627b978 100644 (file)
@@ -559,12 +559,16 @@ int main( int argc, char *argv[] ) {
             cout << "# sigma_w = " << sigma_w << endl;
             cout << "# sigma_th = " << sigma_th << endl;
         } else if( type == GRID_TYPE || type == GRID_TORUS_TYPE ) {
+#define NEED_ARG(name, desc) do { if(!vm.count(name)) throw "Please specify " desc " with --" name; } while(0);
             if( states > 2 ) {
-                if( !vm.count("N") || !vm.count("beta") )
-                    throw "Please specify all required arguments";
+                NEED_ARG("N", "number of nodes");
+                NEED_ARG("beta", "stddev of log-factor entries");
             } else {
-                if( !vm.count("N") || !vm.count("mean_w") || !vm.count("mean_th") || !vm.count("sigma_w") || !vm.count("sigma_th") )
-                    throw "Please specify all required arguments";
+                NEED_ARG("N", "number of nodes");
+                NEED_ARG("mean_w", "mean of pairwise interactions");
+                NEED_ARG("mean_th", "mean of singleton interactions");
+                NEED_ARG("sigma_w", "stddev of pairwise interactions");
+                NEED_ARG("sigma_th", "stddev of singleton interactions");
             }
 
             size_t n = (size_t)sqrt((long double)N);