bugGNU Octave - Bugs: bug #41567, qr fails with two matrix inputs


bug #41567: qr fails with two matrix inputs

Submitted by:  Nir Krakauer <nir_krakauer>
Submitted on:  Wed 12 Feb 2014 01:45:41 PM UTC  
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: Patch SubmittedAssigned to: None
Originator Name: Nir KrakauerOpen/Closed: Open
Release: devOperating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

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


(Jump to the original submission Jump to the original submission)

Sat 23 Jan 2016 05:40:52 AM UTC, comment #7:

On closer inspection, there are a couple of minor issues with Massimiliano's patch. (It doesn't support qr(A,B,0) for full A, and the variable b_mat is redundant given have_b.) Both issues are fixed by the changeset at bug #46912.

Lachlan Andrew <lachlan>
Project Member
Sat 23 Jan 2016 03:07:19 AM UTC, comment #6:

Massimiliano's patch looks good to me. I've updated it to reflect recent changes to the code base.

There are still some issues the the qr code; I'll submit another patch at bug #46912.

(file #36135)

Lachlan Andrew <lachlan>
Project Member
Mon 18 Jan 2016 06:30:33 PM UTC, comment #5:

Your patch has been noticed, we just have few patch review resources in Octave.

Mike Miller <mtmiller>
Project Member
Fri 12 Sep 2014 02:00:44 PM UTC, comment #4:

I'm starting to think that my patch went unnoticed. That is why I'm pinging, as I was suggested to do on IRC.

Any feedback would be much appreciated.

Massimiliano Fasi <mfasi>
Sun 09 Mar 2014 04:11:13 PM UTC, comment #3:

I have submitted a patch that should fix the bug, with relative tests.

(file #30836)

Massimiliano Fasi <mfasi>
Thu 13 Feb 2014 05:50:42 PM UTC, comment #2:

The expected behavior, as per both the Octave and Matlab documentation, is to return Q'*B if B is a matrix, regardless of whether A is sparse.

Nir Krakauer <nir_krakauer>
Thu 13 Feb 2014 05:42:40 PM UTC, comment #1:

Confirmed in version 3.8.0, although I am not sure what the expected behavior is here. The code for the qr function only uses the B argument if A is sparse. If A is not sparse, the second argument serves the same purpose as the documented '0' argument regardless of its value. Does the behavior or the documentation need fixing?

Mike Miller <mtmiller>
Project Member
Wed 12 Feb 2014 01:45:41 PM UTC, original submission:

if, for example,
A = randn(3, 3); B = randn(3, 2);

[Q, R] = qr (A, 0);

works as expected, returning a QR decomposition with QR = A.

According to the documentation,

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

should return C = Q'*B -- but it actually just returns C = Q, which is quite different.

Nir Krakauer <nir_krakauer>


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

Attach File(s):

Attached Files
file #36135:  bug_41567.cset added by lachlan (7kB - application/octet-stream)
file #30836:  bugfix_41567.patch added by mfasi (7kB - text/x-diff)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by lachlan (Updated the item)
  • -unavailable- added by jordigh (Updated the item)
  • -unavailable- added by mfasi (Updated the item)
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by nir_krakauer (Submitted the item)

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

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 23 Jan 2016 03:07:19 AM UTClachlanAttached File-=>Added bug_41567.cset, #36135
    Mon 18 Jan 2016 06:30:33 PM UTCmtmillerRelease3.6.2=>dev
    Tue 18 Mar 2014 02:25:18 PM UTCjordighStatusNeed Info=>Patch Submitted
    Sun 09 Mar 2014 04:11:13 PM UTCmfasiAttached File-=>Added bugfix_41567.patch, #30836
    Thu 13 Feb 2014 05:42:40 PM UTCmtmillerCategoryNone=>Octave Function
      StatusNone=>Need Info

    Back to the top

    Powered by Savane 3.1-cleanup