bugGNU Octave - Bugs: bug #49309, matlab mismatch with [~,~,c]=svd(...

 
 

bug #49309: matlab mismatch with [~,~,c]=svd( [1,1,1] ,0)

Submitter:  None
Submitted:  Tue 11 Oct 2016 04:45:16 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  WTF, Matlab?!?
Status:  Fixed Assigned to:  None
Originator Name:  martin Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 4.0.0
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 11 Oct 2016 09:24:57 PM UTC, comment #5: 

I checked in a compatibility fix on the development branch here (http://hg.savannah.gnu.org/hgweb/octave/rev/68e9bdb7cde3).

Rik <rik5>
Group administrator
Tue 11 Oct 2016 06:04:11 PM UTC, comment #4: 

The difference probably isn't very useful, but probably is historic.  I think they used to recommend '0' as the second argument whenever you didn't want the regular svd.  At some point, they realized that their code wasn't actually calculating 'econ', but everyone was using '0' for a particular behavior.  So, they left the old behavior under '0' and added a true 'econ' option.

I guess it isn't that hard to implement since it is only checking the input matrices rows and columns to decide what to do.

Rik <rik5>
Group administrator
Tue 11 Oct 2016 05:00:39 PM UTC, comment #3: 

I think the real issue is that for svd (X, 0) is not identical to svd (X, 'econ').

Am I missing something?  Why is this difference useful?

John W. Eaton <jwe>
Group administrator
Tue 11 Oct 2016 04:59:17 PM UTC, comment #2: 

According to https://www.mathworks.com/help/matlab/ref/svd.html


[U,S,V] = svd(A,0) produces a different economy-size decomposition of m-by-n matrix A:

    m > n — svd(A,0) is equivalent to svd(A,'econ').

    m <= n — svd(A,0) is equivalent to svd(A).


So that seems to confirm this report.

Mike Miller <mtmiller>
Group Member
Tue 11 Oct 2016 04:55:03 PM UTC, comment #1: 

When you supply a second argument the svd function is supposed to calculate the "economy" size version of the svd which eliminates unnecessary rows.  Could you try the following code in Matlab and post what it returns?


[a,b,c] = svd ([1 1 1])
[a2,b2,c2] = svd ([1 1 1], 0)



Rik <rik5>
Group administrator
Tue 11 Oct 2016 04:45:16 PM UTC, original submission:  

there is a mismatch between matlab and octave behavior when using 0 as the second argument for svd

in octave 4.0.0

>> [~,~,c]=svd( [1,1,1] ,0)

c =

   0.57735
   0.57735
   0.57735

in matlab 2014

K>> [~,~,c]=svd( [1,1,1] ,0)

c =

   -0.5774   -0.5774   -0.5774
   -0.5774    0.7887   -0.2113
   -0.5774   -0.2113    0.7887

it would be good to modify the svd function to behave like matlab or raise an error

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 jwe (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by rik5 (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-10-11 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2016-10-11 jwe Open/ClosedClosed Open
    2016-10-11 jwe Item GroupMatlab Compatibility WTF, Matlab?!?
        StatusNeed Info Confirmed
        Open/ClosedOpen Closed
    2016-10-11 rik5 StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code