[ 
https://issues.apache.org/jira/browse/MATH-1138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14177849#comment-14177849
 ] 

Hank Grabowski commented on MATH-1138:
--------------------------------------

I have restored the original files but added deprecation and accuracy warnings. 
 The new interpolators are now in their own "Piecewise" surnamed classes.  All 
tests in the entire JUnit suite passed. 

You can find the details of the pull request here:

https://github.com/apache/commons-math/pull/3

You can browse my version of the repository, or pull your own copy down, here:

https://github.com/HankG/commons-math

This pull request seems to also have all of the changes from apache:master that 
I fetched and merged with my local repository before I started these edits.  
I'm not sure how to get GitHub to ignore those came from the root, nor have I 
figured out how to select a limited range of changes to get around that.  I 
also don't want to let my fork go stale.  Between the two I figured it was 
better to keep my fork up to date before making changes than it was for the 
person processing a pull request to try to shoe horn it into whatever the 
change is. 

Along with these changes I did do a scan of my code to make sure I didn't miss 
any defensive programming practices, used magic numbers, et cetera.  Nothing 
stood out to me, but proofreading your own writing is never a good thing.  If 
whatever "minor changes" I need to make to get this code "on par with what we 
had usually committed as new contributions" can be pointed out here or in JIRA 
I'd appreciate it.

> BicubicSplineInterpolator is returning incorrect interpolated values
> --------------------------------------------------------------------
>
>                 Key: MATH-1138
>                 URL: https://issues.apache.org/jira/browse/MATH-1138
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.3
>            Reporter: Adam Bedrossian
>             Fix For: 3.4
>
>         Attachments: Interpolated Values from CM and MatLab.docx
>
>
> I have encountered a use case with the BicubicSplineInterpolator where the 
> interpolated values that are being returned seem incorrect.  Furthermore, the 
> values do not match those generated by MatLab using the interp2 'cubic' 
> method.
> Here is a snippet of code that uses the interpolator:
>         double[] xValues = new double[] {36, 36.001, 36.002};
>         double[] yValues = new double[] {-108.00, -107.999, -107.998};
>         double[][] fValues = new double[][] {{1915, 1906, 1931},
>                                         {1877, 1889, 1894},
>                                         {1878, 1873, 1888}};
>         BicubicSplineInterpolator interpolator = new 
> BicubicSplineInterpolator();
>         BicubicSplineInterpolatingFunction interpolatorFunction = 
> interpolator.interpolate(xValues, yValues, fValues);
>         double[][] results = new double[9][9];
>         double x = 36;
>         int arrayIndexX = 0, arrayIndexY = 0;
>         while(x <= 36.002) {
>             double y = -108;
>             arrayIndexY = 0;
>             while (y <= -107.998) {
>                 results[arrayIndexX][arrayIndexY] = 
> interpolatorFunction.value(x,  y);
>                 System.out.println(results[arrayIndexX][arrayIndexY]);
>                 y = y + 0.00025;
>                 arrayIndexY++;
>             }
>             x = x + 0.00025;
>             arrayIndexX++;
>         }
> Attached is a grid showing x and y values and the corresponding interpolated 
> value from both commons math and MatLab.
> The values produced by commons math are far off from those created by MatLab.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to