hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_matop_real_gen_rq (f01qj)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_matop_real_gen_rq (f01qj) finds the RQ factorization of the real m by n (mn) matrix A, so that A is reduced to upper triangular form by means of orthogonal transformations from the right.

Syntax

[a, zeta, ifail] = f01qj(a, 'm', m, 'n', n)
[a, zeta, ifail] = nag_matop_real_gen_rq(a, 'm', m, 'n', n)

Description

The m by n matrix A is factorized as
A= R 0 PT when  m<n, A=RPT when  m=n,  
where P is an n by n orthogonal matrix and R is an m by m upper triangular matrix.
P is given as a sequence of Householder transformation matrices
P=PmP2P1,  
the (m-k+1)th transformation matrix, Pk, being used to introduce zeros into the kth row of A. Pk has the form
Pk=I-ukukT,  
where
uk= wk ζk 0 zk ,  
ζk is a scalar, wk is an k-1 element vector and zk is an n-m element vector. uk is chosen to annihilate the elements in the kth row of A.
The vector uk is returned in the kth element of zeta and in the kth row of a, such that ζk is in zetak, the elements of wk are in ak1,,akk-1 and the elements of zk are in akm+1,,akn. The elements of R are returned in the upper triangular part of a.

References

Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Wilkinson J H (1965) The Algebraic Eigenvalue Problem Oxford University Press, Oxford

Parameters

Compulsory Input Parameters

1:     alda: – double array
The first dimension of the array a must be at least max1,m.
The second dimension of the array a must be at least max1,n.
The leading m by n part of the array a must contain the matrix to be factorized.

Optional Input Parameters

1:     m int64int32nag_int scalar
Default: the first dimension of the array a.
m, the number of rows of the matrix A.
When m=0 then an immediate return is effected.
Constraint: m0.
2:     n int64int32nag_int scalar
Default: the second dimension of the array a.
n, the number of columns of the matrix A.
Constraint: nm.

Output Parameters

1:     alda: – double array
The first dimension of the array a will be max1,m.
The second dimension of the array a will be max1,n.
The m by m upper triangular part of a will contain the upper triangular matrix R, and the m by m strictly lower triangular part of a and the m by n-m rectangular part of a to the right of the upper triangular part will contain details of the factorization as described in Description.
2:     zetam – double array
zetak contains the scalar ζk for the m-k+1th transformation. If Pk=I then zetak=0.0, otherwise zetak contains ζk as described in Description and ζk is always in the range 1.0,2.0.
3:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
   ifail=-1
On entry,m<0,
orn<m,
orlda<m.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
Dynamic memory allocation failed.

Accuracy

The computed factors R and P satisfy the relation
R 0 PT=A+E,  
where
Ecε A,  
ε is the machine precision (see nag_machine_precision (x02aj)), c is a modest function of m and n, and . denotes the spectral (two) norm.

Further Comments

The approximate number of floating-point operations is given by 2×m23n-m/3.
The first k rows of the orthogonal matrix PT can be obtained by calling nag_matop_real_gen_rq_formq (f01qk), which overwrites the k rows of PT on the first k rows of the array a. PT is obtained by the call:
[a, ifail] = f01qk('Separate', m, k, a, zeta);

Example

This example obtains the RQ factorization of the 3 by 5 matrix
A= 2.0 2.0 1.6 2.0 1.2 2.5 2.5 -0.4 -0.5 -0.3 2.5 2.5 2.8 0.5 -2.9 .  
function f01qj_example


fprintf('f01qj example results\n\n');

a = [2,   2,    1.6,  2,    1.2;
     2.5, 2.5, -0.4, -0.5, -0.3;
     2.5, 2.5,  2.8,  0.5, -2.9];

[RQ, zeta, ifail] = f01qj(a);

disp('RQ Factorization of A');
disp('Vector zeta');
disp(zeta');
disp('Matrix A after factorization (R in left-hand upper triangle');
disp(RQ);


f01qj example results

RQ Factorization of A
Vector zeta
    1.0092    1.2981    1.2329

Matrix A after factorization (R in left-hand upper triangle
   -3.1446   -1.0705   -2.2283    0.6333    0.7619
    0.5277   -2.8345   -2.2283   -0.1662    0.0945
    0.3766    0.3766   -5.3852    0.0753   -0.4368


PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015