changeset 32748:50146e3265e0

movfun.m: Use safer check for output dimension (bug #55984) * movfun.m: Do a test call of function with data from input X rather than all zeros which may not be in domain of the function.
author Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
date Sun, 14 Jan 2024 20:57:27 -0800
parents 02b1f23e761e
children d1118c97741d
files scripts/signal/movfun.m
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/signal/movfun.m	Sun Jan 14 15:02:48 2024 -0800
+++ b/scripts/signal/movfun.m	Sun Jan 14 20:57:27 2024 -0800
@@ -261,11 +261,10 @@
     endswitch
   endif
 
-  ## FIXME: Validation doesn't seem to work correctly (noted 12/16/2018).
   ## Validate that outdim makes sense
-  fout = fcn (zeros (length (win), 1, class (x)));  # output for window
-  yclass = class (fout);                    # record class of fcn output
-  noutdim = length (fout);                  # number of output dimensions
+  fout = fcn (x(1:length (win))(:));  # output for window (see bug #55984)
+  yclass = class (fout);              # record class of fcn output
+  noutdim = length (fout);            # number of output dimensions
   if (! isempty (outdim))
     if (max (outdim) > noutdim)
       error ("Octave:invalid-input-arg", ...