GriddedInterpolant performance, meshgrid vs ndgrid formats

10 vues (au cours des 30 derniers jours)
Mark Brandon
Mark Brandon le 9 Mar 2021
Commenté : Bruno Luong le 2 Avr 2023
I have been using griddedInterpolant for a long time now. But, starting today, I got the following warning:
Warning: Query data is in MESHGRID format, NDGRID format will yield better performance.
Convert your query data (Xq, Yq) as follows:
F = griddedInterpolant(. . .);
Xq = Xq'; Yq = Yq';
Vq = F(Xq,Yq);
I searched but have not found any discussion about this performance issue. I am hoping that someone out there can help.
Note that I am fully aware of the difference between MESHGRID and NDGRID formats. I am curious about why the NDGRID format provides an advantage.
My guess is that it has to do with column vs row operations.
Best,
Mark
  2 commentaires
Mark Brandon
Mark Brandon le 10 Mar 2021
Darova, thanks for the edit.
Bruno Luong
Bruno Luong le 2 Avr 2023
Oddly to me, this transposition
Xq = Xq'; Yq = Yq';
Vq = F(Xq,Yq)
could be done internaly by griddedInterpolant. Why throwing a warning instead of implementing the recommended fix?

Connectez-vous pour commenter.

Réponses (1)

Matt J
Matt J le 10 Mar 2021
Presumably because ndgridded query data will result in the data being looped through with better memory locality.

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by