GriddedInterpolant performance, meshgrid vs ndgrid formats

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 件のコメント

Mark Brandon
Mark Brandon 2021 年 3 月 10 日
Darova, thanks for the edit.
Bruno Luong
Bruno Luong 2023 年 4 月 2 日
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?

サインインしてコメントする。

回答 (1 件)

Matt J
Matt J 2021 年 3 月 10 日

0 投票

Presumably because ndgridded query data will result in the data being looped through with better memory locality.

カテゴリ

ヘルプ センター および File ExchangeMultidimensional Arrays についてさらに検索

製品

リリース

R2020b

質問済み:

2021 年 3 月 9 日

コメント済み:

2023 年 4 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by