Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2BC5111F8D for ; Fri, 11 Jul 2014 18:52:06 +0000 (UTC) Received: (qmail 14381 invoked by uid 500); 11 Jul 2014 18:52:05 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 14272 invoked by uid 500); 11 Jul 2014 18:52:05 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 14076 invoked by uid 99); 11 Jul 2014 18:52:05 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jul 2014 18:52:05 +0000 Date: Fri, 11 Jul 2014 18:52:05 +0000 (UTC) From: "Adam Bedrossian (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (MATH-1138) BicubicSplineInterpolator is returning incorrect interpolated values MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Adam Bedrossian created MATH-1138: ------------------------------------- Summary: 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 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.2#6252)