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_formq (f01qk)

Purpose

nag_matop_real_gen_rq_formq (f01qk) returns the first  rows of the real nn by nn orthogonal matrix PTPT, where PP is given as the product of Householder transformation matrices.
This function is intended for use following nag_matop_real_gen_rq (f01qj).

Syntax

[a, ifail] = f01qk(wheret, m, nrowp, a, zeta, 'n', n)
[a, ifail] = nag_matop_real_gen_rq_formq(wheret, m, nrowp, a, zeta, 'n', n)

Description

PP is assumed to be given by
P = PmPm1P1
P=PmPm-1P1
where
Pk = I - uk ukT , uk= wk ζk 0 zk ,
Pk = I − uk ukT ,
uk = ( wk ζk 0 zk ),
ζkζk is a scalar, wkwk is a (k1k-1) element vector and zkzk is an (nmn-m) element vector. wkwk must be supplied in the kkth row of a in elements a(k,1),,a(k,k1)ak1,,akk-1. zkzk must be supplied in the kkth row of a in elements a(k,m + 1),,a(k,n)akm+1,,akn and ζkζk must be supplied either in a(k,k)akk or in zeta(k)zetak, depending upon the parameter wheret.

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:     wheret – string (length ≥ 1)
Indicates where the elements of ζζ are to be found.
wheret = 'I'wheret='I' (In a)
The elements of ζζ are in a.
wheret = 'S'wheret='S' (Separate)
The elements of ζζ are separate from a, in zeta.
Constraint: wheret = 'I'wheret='I' or 'S''S'.
2:     m – int64int32nag_int scalar
mm, the number of rows of the matrix AA.
Constraint: m0m0.
3:     nrowp – int64int32nag_int scalar
, the required number of rows of PP.
If nrowp = 0nrowp=0, an immediate return is effected.
Constraint: 0nrowpn0nrowpn.
4:     a(lda, : :) – double array
The first dimension of the array a must be at least max (1,m,nrowp)max(1,m,nrowp)
The second dimension of the array must be at least max (1,n)max(1,n)
The leading mm by mm strictly lower triangular part of the array a, and the mm by (nmn-m) rectangular part of a with top left-hand corner at element a(1,m + 1)a1m+1 must contain details of the matrix PP. In addition, when wheret = 'I'wheret='I', then the diagonal elements of a must contain the elements of ζζ.
5:     zeta( : :) – double array
Note: the dimension of the array zeta must be at least max (1,m)max(1,m) if wheret = 'S'wheret='S', and at least 11 otherwise.
With wheret = 'S'wheret='S', the array zeta must contain the elements of ζζ. If zeta(k) = 0.0zetak=0.0 then PkPk is assumed to be II, otherwise zeta(k)zetak is assumed to contain ζkζk.
When wheret = 'I'wheret='I', the array zeta is not referenced.

Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The second dimension of the array a.
nn, the number of columns of the matrix AA.
Constraint: nmnm.

Input Parameters Omitted from the MATLAB Interface

lda work

Output Parameters

1:     a(lda, : :) – double array
The first dimension of the array a will be max (1,m,nrowp)max(1,m,nrowp)
The second dimension of the array will be max (1,n)max(1,n)
ldamax (1,m,nrowp)ldamax(1,m,nrowp).
The first nrowp rows of the array a store the first nrowp rows of the nn by nn orthogonal matrix PTPT.
2:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=-1
On entry,wheret'I'wheret'I' or 'S''S',
orm < 0m<0,
orn < mn<m,
ornrowp < 0nrowp<0 or nrowp > nnrowp>n,
orlda < max (m,nrowp)lda<max(m,nrowp).

Accuracy

The computed matrix PP satisfies the relation
P = Q + E,
P=Q+E,
where QQ is an exactly orthogonal matrix and
Ecε,
Ecε,
εε is the machine precision (see nag_machine_precision (x02aj)), cc is a modest function of nn, and . . denotes the spectral (two) norm. See also Section [Accuracy] in (f01qj).

Further Comments

The approximate number of floating point operations is given by
(2/3)m{(3nm)(2m)m(m)}, if ​m, and ​
(2/3)2(3n), if ​ < m.
23m{(3n-m)(2-m)-m(-m)}, if ​m, and ​ 232(3n-), if ​<m.

Example

function nag_matop_real_gen_rq_formq_example
wheret = 'Separate';
m = int64(3);
nrowp = int64(5);
a = [-3.144584553986008, -1.070546935661071, -2.228344058124622, 0.6332849259420066, 0.7619486847328875;
     0.5276878374877219, -2.834516318284424, -2.228344058124622, -0.1662468409100804, 0.0945215703740671;
     0.3765535922552591, 0.3765535922552591, -5.385164807134504, 0.07531071845105182, -0.4368021670161005;
     0, 0, 0, 0, 0;
     0, 0, 0, 0, 0];
zeta = [1.009150337862724;
     1.298065178174413;
     1.232861284531129];
[aOut, ifail] = nag_matop_real_gen_rq_formq(wheret, m, nrowp, a, zeta)
 

aOut =

   -0.1310   -0.1310   -0.3276   -0.6551   -0.6551
   -0.5170   -0.5170    0.5499    0.2494   -0.3175
   -0.4642   -0.4642   -0.5199   -0.0928    0.5385
   -0.5054    0.5054   -0.3957    0.4946   -0.2967
   -0.4946    0.4946    0.4043   -0.5054    0.3032


ifail =

                    0


function f01qk_example
wheret = 'Separate';
m = int64(3);
nrowp = int64(5);
a = [-3.144584553986008, -1.070546935661071, -2.228344058124622, ...
      0.6332849259420066, 0.7619486847328875;
     0.5276878374877219, -2.834516318284424, -2.228344058124622, ...
    -0.1662468409100804, 0.0945215703740671;
     0.3765535922552591, 0.3765535922552591, -5.385164807134504, ...
     0.07531071845105182, -0.4368021670161005;
     0, 0, 0, 0, 0;
     0, 0, 0, 0, 0];
zeta = [1.009150337862724;
     1.298065178174413;
     1.232861284531129];
[aOut, ifail] = f01qk(wheret, m, nrowp, a, zeta)
 

aOut =

   -0.1310   -0.1310   -0.3276   -0.6551   -0.6551
   -0.5170   -0.5170    0.5499    0.2494   -0.3175
   -0.4642   -0.4642   -0.5199   -0.0928    0.5385
   -0.5054    0.5054   -0.3957    0.4946   -0.2967
   -0.4946    0.4946    0.4043   -0.5054    0.3032


ifail =

                    0



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–2013