Mercurial > octave
changeset 33147:bfcd1515cd40
Fix naming of rows and columns in fft2, ifft2 error messages.
* fft2.cc (do_fft2): Use 'M' for number of rows and 'N' for number of columns
in error messages which matches documentation and common conventions.
* fft2.cc (Ffft2): Add BIST tests for error messages.
* fft2.cc (Fifft2): Add BIST tests for error messages.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 04 Mar 2024 14:01:52 -0800 |
parents | 6e67f10b4d33 |
children | 963b9183ea1d |
files | libinterp/corefcn/fft2.cc |
diffstat | 1 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/fft2.cc Mon Mar 04 20:31:58 2024 +0100 +++ b/libinterp/corefcn/fft2.cc Mon Mar 04 14:01:52 2024 -0800 @@ -56,11 +56,11 @@ { double dval = args(1).double_value (); if (math::isnan (dval)) - error ("%s: number of rows (N) cannot be NaN", fcn); + error ("%s: number of rows (M) cannot be NaN", fcn); n_rows = math::nint_big (dval); if (n_rows < 0) - error ("%s: number of rows (N) must be greater than zero", fcn); + error ("%s: number of rows (M) must be greater than zero", fcn); } octave_idx_type n_cols = -1; @@ -68,11 +68,11 @@ { double dval = args(2).double_value (); if (math::isnan (dval)) - error ("%s: number of columns (M) cannot be NaN", fcn); + error ("%s: number of columns (N) cannot be NaN", fcn); n_cols = math::nint_big (dval); if (n_cols < 0) - error ("%s: number of columns (M) must be greater than zero", fcn); + error ("%s: number of columns (N) must be greater than zero", fcn); } for (int i = 0; i < dims.ndims (); i++) @@ -164,6 +164,11 @@ %!testif HAVE_FFTW <*65414> %! sz = size (fft2 (ones (5, 4, 3), 2, 0)); %! assert (sz, [2, 0, 3]); + +%!error <number of rows \(M\) cannot be NaN> fft2 (ones (5,4,3), NaN, 2) +%!error <number of rows \(M\) .* greater than zero> fft2 (ones (5,4,3), -1, 2) +%!error <number of columns \(N\) cannot be NaN> fft2 (ones (5,4,3), 2, NaN) +%!error <number of columns \(N\) .* greater than zero> fft2 (ones (5,4,3), 2, -1) */ DEFUN (ifft2, args, , @@ -275,6 +280,11 @@ %! s = ifft2 (S); %! %! assert (s, answer, 30* eps ("single")); + +%!error <number of rows \(M\) cannot be NaN> ifft2 (ones (5,4,3), NaN, 2) +%!error <number of rows \(M\) .* greater than zero> ifft2 (ones (5,4,3), -1, 2) +%!error <number of columns \(N\) cannot be NaN> ifft2 (ones (5,4,3), 2, NaN) +%!error <number of columns \(N\) .* greater than zero> ifft2 (ones (5,4,3), 2, -1) */ OCTAVE_END_NAMESPACE(octave)