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

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

[Octave-bug-tracker] [bug #65928] movfun dimension contstraints: shouldn


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #65928] movfun dimension contstraints: shouldn't error for dim > ndims(x), or wlen > size(x, dim), or wlen=1
Date: Fri, 28 Jun 2024 14:01:57 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?65928>

                 Summary: movfun dimension contstraints: shouldn't error for
dim > ndims(x), or wlen > size(x, dim), or wlen=1
                   Group: GNU Octave
               Submitter: nrjank
               Submitted: Fri 28 Jun 2024 02:01:57 PM EDT
                Category: Octave Function
                Severity: 2 - Minor
                Priority: 5 - Normal
              Item Group: Feature Request
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 9.2.0
         Discussion Lock: Any
        Operating System: Any
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Fri 28 Jun 2024 02:01:57 PM EDT By: Nicholas Jankowski <nrjank>
The moving window functions calling movfun currently throw an error if the
requested operating dimension is larger than the ndims(x).  If that is
relaxed, then an error occurs because wlen > 1 (and it errors separately for
wlen < 2).

all of those are matlab incompatible.  relaxing the dim <=ndims is fairly
simple, but the rest may be rather involved. 

here are a handful of things that should produce valid outputs, as per matlab
2024a:


x = reshape (1:30, 5, 3, 2);

>> movmean(x,2,4)

ans(:,:,1) =

     1     6    11
     2     7    12
     3     8    13
     4     9    14
     5    10    15


ans(:,:,2) =

    16    21    26
    17    22    27
    18    23    28
    19    24    29
    20    25    30

>> movmean(x,29,3)

ans(:,:,1) =

    8.5000   13.5000   18.5000
    9.5000   14.5000   19.5000
   10.5000   15.5000   20.5000
   11.5000   16.5000   21.5000
   12.5000   17.5000   22.5000


ans(:,:,2) =

    8.5000   13.5000   18.5000
    9.5000   14.5000   19.5000
   10.5000   15.5000   20.5000
   11.5000   16.5000   21.5000
   12.5000   17.5000   22.5000

>> movmean(x,29,4)

ans(:,:,1) =

     1     6    11
     2     7    12
     3     8    13
     4     9    14
     5    10    15


ans(:,:,2) =

    16    21    26
    17    22    27
    18    23    28
    19    24    29
    20    25    30

>> movmean(x,1,2)

ans(:,:,1) =

     1     6    11
     2     7    12
     3     8    13
     4     9    14
     5    10    15


ans(:,:,2) =

    16    21    26
    17    22    27
    18    23    28
    19    24    29
    20    25    30

>> movmean(x,4,2)

ans(:,:,1) =

    3.5000    6.0000    6.0000
    4.5000    7.0000    7.0000
    5.5000    8.0000    8.0000
    6.5000    9.0000    9.0000
    7.5000   10.0000   10.0000


ans(:,:,2) =

   18.5000   21.0000   21.0000
   19.5000   22.0000   22.0000
   20.5000   23.0000   23.0000
   21.5000   24.0000   24.0000
   22.5000   25.0000   25.0000

>> movmean(x,5,2)

ans(:,:,1) =

     6     6     6
     7     7     7
     8     8     8
     9     9     9
    10    10    10


ans(:,:,2) =

    21    21    21
    22    22    22
    23    23    23
    24    24    24
    25    25    25


>> movmean(x,1,5)

ans(:,:,1) =

     1     6    11
     2     7    12
     3     8    13
     4     9    14
     5    10    15


ans(:,:,2) =

    16    21    26
    17    22    27
    18    23    28
    19    24    29
    20    25    30









    _______________________________________________________

Reply to this item at:

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

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

Attachment: signature.asc
Description: PGP signature


reply via email to

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