bugGNU Octave - Bugs: bug #60432, [octave forge] (signal) xcorr...

 
 

bug #60432: [octave forge] (signal) xcorr optional args in any positional order

Submitter:  None
Submitted:  Wed 21 Apr 2021 04:08:00 PM UTC
   
 
Category:  Octave Package Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  lostbard
Originator Name:  IK Proudler Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 5.2.0
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 28 Oct 2022 12:04:37 PM UTC, comment #5: 


Signal 1.4.3 released - closing as fixed

John Donoghue <lostbard>
Group Member
Wed 14 Sep 2022 04:46:53 PM UTC, comment #4: 

I pushed up a change to use the input optional arg types and added some BISTs

https://sourceforge.net/p/octave/signal/ci/f7ba5453c3fccddd657b943b266812045b99f4d4/


John Donoghue <lostbard>
Group Member
Wed 21 Apr 2021 08:22:13 PM UTC, comment #3: 

Ok, thanks, confirmed. Agree that input validation should be updated, and also argument parsing needs to allow for 'maxlag' and 'scale' arguments to be swapped based on their type.

Should also include new corresponding tests of input validation and a test to show that different argument ordering produces an identical result.

Mike Miller <mtmiller>
Group Member
Wed 21 Apr 2021 06:46:40 PM UTC, comment #2: 

My apologies, I should have been more careful proof-reading my post.

The call that produced the error is:


xcorr(M,'coeff',Nlag)


Anonymous
Wed 21 Apr 2021 05:53:55 PM UTC, comment #1: 

Your example works for me with the current signal package:


M = rand (1000);
Nlag = 128;
R = xcorr (M, Nlag, 'coeff');


Can you give a more complete example that shows the error you encountered?

Mike Miller <mtmiller>
Group Member
Wed 21 Apr 2021 04:08:00 PM UTC, original submission:  

The documentation for xcorr is misleading or there is a logical error in the code.

'help xcorr' says:


 -- Function File: [R, LAG] = xcorr ( X )
 -- Function File: ... = xcorr ( X, Y )
 -- Function File: ... = xcorr ( ..., MAXLAG)
 -- Function File: ... = xcorr ( ..., SCALE)

Thus, with M a matrix and Nlag an integer, the call


xcorr(M,Nlag,'coeff')

should work. However it returns an error:


error: xcorr: X must be a vector or matrix
error: called from
    xcorr at line 171 column 5

The relevant lines are:


169  ## check argument values
170  if isempty(X) || isscalar(X) || ischar(Y) || ! ismatrix(X)
171    error("xcorr: X must be a vector or matrix");

For my call to work, I think the boolean


ischar(Y) || ! ismatrix(X)

should be replaced with


ischar(Y) && ! ismatrix(X)

Alternatively, since the call


xcorr(M,Nlag,'coeff')

works, the help message needs to be changed so that MAXLAG comes before SCALE.


Anonymous

 

(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 None (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 10 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
    2021-04-21 mtmiller Severity3 - Normal 2 - Minor
        Item GroupUnexpected Error or Warning Matlab Compatibility
        StatusWorks For Me Confirmed
        Summary[octave forge] (signal) xcorr documentaion misleading or error in code [octave forge] (signal) xcorr optional args in any positional order
    2021-04-21 mtmiller StatusNone Works For Me
        Summaryxcorr documentaion misleading or error in code [octave forge] (signal) xcorr documentaion misleading or error in code

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code