Mercurial > octave
comparison scripts/general/interp2.m @ 31551:fd29c7a50a78 stable
maint: use commas, semicolons consistently with Octave conventions.
* makeValidName.m: Remove %!test and move BIST %!asserts to column 1.
* base64decode.m, base64encode.m, which.m, logm.m, uniquetol.m, perms.m:
Delete semicolon (';') at end of %!assert BIST.
* lin2mu.m, interp2.m, interpn.m, lsqnonneg.m, pqpnonneg.m, uniquetol.m,
betainc.m, normalize.m: Add semicolon (';') to end of assert statement within
%!test BIST.
* __memoize__.m, tar_is_bsd.m, publish.m: Add semicolon (';') to line with
keyword "persistent".
* stft.m: Use comma (',') after "case" keyword when code immediately follows.
* gallery.m: Align commas used in case statements in massive switch block.
Remove unnecessary parentheses around a numeric case argument.
* ranks.m: Remove semicolon (';') from case statemnt argument.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 26 Nov 2022 06:32:08 -0800 |
parents | a40c0b7aa376 |
children | 597f3ee61a48 |
comparison
equal
deleted
inserted
replaced
31549:ed7b17c7ddf3 | 31551:fd29c7a50a78 |
---|---|
674 %! orig = rand (4, 3) + 1i * rand (4, 3); | 674 %! orig = rand (4, 3) + 1i * rand (4, 3); |
675 %! for method = {"nearest", "linear", "pchip", "cubic", "spline"} | 675 %! for method = {"nearest", "linear", "pchip", "cubic", "spline"} |
676 %! interp_complex = interp2 (orig, xi, yi, method{1}); | 676 %! interp_complex = interp2 (orig, xi, yi, method{1}); |
677 %! interp_real = interp2 (real (orig), xi, yi, method{1}); | 677 %! interp_real = interp2 (real (orig), xi, yi, method{1}); |
678 %! interp_imag = interp2 (imag (orig), xi, yi, method{1}); | 678 %! interp_imag = interp2 (imag (orig), xi, yi, method{1}); |
679 %! assert (real (interp_complex), interp_real) | 679 %! assert (real (interp_complex), interp_real); |
680 %! assert (imag (interp_complex), interp_imag) | 680 %! assert (imag (interp_complex), interp_imag); |
681 %! endfor | 681 %! endfor |
682 | 682 |
683 %!test # 2^n refinement form | 683 %!test # 2^n refinement form |
684 %! x = [1,2,3]; | 684 %! x = [1,2,3]; |
685 %! y = [4,5,6,7]; | 685 %! y = [4,5,6,7]; |
758 %!assert (interp2 (z, [3; 3; 3], [2; 3; 1], "linear"), [7; 9; 5], tol) | 758 %!assert (interp2 (z, [3; 3; 3], [2; 3; 1], "linear"), [7; 9; 5], tol) |
759 %!assert (interp2 (z, [3; 3; 3], [2; 3; 1], "pchip"), [7; 9; 5], tol) | 759 %!assert (interp2 (z, [3; 3; 3], [2; 3; 1], "pchip"), [7; 9; 5], tol) |
760 %!assert (interp2 (z, [3; 3; 3], [2; 3; 1], "cubic"), [7; 9; 5], tol) | 760 %!assert (interp2 (z, [3; 3; 3], [2; 3; 1], "cubic"), [7; 9; 5], tol) |
761 %!test <62132> | 761 %!test <62132> |
762 %! # FIXME: single column yields single row with spline interpolation (numbers are correct) | 762 %! # FIXME: single column yields single row with spline interpolation (numbers are correct) |
763 %! assert (interp2 (z, [3; 3; 3], [2; 3; 1], "spline"), [7; 9; 5], tol) | 763 %! assert (interp2 (z, [3; 3; 3], [2; 3; 1], "spline"), [7; 9; 5], tol); |
764 | 764 |
765 ## Test input validation | 765 ## Test input validation |
766 %!error interp2 (1, 1, 1, 1, 1, 2) # only 5 numeric inputs | 766 %!error interp2 (1, 1, 1, 1, 1, 2) # only 5 numeric inputs |
767 %!error interp2 (1, 1, 1, 1, 1, 2, 2) # only 5 numeric inputs | 767 %!error interp2 (1, 1, 1, 1, 1, 2, 2) # only 5 numeric inputs |
768 %!error <Z must be a 2-D matrix> interp2 ({1}) | 768 %!error <Z must be a 2-D matrix> interp2 ({1}) |