bugGNU Octave - Bugs: bug #57145, backslash vs. pinv


bug #57145: backslash vs. pinv

Submitted by:  Muhali <muhali>
Submitted on:  Wed 30 Oct 2019 04:34:39 PM UTC  
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  5.1.0 Operating System:  GNU/Linux

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Wed 30 Oct 2019 09:27:38 PM UTC, comment #1: 

Is this a recent change of how matlab interprets its backslash operator? Indeed, its documentation says that multiplication by the pinv gives the minimum-norm solution (that's guaranteed by the properties of the Moore-Penrose pseudoinverse), while the backslash operator according to the mldivide documentation "is not necessarily the minimum norm solution", and only according to the pinv documentation "is special because it has only three nonzero elements" in the present example. I do not find a general rule, so I would say it is undocumented what matlab really computes in the case of underdetermined problems. If it is the solution with the least number of non-zero entries, then this is not unique as I see it. Perhaps it is the one with the smallest norm among those with the smallest number of non-zero entries (but I am not sure if even that is unique in general).

In contrast, for octave it is well-defined: it is the minimum-norm solution, just as what you would get by pinv (but computed more efficiently). So your point a) is valid (but as I said, does matlab even define its behaviour in this case?), but b) is not true in general (I would even estimate that the minimum-norm solution gives a smaller error in general).

Michael Leitner <mleitner>
Wed 30 Oct 2019 04:34:39 PM UTC, original submission:  

A = magic(8);
A = A(:,1:6) ;
b = 260*ones(8,1) ;

x1 = A\b
x2 = pinv(A)*b

x3 = [3 4 0 0 1 0]' ;

There are two (possibly well known) issues here.

a) x1 differs from Matlab (which gives x3).

b) solution x3 is "closer" than solution x1.

The example comes from the Matlab pinv help. ML probably uses a different/better optimization algorithm, so the difference should perhaps be mentioned at least.

Muhali <muhali>


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

Attach Files:

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 mleitner (Posted a comment)
  • -email is unavailable- added by muhali (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    No changes have been made to this item

    Back to the top

    Powered by Savane 3.5