Re: How to speed up KRIG2D by 30x [message #86147 is a reply to message #86140] |
Fri, 11 October 2013 04:11   |
Mike[5]
Messages: 5 Registered: October 2013
|
Junior Member |
|
|
Hi Chris,
Great job! I confirm that my modified routine using variograms gives identical results to yours within numerical accuracy, as long as I set my variograms=0 when d=0 in agreement with your covariances. This is of course after translating the interesting new IDL 8.3 feature that David spotted. Note that one can use either variograms functions or covariances without further changes to the program.
The new covariance functions now looks right and corrects for some major numerical differences one can see against the old KRIG2D, when the data extend beyond the region where the covariance was supposed to flatten out.
I like your optimizations in the final loop and the XOUT and YOUT keywords addition. And I am glad you also already modified GRIDDATA. This was an amazing efficient reaction on your side!
Cheers,
Michele
On Thursday, 10 October 2013 18:48:56 UTC+1, Chris Torrence wrote:
> Okay, here is the new code, minus the comments. I added 3 new keywords: DOUBLE, XOUT, YOUT. DOUBLE forces double precision. XOUT, YOUT are output keywords that contain the final X/Y locations. I also vectorized the final loop, for even more speed.
>
>
>
> I also changed the C code of GRIDDATA to move the LUSOL out of the loop.
>
>
>
> Now, with Mike's changes and the vectorization, I'm getting the following results using Mike's test code at the top with 500 input points and 400 output points:
>
>
>
> Old KRIG2D: 30 seconds
>
> New KRIG2D: 0.51 seconds
>
> New GRIDDATA: 1.3 seconds
>
>
>
> It's funny that the KRIG2D is faster than GRIDDATA, but that's because GRIDDATA has a lot of other machinery to handle sectors & search ellipses. In fact, if you *do* use sectors or search_ellipse, then GRIDDATA has to revert to the old slow algorithm with the ludc in the inner loop. Oh well.
>
>
>
> Anyway, let me know how this code looks. If all goes well, this will make it into IDL 8.3, due out in a month or so.
>
>
>
> Mike, thanks again for the patch to the code.
>
>
>
> Cheers,
>
> Chris
>
> ExelisVIS
|
|
|