octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #48774] Functions for moving statistics


From: Rik
Subject: [Octave-bug-tracker] [bug #48774] Functions for moving statistics
Date: Tue, 18 Dec 2018 15:22:51 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063

Follow-up Comment #15, bug #48774 (project octave):

@Juan: Can you explain the "outdim" parameter?  The documentation right now
says


"outdim"
     A row vector that selects which dimensions of the calculation
     will appear in the output Y.  This is only useful when FCN
     returns an N-dimensional array in Format 1.  The default is to
     return all output dimensions.

Programming Note: The property "outdim" can be used to save memory
when the output of FCN has many dimensions, or when a wrapper to
the base function that selects the desired outputs is too costly.
When memory is not an issue, the easiest way to select output
dimensions is to first calculate the complete result with 'movfun'
and then filter that result with indexing.  If code complexity is
not an issue then a wrapper can be created using anonymous
functions.  For example, if 'basefcn' is a function returning a
K-dimensional row output, and only dimension D is desired, then the
following wrapper could be used.

     FCN = @(x) basefcn (x)(:,size(x,2) * (D-1) + (1:size(x,2)));
     Y = movfun (@fcn, ...);


I tried this as an example, but there was an error.


x = magic (3);
x(:,:,2) = 3*x
x =

ans(:,:,1) =

   8   1   6
   3   5   7
   4   9   2

ans(:,:,2) =

   24    3   18
    9   15   21
   12   27    6

movfun (@mean, x, 3, 'outdim', 3)
error: movfun: output dimension OUTDIM (3) is larger than largest available
dimension (1)
error: called from




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?48774>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]