[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #52593] qr(A, 'matrix') and qr(A, 'vector') re
From: |
Joseph Young |
Subject: |
[Octave-bug-tracker] [bug #52593] qr(A, 'matrix') and qr(A, 'vector') return the wrong result with a tall skinny matrix |
Date: |
Tue, 5 Dec 2017 19:01:45 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0 |
URL:
<http://savannah.gnu.org/bugs/?52593>
Summary: qr(A,'matrix') and qr(A,'vector') return the wrong
result with a tall skinny matrix
Project: GNU Octave
Submitted by: josyoun
Submitted on: Wed 06 Dec 2017 12:01:44 AM UTC
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: None
Status: None
Assigned to: None
Originator Name: josyoun
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 4.2.1
Operating System: GNU/Linux
_______________________________________________________
Details:
It looks like qr(A,'matrix') and qr(A,'vector') return the wrong result when
the matrix is tall and skinny. For example,
> A=[-3.6 0 9.72;3.4 1.9 8.67;3.8 1.7 0;-1.6 4 0;-1.6 4 0];
> [Q R p] = qr(A,'vector')
Q =
0.74626 -0.49565 -0.14732
0.66565 0.55568 0.16516
0.00000 0.57352 0.27055
0.00000 -0.24148 0.66250
0.00000 -0.24148 0.66250
R =
13.02487 -0.42334 1.26473
0.00000 6.62577 0.09892
0.00000 0.00000 6.07377
p =
3 1 2
and
> A=[-3.6 0 9.72;3.4 1.9 8.67;3.8 1.7 0;-1.6 4 0;-1.6 4 0];
> [Q R p] = qr(A,'matrix')
Q =
0.74626 -0.49565 -0.14732
0.66565 0.55568 0.16516
0.00000 0.57352 0.27055
0.00000 -0.24148 0.66250
0.00000 -0.24148 0.66250
R =
13.02487 -0.42334 1.26473
0.00000 6.62577 0.09892
0.00000 0.00000 6.07377
p =
3 1 2
In both cases, the skinny factorization is given, which normally requires the
argument 0 to be passed. In addition, when matrix a matrix permutation is
requested, a vector permutation is given. Conversely, in MATLAB, we have:
>> A = [-3.6 0 9.72;3.4 1.9 8.67;3.8 1.7 0;-1.6 4 0;-1.6 4 0];
>> [Q R p] = qr(A,'vector')
Q =
-0.7463 0.4957 0.1473 -0.2964 -0.2964
-0.6656 -0.5557 -0.1652 0.3323 0.3323
0 -0.5735 -0.2706 -0.5468 -0.5468
0 0.2415 -0.6625 0.5373 -0.4627
0 0.2415 -0.6625 -0.4627 0.5373
R =
-13.0249 0.4233 -1.2647
0 -6.6258 -0.0989
0 0 -6.0738
0 0 0
0 0 0
p =
3 1 2
>> [Q R p] = qr(A,'matrix')
Q =
-0.7463 0.4957 0.1473 -0.2964 -0.2964
-0.6656 -0.5557 -0.1652 0.3323 0.3323
0 -0.5735 -0.2706 -0.5468 -0.5468
0 0.2415 -0.6625 0.5373 -0.4627
0 0.2415 -0.6625 -0.4627 0.5373
R =
-13.0249 0.4233 -1.2647
0 -6.6258 -0.0989
0 0 -6.0738
0 0 0
0 0 0
p =
0 1 0
0 0 1
1 0 0
which I contend should be expected result. Really, I'm looking for a way to
get a vector permutation matrix as well as the entire Q matrix, not the skinny
factorization and this doesn't appear to be currently possible due to a bug.
For reference:
GNU Octave Version: 4.2.1
MATLAB Version: 9.3.0.713579 (R2017b)
both where run on Linux. Thanks for the hard work!
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?52593>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #52593] qr(A, 'matrix') and qr(A, 'vector') return the wrong result with a tall skinny matrix,
Joseph Young <=
- [Octave-bug-tracker] [bug #52593] qr(A, 'matrix') and qr(A, 'vector') return the wrong result with a tall skinny matrix, Marco Caliari, 2017/12/06
- [Octave-bug-tracker] [bug #52593] qr(A, 'matrix') and qr(A, 'vector') return the wrong result with a tall skinny matrix, Marco Caliari, 2017/12/06
- [Octave-bug-tracker] [bug #52593] qr(A, 'matrix') and qr(A, 'vector') return the wrong result with a tall skinny matrix, Rik, 2017/12/06
- [Octave-bug-tracker] [bug #52593] qr(A, 'matrix') and qr(A, 'vector') return the wrong result with a tall skinny matrix, Joseph Young, 2017/12/06
- [Octave-bug-tracker] [bug #52593] qr(A, 'matrix') and qr(A, 'vector') return the wrong result with a tall skinny matrix, Joseph Young, 2017/12/06
- [Octave-bug-tracker] [bug #52593] qr(A, 'matrix') and qr(A, 'vector') return the wrong result with a tall skinny matrix, Rik, 2017/12/06
- [Octave-bug-tracker] [bug #52593] qr(A, 'matrix') and qr(A, 'vector') return the wrong result with a tall skinny matrix, Marco Caliari, 2017/12/07