bugGNU Octave - Bugs: bug #58944, [z,r,p]=qr(a,b) unexpectedly...

 
 

bug #58944: [z,r,p]=qr(a,b) unexpectedly returns z as q instead of q' * b

Submitted by:  A.R. Burgers <arb>
Submitted on:  Thu 13 Aug 2020 02:35:13 PM UTC  
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Need Info 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.

 

Fri 21 Aug 2020 10:27:40 AM UTC, comment #2: 

I think that

[C, R, E] = qr (A, B)

should work only for sparse matrices and returns the fill-reducing ordering matrix E, such that A*X=B iff X=E*(R\C).
It is related to bug #57033, especially comments #6 and #9.

Marco Caliari <caliari>
Project Member
Thu 13 Aug 2020 09:38:32 PM UTC, comment #1: 

This may not be implemented in Octave.  Looking at the documentation, the calling forms are:

 -- [Q, R] = qr (A)
-- [Q, R, P] = qr (A) # non-sparse A
-- X = qr (A) # non-sparse A
-- R = qr (A) # sparse A
-- [C, R] = qr (A, B)
-- [...] = qr (..., 0)
-- [...] = qr (..., "vector")
-- [...] = qr (..., "matrix")

There is a three-output form for a single input matrix A, but there is no listing for a three-output form with 2 inputs.  In the main body of the documentation there is also no discussion of a form such as

[C, R, P] = qr (A, B)

It gets weirder.  Matlab won't accept

[z,r,p] = qr (a,b);

and complains that the matrices must be sparse.  If I do that with

[z,r,p] = qr (sparse(a),sparse(b));

then it works and returns a 3x1 vector.

However, Octave goes the other way.  it will accept full matrices with a permutation output, but not sparse ones:

[z,r,p] = qr(sparse(a),sparse(b));
error: qr: Permutation output is not supported for sparse input

I think we need to decide what should happen and then go implement that.  Should the [z,r,p] form be allowed with full matrices?  Should the [z,r,p] = qr (a,b) form work with sparse matrices?

Rik <rik5>
Project Administrator
Thu 13 Aug 2020 02:35:13 PM UTC, original submission:  

according to the docs [z,r] = qr(a,b) returns the vector z=q'*b, where q is the matrix returned by [q,r]=qr(a). This works as advertized, however [z,r,p] = qr(a,b) unexpectedly (for me) returns z as the matrix q. This applies to all of octave 5/6/7

ver = version
a = rand(3,2);
b = rand(3,1);
[z,r] = qr(a,b);
size_z_no_p_requested = size(z)
[z,r,p] = qr(a,b);
size_z_p_requested = size(z)

ver = 5.2.1
size_z_no_p_requested =
   3   1

size_z_p_requested =
   3   3

A.R. Burgers <arb>

 

(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 caliari (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by arb (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.

     

     

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-08-13 rik5 StatusNone => Need Info

    Back to the top


    Powered by Savane 3.5