public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
From: David Zaslavsky <diazona@ellipsix.net>
To: gsl-discuss@sourceware.org
Subject: Re: interp2d discussion
Date: Sat, 11 Jan 2014 01:58:00 -0000	[thread overview]
Message-ID: <52D0A53E.8020802@ellipsix.net> (raw)
In-Reply-To: <1475379.W4E7QPn8Ol@tom>

[-- Attachment #1: Type: text/plain, Size: 2469 bytes --]

Hi Jeremy,

The algorithms used by interp2d require a rectangular grid. Doing
interpolation without that grid would require an entirely different
algorithm, so that would be a separate project.

The algorithms can be generalized to higher-dimensional interpolation,
but it becomes exponentially more complicated as the number of
dimensions increases. For linear interpolation this probably wouldn't be
too bad, but other interpolation schemes would be quite a pain to code
in a higher number of dimensions. I believe it would be possible to make
an interpolation routine that automatically generalizes to any number of
dimensions (I think Mathematica does this, for example), but that would
require pretty much rewriting the entire code base.

:) David

On 01/10/2014 07:27 PM, jeremy theler wrote:
> Hi all,
>
> I consider the addition of these routines to GSL as a major breakthrough.
> Now I have three questions about generalization:
>
>  1. can these 2D interpolation routines be extended to scattered (i.e. non-
> rectangular) data?
>
>  2. can these 2D interpolation routines be extended to n dimensions?
>
>  3. both
>
>
> Thank you for your hard work!
>
> --
> jeremy
>
>
> On Friday 10 January 2014 09:37:04 Patrick Alken wrote:
>>> Sure, that would be a reasonable option, but I'd like to do a bit of
>>> research (i.e. ask a few more people for opinions) to see what solution
>>> will be the least confusing. After all, if there is a change to be made,
>>> this is the time to do it, not later after the code is incorporated into
>>> GSL. I think backward compatibility will not be too much of a problem
>>> because people will have to make other changes anyway to transition from
>>> the interp2d_* functions to the corresponding gsl_* functions.
>> I think 2 additional functions could be added to help solve this issue
>> and hide the indexing
>> from the user:
>>
>> interp2d_grid_set(double zarr[], size_t i, size_t j, double z)
>> {
>>    /* set point (i,j) of grid 'zarr' to value 'z' */
>> }
>>
>> and
>>
>> interp2d_grid_fill(double zarr[], int (*grid_func)(double x, double y,
>> void *params))
>> {
>>    /* fill entire grid 'zarr' using callback function 'grid_func'; this
>> would be useful
>>     * in cases where the user has a continuous/analytic function which
>> is expensive to call, but
>>     * they'd like to make a grid and then interpolate from it
>>     */
>> }



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 295 bytes --]

      parent reply	other threads:[~2014-01-11  1:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <520EB115.9070606@ellipsix.net>
2014-01-03 19:00 ` [Help-gsl] Getting an extension listed on GSL page Patrick Alken
2014-01-05 20:31   ` David Zaslavsky
2014-01-06 16:58     ` interp2d discussion Patrick Alken
2014-01-10  6:05       ` David Zaslavsky
2014-01-10  6:11       ` David Zaslavsky
2014-01-10 16:37         ` Patrick Alken
2014-01-11  0:28           ` jeremy theler
2014-01-11  1:55             ` Patrick Alken
2014-01-14  1:51               ` jeremy theler
2014-01-14  2:23                 ` Patrick Alken
2014-01-11  1:58             ` David Zaslavsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52D0A53E.8020802@ellipsix.net \
    --to=diazona@ellipsix.net \
    --cc=gsl-discuss@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).