comparison scripts/general/interpn.m @ 31167:731b6a5c7c4c

maint: merge stable to default
author Arun Giridhar <arungiridhar@gmail.com>
date Thu, 28 Jul 2022 19:23:14 -0400
parents d1fe2cb16d95 8f3885b4d7ae
children
comparison
equal deleted inserted replaced
31162:ae3938c7eb67 31167:731b6a5c7c4c
359 ## real and imaginary parts separately. 359 ## real and imaginary parts separately.
360 %!test <*61907> 360 %!test <*61907>
361 %! yi = [0.5, 1.5]'; 361 %! yi = [0.5, 1.5]';
362 %! xi = [2.5, 3.5]; 362 %! xi = [2.5, 3.5];
363 %! zi = [2.25, 4.75]; 363 %! zi = [2.25, 4.75];
364 %! rand ("state", 1340640850);
364 %! v = rand (4, 3, 5) + 1i * rand (4, 3, 5); 365 %! v = rand (4, 3, 5) + 1i * rand (4, 3, 5);
365 %! for method = {"nearest", "linear", "spline"} 366 %! for method = {"nearest", "linear", "spline"}
366 %! vi_complex = interpn (v, yi, xi, zi, method{1}); 367 %! vi_complex = interpn (v, yi, xi, zi, method{1});
367 %! vi_real = interpn (real (v), yi, xi, zi, method{1}); 368 %! vi_real = interpn (real (v), yi, xi, zi, method{1});
368 %! vi_imag = interpn (imag (v), yi, xi, zi, method{1}); 369 %! vi_imag = interpn (imag (v), yi, xi, zi, method{1});
369 %! assert (real (vi_complex), vi_real) 370 %! assert (real (vi_complex), vi_real, 2*eps)
370 %! assert (imag (vi_complex), vi_imag) 371 %! assert (imag (vi_complex), vi_imag, 2*eps)
371 %! endfor 372 %! endfor
372 373
373 ## Test input validation 374 ## Test input validation
374 %!error <Invalid call> interpn () 375 %!error <Invalid call> interpn ()
375 %!error <Invalid call> interpn ("foobar") 376 %!error <Invalid call> interpn ("foobar")