One can happily pass in two std::vectors of different lengths and the algorithm will go bananas.Īlso, it could make a lot more sense to use different input parameter types. handling problematic inputĪt the moment, there are no error checks. Checking max and min values feels like an overcomplication. After all, extrapolation just means using the same slope as the first and last interpolation steps. The case for extrapolation could be included in the for loop without being explicitly coded. I feel like this code could be simplified further. Here's how this could look like: double Interpolation::linear What is alpha? varSurf? detail_sensativity? And again, given there are many interpolation methods, what is Interp1? With your code alone, that would have been much harder. I know what an interpolation function should be doing and with the clue that you are trying to duplicate griddedInterpolant(X,V,method) I knew what's going on. It's part of a bigger problem that's related to the former paragraph: you use domain specific names which are very cryptic to anybody outside your field. If you are a real C programmer, you'd shove all the condition of if (detail_sensativity >= alpha
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |