I do have a bunch of functions defined in the same domain but mapping to different values and I evaluate those functions with interpn as there's no closed form formula.
so lets say, the domain is D1 x D2 x D3 x D4 (all vectors) and each function (F1, F2, F3) maps its 4d arguments to a scalar value.
I'm evaluating each function at the same query points using interpn with linear interpolation like :
f1val=interpn(D1,D2,D3,D4,F1,dq1,dq2,dq3,dq4);f2val=interpn(D1,D2,D3,D4,F2,dq1,dq2,dq3,dq4);f3val=interpn(D1,D2,D3,D4,F3,dq1,dq2,dq3,dq4);
I'm guessing that each call would do 4 binary searches to find the nearest index points used to evaluated linear interpolation.
This code is going to be converted to C/C++ using Code generation. I was wondering if the Code generation would avoid doing search for the same query points in all instantiations of interpn. If not, how can I manually ensure that this is not the case?
Best Answer