<< ddeye DD: 16 bytes decimal arithmetics ddip >>

DD_QD (MuPAT) >> DD_QD (MuPAT) > DD: 16 bytes decimal arithmetics > ddgqr

ddgqr

QR decomposition with modified Gram-Schmidt orthonormalization

Syntax

[Q,R] = ddgqr(A)

Parameters

A

DD matrix

Q, R

DD matrices: Q is orthogonal, R is upper-Right, and Q*R==A.

Description

ddgqr(A)

returns a (m,n) orthogonal matrix Q, and a (n,n) upper Right triangular matrix R, such that A = Q*R.

Examples

Decomposing a square matrix:

A = ddrand(5,5);
[Q, R] = ddgqr(A);
R      // upper-Right
Q'*Q   // Q orthogonal
Q*R-A  // {Q, R} such that A = Q*R
--> A = ddrand(5,5);
--> [Q, R] = ddgqr(A);
--> R      // upper-Right
 R  =
[d1]
   1.0276952   1.0883915   0.4438709   0.6298701   0.8929215
   0.          0.4053251   0.405679    0.5015382   0.4345841
   0.          0.          0.6123556   0.0610015   0.0478677
   0.          0.          0.          0.3527555   0.35924
   0.          0.          0.          0.          0.407706

[d2] 10^-17 *
  -5.5416962   8.6289724  -2.1701687   1.0175454   1.0208458
   0.         -2.5160916   1.045223    4.3587077  -0.4703223
   0.          0.          0.0479763   0.3100273  -0.3052711
   0.          0.          0.          1.0067234   0.8982596
   0.          0.          0.          0.         -1.0127866

--> Q'*Q   // Q orthogonal
 ans  =
[d1]
   1.   0.   0.   0.   0.
   0.   1.   0.   0.   0.
   0.   0.   1.   0.   0.
   0.   0.   0.   1.   0.
   0.   0.   0.   0.   1.

[d2] 10^-17 *
  -2.465D-15   0.          0.   0.          0.
   0.          1.079D-15   0.   0.          0.
   0.          0.          0.   0.          0.
   0.          0.          0.  -9.244D-16   0.
   0.          0.          0.   0.         -2.003D-15

--> Q*R-A  // {Q, R} such that A = Q*R
 ans  =
[d1] 10^-33 *
   0.   0.         -1.540744   0.          0.
   0.   3.8518599   0.         3.0814879   0.
   0.   0.          0.        -3.0814879  -6.1629758
   0.   0.          0.         0.          9.2444637
   0.   0.          0.         0.         -3.0814879

[d2] zeros(5,5)

With a rectangular matrix:

A = ddrand(3,5);
[Q, R] = ddgqr(A);
R      // upper-Right
Q'*Q   // Q orthogonal
Q*R-A  // {Q, R} such that A = Q*R
--> A = ddrand(3,5);
--> [Q, R] = ddgqr(A);
--> R      // upper-Right
 R  =
[d1]
   0.8640718   0.0470916   0.7822416   0.7741461   0.9556921
   0.          0.8553543   0.4750534   0.2601096   0.4186977
   0.          0.          0.0190578  -0.7748508  -0.0248745
   0.          0.          0.          0.          0.6761419
   0.          0.          0.          0.          0.6761419

[d2] 10^-17 *
   0.3460269   0.0749481   0.9294711   5.1624504   4.3993537
   0.         -4.753316    0.2413107  -2.4295448   1.9963482
   0.          0.         -0.0536768  -3.2012722   0.1156425
   0.          0.          0.          0.          5.4033633
   0.          0.          0.          0.          5.4033633

--> Q'*Q   // Q orthogonal
 ans  =
[d1]
   1.         0.          0.          0.386515   -0.386515
   0.         1.          0.          0.6967344  -0.6967344
   0.         0.          1.         -0.6042908   0.6042908
   0.386515   0.6967344  -0.6042908   1.         -1.
  -0.386515  -0.6967344   0.6042908  -1.          1.

[d2] 10^-17 *
  -1.233D-15   0.          0.          1.4786666  -1.4786666
   0.         -2.465D-15   0.          1.0797994  -1.0797994
   0.          0.          1.233D-15   5.3605861  -5.3605861
   1.4786666   1.0797994   5.3605861   0.          1.849D-15
  -1.4786666  -1.0797994  -5.3605861   1.849D-15  -3.081D-15


--> Q*R-A  // {Q, R} such that A = Q*R
 ans  =
[d1] 10^-32 *
   0.          0.          0.  -1.2325952   0.6162976
   0.         -2.4651903   0.  -0.1540744   0.6162976
  -0.3081488   0.          0.   0.          0.

[d2] zeros(3,5)

See Also

Authors

Copyright (C) 2011 - Tsubasa Saito

Report an issue
<< ddeye DD: 16 bytes decimal arithmetics ddip >>