bugGNU Octave - Bugs: bug #59066, [octave forge] (signal) fir1 =>...

 
 

bug #59066: [octave forge] (signal) fir1 => error: fir2: product: nonconformant arguments

Submitter:  John Beale <jbeale>
Submitted:  Sat 05 Sep 2020 12:23:15 AM UTC
   
 
Category:  Octave Package Severity:  2 - Minor
Priority:  3 - Low Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  lostbard
Originator Name:  Open/Closed:  * Closed
Release:  * other Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 28 Oct 2022 12:05:05 PM UTC, comment #9: 


Signal 1.4.3 released - closing as fixed

John Donoghue <lostbard>
Group Member
Wed 14 Sep 2022 06:47:32 PM UTC, comment #8: 

Pushed change https://sourceforge.net/p/octave/signal/ci/3cf349282fa1695f316689802b051c0ce092244d/

That converts n to a double and also verifies the n input was a valid whole number to start with

John Donoghue <lostbard>
Group Member
Mon 28 Sep 2020 10:37:23 PM UTC, comment #7: 

Ah, sorry, thought that was obvious. I mean that there's no reason to reject integer arguments, seems pointlessly pedantic.

Mike Miller <mtmiller>
Group Member
Mon 28 Sep 2020 09:21:35 PM UTC, comment #6: 

@Mike: thanks for supporting my "no reason not to" feelings :-)

Which one of the solutions do you prefer;

  • converting integer input to double, or
  • flagging integer input a invalid?


Philip Nienhuis <philipnienhuis>
Group Member
Mon 28 Sep 2020 08:47:05 PM UTC, comment #5: 

I concur with the "no reason not to" sentiment. Patches welcome.

Mike Miller <mtmiller>
Group Member
Sun 06 Sep 2020 11:32:52 AM UTC, comment #4: 

Looking better, Matlab's online docs mention that fir1's first argument "n - Filter order" should be of type "double".
So actually this bug is invalid, as Octave is at least compatible with Matlab docs here.

IMO that doesn't invalidate my POV that there's little reason to not accept any integer type value for n as long as it is converted to double right away (as Matlab -undocumented- seems to do), OR flagging non-double input during input validation.
It looks like this equally applies to fir2.m and hamming.m (see below) and maybe several other functions in the signal package.

@OP:
FYI, the culprits if inputting int32 filter order come in fir2.m where:

  • On L.136 of fir2.m "(double (400) + 1) / 2" gives 200.5, later on rounded to 200, while "(int32 (400) + 1) / 2" gives 201, and through some array slicing that's what actually leads to the "non-conformant array sizes" error you saw;
  • But before that on L.82, "hamming (double (400) + 1)" and "hamming (int32 (400) + 1)" silently yield similar sized arrays but with different values.


cc'ing package maintainer, to let him decide what to do here.

Philip Nienhuis <philipnienhuis>
Group Member
Sat 05 Sep 2020 10:52:32 AM UTC, comment #3: 

Matlab (r2014a) happily accepts int32 & int16 for fir1's 1st argument.

Philip Nienhuis <philipnienhuis>
Group Member
Sat 05 Sep 2020 09:41:00 AM UTC, comment #2: 

Intriguing. I'd naively expect that int32 value to be cast to double somewhere along the way. But, fir1 and fir2 seem to be very old functions.

If int32 or any non-double value is unacceptable it had better be catched in input validation. But Matlab's help for fir1 clearly mentions "n - filter order" to be an integer scalar so I see no reason for "n" not to be any integer (i.e., non-double) value.

Status => Confirmed.

Philip Nienhuis <philipnienhuis>
Group Member
Sat 05 Sep 2020 12:33:03 AM UTC, comment #1: 

Update: I found my variable 'ntap' was of type INT32.
Changing it to DOUBLE eliminates this error message.

John Beale <jbeale>
Sat 05 Sep 2020 12:23:15 AM UTC, original submission:  

I have GNU Octave 4.2.2 running on Intel J3455 (4.15.0-111-generic #112-Ubuntu SMP).

I do not understand why a call to signal library fir1() to construct a highpass filter works with literal values, but fails using variables having the same value as the literals. An example is shown below. If this is user error, what am I missing?


>> b = fir1(400, 0.012500, "high");
>> b = fir1(ntap, fset, "high");
error: fir2: product: nonconformant arguments (op1 is 1x402, op2 is 1x401)
error: called from
    fir2 at line 147 column 5
    fir1 at line 118 column 5

>> ntap
ntap = 400
>> fset
fset =  0.012500
>> ntap - 400
ans = 0
>> fset - 0.0125
ans = 0
>> version
ans = 4.2.2
>> pkg list
Package Name   | Version | Installation directory
---------------+---------+-----------------------
      control *|   3.0.0 | /usr/share/octave/packages/control-3.0.0
        image  |   2.6.2 | /usr/share/octave/packages/image-2.6.2
           io  |   2.6.1 | /home/john/octave/io-2.6.1
miscellaneous  |   1.3.0 | /home/john/octave/miscellaneous-1.3.0
     parallel  |   4.0.0 | /home/john/octave/parallel-4.0.0
       signal *|   1.4.1 | /home/john/octave/signal-1.4.1
       struct  |  1.0.16 | /home/john/octave/struct-1.0.16
     symbolic  |   2.8.0 | /home/john/octave/symbolic-2.8.0


John Beale <jbeale>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lostbard (Posted a comment)
  • -email is unavailable- added by siko1056 (Updated the item)
  • -email is unavailable- added by jbeale (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 13 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-10-28 lostbard StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2022-09-14 lostbard StatusConfirmed Ready For Test
        Assigned toNone lostbard
    2020-09-28 mtmiller Severity3 - Normal 2 - Minor
        Priority5 - Normal 3 - Low
    2020-09-28 mtmiller Carbon-CopyRemoved mtmiller -
    2020-09-06 philipnienhuis Carbon-Copy- Added mtmiller
    2020-09-05 siko1056 Summaryfir1 =&gt; error: fir2: product: nonconformant arguments [octave forge] (signal) fir1 => error: fir2: product: nonconformant arguments
    2020-09-05 philipnienhuis CategoryLibraries Octave Package
        StatusNone Confirmed
        Release4.2.2 other
        Operating SystemGNU/Linux Any

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code