Index: trunk/psLib/src/math/psMinimizePolyFit.c
===================================================================
--- trunk/psLib/src/math/psMinimizePolyFit.c	(revision 10848)
+++ trunk/psLib/src/math/psMinimizePolyFit.c	(revision 10863)
@@ -10,6 +10,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2006-12-29 04:38:42 $
+ *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2007-01-01 21:01:33 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -126,12 +126,15 @@
     psF64 ySum = 1.0;
 
+    // note that we are using the X and Y elements of the image reversed to be
+    // consistent with the other BuildSumsND functions in terms of the definition
+    // of the sums array
     nXsum = 2*nXterm;
     nYsum = 2*nYterm;
     if (sums == NULL) {
-        sums = psImageAlloc(nXsum, nYsum, PS_TYPE_F64);
-    }
-    if ((nXsum != sums->numCols) || (nYsum != sums->numRows)) {
+        sums = psImageAlloc(nYsum, nXsum, PS_TYPE_F64);
+    }
+    if ((nYsum != sums->numCols) || (nXsum != sums->numRows)) {
         psFree (sums);
-        sums = psImageAlloc(nXsum, nYsum, PS_TYPE_F64);
+        sums = psImageAlloc(nYsum, nXsum, PS_TYPE_F64);
     }
 
