From 283438ee3779cf29cad9fc9fb59777f2f1709047 Mon Sep 17 00:00:00 2001
From: Andreas Schenk <andreas_schenk@hms.harvard.edu>
Date: Tue, 28 Jan 2014 11:40:38 -0500
Subject: [PATCH] skip initialization of moment array in stat accumulator for
 MAX_MOMENT=0

---
 modules/img/alg/src/stat_accumulator.hh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules/img/alg/src/stat_accumulator.hh b/modules/img/alg/src/stat_accumulator.hh
index a744c5e71..9e75368de 100644
--- a/modules/img/alg/src/stat_accumulator.hh
+++ b/modules/img/alg/src/stat_accumulator.hh
@@ -52,9 +52,11 @@ public:
     w_(w),
     n_(1)
   {
-    m_[0]=val;
-    for(unsigned int i=1;i<MAX_MOMENT;++i){
-      m_[i]=0.0;
+    if(MAX_MOMENT>0){
+      m_[0]=val;
+      for(unsigned int i=1;i<MAX_MOMENT;++i){
+        m_[i]=0.0;
+      }
     }
   }
 
-- 
GitLab