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 Feb 12 13:45:41 2014  
Category: Octave FunctionSeverity: 4 - Important
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Nir KrakauerOpen/Closed: Closed
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)

Mon Aug 8 01:36:03 2016, comment #12:

Verified fix, closing report.

Rik <rik5>
Project Administrator
Fri Aug 5 18:35:31 2016, comment #11:

I checked in the changeset from file #36374 here:


Can this report be closed?

John W. Eaton <jwe>
Project Administrator
Wed Jul 6 07:48:21 2016, comment #10:

Hi, I would like to help here, but which patch(es) should I apply to development? file #36374 applies smoothly, but afterwards I cannot apply file #36373 from bug #46912.

Marco Caliari <caliari>
Project Member
Mon Jun 27 06:22:31 2016, comment #9:

I've increased the importance of this bug to reflect that it silently produces completely bogus results -- a class of bugs that I consider fatal to a language.

I hope massimiliano's patch is one of those to make it into 4.2.

Lachlan Andrew <lachlan>
Project Member
Thu Feb 18 05:05:43 2016, comment #8:

Here's a new patch to reflect jwe's recent changes.

(file #36374)

Lachlan Andrew <lachlan>
Project Member
Sat Jan 23 05:40:52 2016, 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 Jan 23 03:07:19 2016, 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 Jan 18 18:30:33 2016, comment #5:

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

Mike Miller <mtmiller>
Project Administrator
Fri Sep 12 14:00:44 2014, 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 Mar 9 16:11:13 2014, comment #3:

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

(file #30836)

Massimiliano Fasi <mfasi>
Thu Feb 13 17:50:42 2014, 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 Feb 13 17:42:40 2014, 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 Administrator
Wed Feb 12 13:45:41 2014, 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 #36374:  bug_41567.v2.cset added by lachlan (7kB - application/octet-stream)
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 rik5 (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by caliari (Posted a comment)
  • -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 11 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon Aug 8 01:36:03 2016rik5StatusReady For Test=>Fixed
    Fri Aug 5 18:35:31 2016jweStatusPatch Submitted=>Ready For Test
    Mon Jun 27 06:22:31 2016lachlanSeverity3 - Normal=>4 - Important
    Thu Feb 18 05:05:43 2016lachlanAttached File-=>Added bug_41567.v2.cset, #36374
    Sat Jan 23 03:07:19 2016lachlanAttached File-=>Added bug_41567.cset, #36135
    Mon Jan 18 18:30:33 2016mtmillerRelease3.6.2=>dev
    Tue Mar 18 14:25:18 2014jordighStatusNeed Info=>Patch Submitted
    Sun Mar 9 16:11:13 2014mfasiAttached File-=>Added bugfix_41567.patch, #30836
    Thu Feb 13 17:42:40 2014mtmillerCategoryNone=>Octave Function
      StatusNone=>Need Info

    Back to the top

    Powered by Savane 3.1-cleanup1