F06 Chapter Contents
F06 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF06QPF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

F06QPF performs a $QR$ factorization (as a sequence of plane rotations) of a real upper triangular matrix that has been modified by a rank-1 update.

## 2  Specification

 SUBROUTINE F06QPF ( N, ALPHA, X, INCX, Y, INCY, A, LDA, C, S)
 INTEGER N, INCX, INCY, LDA REAL (KIND=nag_wp) ALPHA, X(*), Y(*), A(LDA,*), C(N-1), S(N-1)

## 3  Description

F06QPF performs a $QR$ factorization of an upper triangular matrix which has been modified by a rank-1 update:
 $αxyT + U=QR$
where $U$ and $R$ are $n$ by $n$ real upper triangular matrices, $x$ and $y$ are $n$-element real vectors, $\alpha$ is a real scalar, and $Q$ is an $n$ by $n$ real orthogonal matrix.
$Q$ is formed as the product of two sequences of plane rotations:
 $QT = Qn-1 ⋯ Q2 Q1 P1 P2 ⋯ Pn-1$
where
• ${P}_{k}$ is a rotation in the $\left(k,n\right)$ plane, chosen to annihilate ${x}_{k}$: thus $Px=\beta {e}_{n}$, where $P={P}_{1}{P}_{2}\cdots {P}_{n-1}$ and ${e}_{n}$ is the last column of the unit matrix;
• ${Q}_{k}$ is a rotation in the $\left(k,n\right)$ plane, chosen to annihilate the $\left(n,k\right)$ element of $\left(\alpha \beta {e}_{n}{y}^{\mathrm{T}}+PU\right)$, and thus restore it to upper triangular form.
The $2$ by $2$ plane rotation part of ${P}_{k}$ or ${Q}_{k}$ has the form
 $ck sk -sk ck .$
The tangents of the rotations ${P}_{k}$ are returned in the array X; the cosines and sines of these rotations can be recovered by calling F06BCF. The cosines and sines of the rotations ${Q}_{k}$ are returned directly in the arrays C and S.

None.

## 5  Parameters

1:     N – INTEGERInput
On entry: $n$, the order of the matrices $U$ and $R$.
Constraint: ${\mathbf{N}}\ge 0$.
2:     ALPHA – REAL (KIND=nag_wp)Input
On entry: the scalar $\alpha$.
3:     X($*$) – REAL (KIND=nag_wp) arrayInput/Output
Note: the dimension of the array X must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,1+\left({\mathbf{N}}-1\right)×{\mathbf{INCX}}\right)$.
On entry: the $n$-element vector $x$. ${x}_{\mathit{i}}$ must be stored in ${\mathbf{X}}\left(1+\left(\mathit{i}-1\right)×{\mathbf{INCX}}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{N}}$.
Intermediate elements of X are not referenced.
On exit: the referenced elements are overwritten by details of the sequence of plane rotations.
4:     INCX – INTEGERInput
On entry: the increment in the subscripts of X between successive elements of $x$.
Constraint: ${\mathbf{INCX}}>0$.
5:     Y($*$) – REAL (KIND=nag_wp) arrayInput
Note: the dimension of the array Y must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,1+\left({\mathbf{N}}-1\right)×{\mathbf{INCY}}\right)$.
On entry: the $n$-element vector $y$. ${y}_{\mathit{i}}$ must be stored in ${\mathbf{Y}}\left(1+\left(\mathit{i}-1\right)×{\mathbf{INCY}}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{N}}$.
Intermediate elements of Y are not referenced.
6:     INCY – INTEGERInput
On entry: the increment in the subscripts of Y between successive elements of $y$.
Constraint: ${\mathbf{INCY}}>0$.
7:     A(LDA,$*$) – REAL (KIND=nag_wp) arrayInput/Output
Note: the second dimension of the array A must be at least ${\mathbf{N}}$.
On entry: the $n$ by $n$ upper triangular matrix $U$.
On exit: the upper triangular matrix $R$.
8:     LDA – INTEGERInput
On entry: the first dimension of the array A as declared in the (sub)program from which F06QPF is called.
Constraint: ${\mathbf{LDA}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
9:     C(${\mathbf{N}}-1$) – REAL (KIND=nag_wp) arrayOutput
On exit: the cosines of the rotations ${Q}_{\mathit{k}}$, for $\mathit{k}=1,2,\dots ,n-1$.
10:   S(${\mathbf{N}}-1$) – REAL (KIND=nag_wp) arrayOutput
On exit: the sines of the rotations ${Q}_{\mathit{k}}$, for $\mathit{k}=1,2,\dots ,n-1$.

None.

Not applicable.