octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #64861] qr with single return value.


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #64861] qr with single return value.
Date: Tue, 7 Nov 2023 10:26:09 -0500 (EST)

Update of bug #64861 (project octave):

                  Status:                    None => Confirmed              
                 Release:                   8.1.0 => dev                    
        Operating System:       Microsoft Windows => Any                    

    _______________________________________________________

Follow-up Comment #1:

just confirming this incompatibility exists with Octave 9 (hg id: 9c955ab01f0)
and Matlab 2023b:

Matlab 2023b

>> A = [1 2 3]
A =
     1     2     3
>> [q r] = qr(A')
q =
   -0.2673   -0.5345   -0.8018
   -0.5345    0.7745   -0.3382
   -0.8018   -0.3382    0.4927
r =
   -3.7417
         0
         0
>> a = qr(A')
a =
   -3.7417
         0
         0
>> as = qr(sparse(A')), full(as)
as =
   (1,1)      -3.7417
ans =
   -3.7417
         0
         0


Octave 9:

octave:1> A = [1 2 3]
A =

   1   2   3

octave:2> [q r] = qr(A')
q =

  -0.2673  -0.5345  -0.8018
  -0.5345   0.7745  -0.3382
  -0.8018  -0.3382   0.4927

r =

  -3.7417
        0
        0

octave:3> a = qr(A')
a =

  -3.7417
   0.5345
   0.8018

octave:4> as = qr(sparse(A')), full(as)
as =

Compressed Column Sparse (rows = 3, cols = 1, nnz = 1 [33%])

  (1, 1) -> -3.7417

ans =

  -3.7417
        0
        0



It appears this was a change in Matlab R2022a. From the current public
documentation for qr:
"R2022a: One-output syntax always returns upper-triangular factor
The syntax R = qr(A) always returns R as an upper-triangular matrix,
regardless of whether A is full or sparse. Previously, for full A, the
one-output syntax returned an R matrix with Householder vectors located in the
lower-triangular portion of the matrix. These vectors partially defined the Q
matrix."

we could consider simplifying the function to be compatible.  it's a rare case
to see a function produce a different output for the same value input
depending on whether the input is sparse or full. 


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?64861>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]