Caching a large 3D interpolation using griddata()
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I'm using griddata() to go from a spherical grid of sizes on the order (128x256x1500) to a Cartesian cube centered on the sphere, containing N^3 regularly-spaced points (where N is between 128 and 512). I need to do this for dozens or hundreds of checkpoints in my simulation, and several variables per checkpoint. I'm going to need to interpolate from the same spherical grid to the same cubic grid several hundred or several thousand times over, using new data on the spherical grid each time!
Since the most computationally expensive part of this routine is the triangulation and interpolation, I would like to cache some information the first time the routine is run and use that information for subsequent runs.
As far as I can tell, this is not possible using the current implementation of griddata(). Is there any way I could do something like this -- perhaps re-writing the griddata() routine?
0 comentarios
Respuestas (1)
Matt J
el 5 de Jul. de 2014
Editada: Matt J
el 5 de Jul. de 2014
In recent versions of MATLAB, you have scatteredInterpolant which pre-composes an interpolation object, so probably does some of the caching you're talking about. Beyond that, there is parfor in the Parallel Computing Toolbox, if you have it. You would probably have to be strategic about how you slice the input and output data, if you go that route.
2 comentarios
Matt J
el 5 de Jul. de 2014
Editada: Matt J
el 5 de Jul. de 2014
It might be worthwhile having a look at FUNC2MAT. It will let you express the interpolation as a multiplication of Y(:) with a reusable sparse matrix that is (X,X1)-dependent. The computation of this matrix will be time-consuming, but if you'll be reusing it enough, it might be worth it. FUNC2MAT also lets you mitigate the matrix computation using the Parallel Computing Toolbox, if you have it.
Ver también
Categorías
Más información sobre Interpolation en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!