Last change
on this file since 37 was
37,
checked in by (none), 14 years ago
|
Added original make3d
|
-
Property svn:executable set to
*
|
File size:
425 bytes
|
Rev | Line | |
---|
[37] | 1 | % [R,Q] = vgg_rq(S) Just like qr but the other way around.
|
---|
| 2 | %
|
---|
| 3 | % If [R,Q] = vgg_rq(X), then R is upper-triangular, Q is orthogonal, and X==R*Q.
|
---|
| 4 | % Moreover, if S is a real matrix, then det(Q)>0.
|
---|
| 5 |
|
---|
| 6 | % By awf
|
---|
| 7 |
|
---|
| 8 | function [U,Q] = rq(S)
|
---|
| 9 |
|
---|
| 10 | S = S';
|
---|
| 11 | [Q,U] = qr(S(end:-1:1,end:-1:1));
|
---|
| 12 | Q = Q';
|
---|
| 13 | Q = Q(end:-1:1,end:-1:1);
|
---|
| 14 | U = U';
|
---|
| 15 | U = U(end:-1:1,end:-1:1);
|
---|
| 16 |
|
---|
| 17 | if det(Q)<0
|
---|
| 18 | U(:,1) = -U(:,1);
|
---|
| 19 | Q(1,:) = -Q(1,:);
|
---|
| 20 | end
|
---|
| 21 |
|
---|
| 22 | return
|
---|
Note: See
TracBrowser
for help on using the repository browser.