Thread Subject: Speeding up GRIDDATA

Subject: Speeding up GRIDDATA

From: Volker K

Date: 20 Mar, 2008 18:09:02

Message: 1 of 10

Hi all!

I'm using "griddata" to interpolate some points in a pretty
big matrix which is roughly 2000x300.
I'm using linear interpolation.

I can't use interp2 or qinterp2 as the data is scattered.

Does anyone knows a way to speed up Griddata=?

Thanks
Volker

Subject: Speeding up GRIDDATA

From: Scott Burnside

Date: 20 Mar, 2008 18:24:01

Message: 2 of 10

"Volker K" <klinkv.NOSPAM@yahoo.de> wrote in message
<fru97u$6vi$1@fred.mathworks.com>...
> Hi all!
>
> I'm using "griddata" to interpolate some points in a
pretty
> big matrix which is roughly 2000x300.
> I'm using linear interpolation.
>
> I can't use interp2 or qinterp2 as the data is scattered.
>
> Does anyone knows a way to speed up Griddata=?
>
> Thanks
> Volker

I would probably try John D'Errico's "surface fitting
using gridfit" just to see if it might be faster.

Scott

Subject: Speeding up GRIDDATA

From: Volker K

Date: 20 Mar, 2008 18:34:02

Message: 3 of 10

Just tried GRIDFIT...but it doesn't work with my data :(

Subject: Speeding up GRIDDATA

From: Volker K

Date: 20 Mar, 2008 22:15:04

Message: 4 of 10

Searched the File Exchange and looked through the
News...couldn't find anything.
No one has an idea?

Subject: Speeding up GRIDDATA

From: John D'Errico

Date: 20 Mar, 2008 22:36:01

Message: 5 of 10

"Volker K" <klinkv.NOSPAM@yahoo.de> wrote in message
<frunl8$s4j$1@fred.mathworks.com>...
> Searched the File Exchange and looked through the
> News...couldn't find anything.
> No one has an idea?

Its a big set of data. Sometimes big sets of data
take some work to process. The 2-d delaunay
is reasonably fast already, as is tsearch.

Are you having memory problems? Is this a
problem of memory thrashing with virtual
memory?

John

Subject: Speeding up GRIDDATA

From: Volker K

Date: 20 Mar, 2008 23:27:19

Message: 6 of 10

> Are you having memory problems? Is this a
> problem of memory thrashing with virtual
> memory?

I don't have memory problems...I have a computing power
problem ;)

A short explanation what I need to do;
I have to locate "Coord" in the matrices Lat and Lon and
find out the subscripts.
So I have to apply GRIDDATA twice:

SubRow = griddata(Lat,Lon,MeshRow,Coord(:,1),Coord(:,2))
SubCol = griddata(Lat,Lon,MeshCol,Coord(:,1),Coord(:,2))
                                           

Lat/Lon vary in size from 50x50 to 350x1800

And last but not least I have to run fminsearch.

I have to estimate the precision of an algorithm so I have
to run the whole thing with dozens of variations (length,
spacing between coord etc) of "Coord". Furthermore I apply
different noises to the results SubRow/SubCol.

Therefore I have to perform griddata several
hundred/thousand times :(
I'm just a student with a AMD 3800+ DualCore 1GB Ram

Subject: Speeding up GRIDDATA

From: John D'Errico

Date: 21 Mar, 2008 00:06:02

Message: 7 of 10

"Volker K" <klinkv.NOSPAM@yahoo.de> wrote in message
<frursn$d58$1@fred.mathworks.com>...
> > Are you having memory problems? Is this a
> > problem of memory thrashing with virtual
> > memory?
>
> I don't have memory problems...I have a computing power
> problem ;)
>
> A short explanation what I need to do;
> I have to locate "Coord" in the matrices Lat and Lon and
> find out the subscripts.
> So I have to apply GRIDDATA twice:
>
> SubRow = griddata(Lat,Lon,MeshRow,Coord(:,1),Coord(:,2))
> SubCol = griddata(Lat,Lon,MeshCol,Coord(:,1),Coord(:,2))
>
>
> Lat/Lon vary in size from 50x50 to 350x1800
>
> And last but not least I have to run fminsearch.
>
> I have to estimate the precision of an algorithm so I have
> to run the whole thing with dozens of variations (length,
> spacing between coord etc) of "Coord". Furthermore I apply
> different noises to the results SubRow/SubCol.
>
> Therefore I have to perform griddata several
> hundred/thousand times :(
> I'm just a student with a AMD 3800+ DualCore 1GB Ram


You are calling griddata twice.

You can save time by calling delaunay only
ONCE, while calling tsearch twice. Since you
are usng linear interpolation, this is all
griddata will do anyway.

I'm ot sure what fraction of the time is spent
on the triangulation, but this will give you
some extra throughput.

John

Subject: Speeding up GRIDDATA

From: Volker K

Date: 21 Mar, 2008 15:29:02

Message: 8 of 10

Hi John!
Thanks for that hint!!! It really helped a lot!
I have seperated the preparation and triangulation part from
the griddata: I have made my own "mygriddata" which requires
the TRI data generated with delaunay but otherwise is the
same as griddata.

Now I only need to call delaunay ONCE and reuse the TRI data
for dozens/hundreds of calls of mygriddata which speeds up
the whole thing enormously!

Thanks again!
Volker

Subject: Speeding up GRIDDATA

From: Darren Engwirda

Date: 24 Mar, 2008 09:20:18

Message: 9 of 10

"Volker K" <klinkv.NOSPAM@yahoo.de> wrote in message
<fs0k7u$nc$1@fred.mathworks.com>...
> Hi John!
> Thanks for that hint!!! It really helped a lot!
> I have seperated the preparation and triangulation part from
> the griddata: I have made my own "mygriddata" which requires
> the TRI data generated with delaunay but otherwise is the
> same as griddata.
>
> Now I only need to call delaunay ONCE and reuse the TRI data
> for dozens/hundreds of calls of mygriddata which speeds up
> the whole thing enormously!
>
> Thanks again!
> Volker

Just out of interest, there's a function "tinterp" on the file exchange that does
this already.

It also offers a different higher order interpolation than griddata.

Darren

Subject: Speeding up GRIDDATA

From: Volker K

Date: 24 Mar, 2008 10:35:02

Message: 10 of 10

> Just out of interest, there's a function "tinterp" on the
file exchange that does
> this already.

Hi Darren!
Just checked it out and will try to use it in my code. your
solution is probably better than my chopped griddata...

Thanks a lot!
Volker

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
griddata Volker Klink 20 Mar, 2008 14:10:12
interpolation Volker Klink 20 Mar, 2008 14:10:12
speed Volker Klink 20 Mar, 2008 14:10:12
rssFeed for this Thread

Contact us at files@mathworks.com