You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2011/06/05 17:59:26 UTC

svn commit: r1132439 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/analysis/interpolation/LoessInterpolator.java site/xdoc/changes.xml

Author: luc
Date: Sun Jun  5 15:59:26 2011
New Revision: 1132439

URL: http://svn.apache.org/viewvc?rev=1132439&view=rev
Log:
Fixed tricube function implementation in Loess interpolation.

JIRA: MATH-504

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/LoessInterpolator.java
    commons/proper/math/trunk/src/site/xdoc/changes.xml

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/LoessInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/LoessInterpolator.java?rev=1132439&r1=1132438&r2=1132439&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/LoessInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/LoessInterpolator.java Sun Jun  5 15:59:26 2011
@@ -427,10 +427,14 @@ public class LoessInterpolator
      * weight function
      *
      * @param x Argument.
-     * @return <code>(1 - |x|<sup>3</sup>)<sup>3</sup></code>.
+     * @return <code>(1 - |x|<sup>3</sup>)<sup>3</sup></code> for |x| &lt; 1, 0 otherwise.
      */
     private static double tricube(final double x) {
-        final double tmp = 1 - x * x * x;
+        final double absX = FastMath.abs(x);
+        if (absX >= 1.0) {
+            return 0.0;
+        }
+        final double tmp = 1 - absX * absX * absX;
         return tmp * tmp * tmp;
     }
 

Modified: commons/proper/math/trunk/src/site/xdoc/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/changes.xml?rev=1132439&r1=1132438&r2=1132439&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/changes.xml Sun Jun  5 15:59:26 2011
@@ -52,6 +52,9 @@ The <action> type attribute can be add,u
     If the output is not quite correct, check for invisible trailing spaces!
      -->
     <release version="3.0" date="TBD" description="TBD">
+      <action dev="luc" type="fix" issue="MATH-504" due-to="X. B.">
+        Fixed tricube function implementation in Loess interpolator.
+      </action>
       <action dev="luc" type="fix" issue="MATH-568" due-to="Christoph M. Friedrich">
         Fixed documentation of statistics examples.
       </action>