Re: Extracting Interpolating Function via mathlink
- To: mathgroup at smc.vnet.net
- Subject: [mg50797] Re: Extracting Interpolating Function via mathlink
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Wed, 22 Sep 2004 00:10:55 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <ciomuh$r8l$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
a) look in the AddOns`ExtraPackages`InterpolationFunctionAnatomy`
it has several function to extract the data points, namely
InterpolationFunctionValuesOnGrid
b) send the funtion values and as a single array to the C-program
as an alternative you may semple the interpolation functions on
a discrete grid in Mathematica and use this table in you c-code
or you should solve the differential equations totla in the c-program.
Regards
Jens
Peter Saffrey wrote:
>
> I'm writing an application that interfaces with Mathematicas
> differential equation solving routines via mathlink. The equations are
> loaded and solved and then I need to extract the resulting
> interpolating functions for use in the rest of my application. At the
> moment, I have a mathematica function which dumps the data points, one
> by one, which I grab and insert into C++ objects. This works, but it's
> very slow on large functions - when there are 10000 data points, this
> takes about 30 seconds per function.
>
> I suspect the reason for the poor performance is that I'm calling too
> many mathlink functions - each data point is three "getpacket" calls,
> one for the a list header, and one for each part of the data point. Is
> there a way I can do this more quickly? How about exporting the whole
> list of points as some kind of C++ structure I can then parse with
> using mathlink? Does anybody know how I might do this?
>
> Thanks,
>
> Peter