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

 
 

bug #58679: Missing function lsqminnorm

Submitter:  CH <atcl>
Submitted:  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
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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:
http://wiki.octave.org/Differences_between_Octave_and_Matlab#Solvers_for_singular.2C_under-_and_over-determined_matrices

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>
Group administrator
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:
https://octave.org/doc/v5.2.0/Arithmetic-Ops.html#Arithmetic-Ops

So a trivial implementation of the function could be:

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


Markus Mützel <mmuetzel>
Group administrator
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:
   
   
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 dasergatskov (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by atcl (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 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.13-4448.
    Corresponding source code