bugGNU Octave - Bugs: bug #58679, Missing function lsqminnorm


bug #58679: Missing function lsqminnorm

Submitted by:  CH <atcl>
Submitted on:  Mon 29 Jun 2020 08:48:28 PM UTC  
Category:  Octave Function Severity:  1 - Wish
Priority:  3 - Low Item Group:  Feature Request
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)

You are not logged in

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


Tue 30 Jun 2020 08:57:31 PM UTC, comment #5: 

I'm marking this report as a feature request because it is about a missing function.

If there is a need to discuss the backslash operator compatibility issue, then I think it should be a separate bug report.

John W. Eaton <jwe>
Project Administrator
Tue 30 Jun 2020 01:25:18 PM UTC, comment #4: 

Octave's backslash operator is different from Matlab's backslash operator. AFAICT, this difference is intentional:

If I understand Matlab's documentation for "lsqminnorm" correctly, it minimizes the 2-norm of A*X-B (i.e. it calculates a least-squares solution of the problem A*X=B):

>> X = lsqminnorm(A,B) returns an array X that solves the linear equation AX = B and minimizes the value of norm(A*X-B). If several solutions exist to this problem, then lsqminnorm returns the solution that minimizes norm(X).

I'm not an expert in that field. So please correct me if I'm wrong.

Markus Mützel <mmuetzel>
Project Member
Tue 30 Jun 2020 12:56:45 PM UTC, comment #3: 

This would mean that Octave's "mldivide" would not be compatible with MATLAB, as MATLAB'S "mldivide" computes the least-squares solution.

Also, in your solution, the "tol" argument would be more complex to implement, I guess.

CH <atcl>
Tue 30 Jun 2020 12:56:05 PM UTC, comment #2: 
Dmitri A. Sergatskov <dasergatskov>
Tue 30 Jun 2020 12:45:25 PM UTC, comment #1: 

If I correctly understand the documentation, Octave's mldivide already calculates the minimum norm solution:

So a trivial implementation of the function could be:

function X = lsqminnorm(A, B)
  X = A\B;

Markus Mützel <mmuetzel>
Project Member
Mon 29 Jun 2020 08:48:28 PM UTC, original submission:  

The MATLAB function "lsqminnorm" is not available in Octave 5.2. A simple least-norm solver could be implemented using the QR decomposition, see https://see.stanford.edu/materials/lsoeldsee263/Additional4-ls_ln_matlab.pdf . This QR-based method would also allow to implement the "tol" argument.

CH <atcl>


(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 jwe (Posted a comment)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by atcl (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.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-06-30 jwe Item GroupMatlab Compatibility => Feature Request
    2020-06-30 mtmiller CategoryLibraries => Octave Function
        Severity3 - Normal => 1 - Wish
        Priority5 - Normal => 3 - Low
        Release5.2.0 => dev

    Back to the top

    Powered by Savane 3.6