# NAG FL Interfacef06tsf (zusqr)

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

f06tsf performs a $QR$ or $RQ$ factorization (as a sequence of plane rotations) of a complex upper spiked matrix.

## 2Specification

Fortran Interface
 Subroutine f06tsf ( side, n, k1, k2, c, s, a, lda)
 Integer, Intent (In) :: n, k1, k2, lda Real (Kind=nag_wp), Intent (Out) :: c(k2-1) Complex (Kind=nag_wp), Intent (Inout) :: s(*), a(lda,*) Character (1), Intent (In) :: side
#include <nag.h>
 void f06tsf_ (const char *side, const Integer *n, const Integer *k1, const Integer *k2, double c[], Complex s[], Complex a[], const Integer *lda, const Charlen length_side)
The routine may be called by the names f06tsf or nagf_blas_zusqr.

## 3Description

f06tsf transforms an $n×n$ complex upper spiked matrix $H$ to upper triangular form $R$ by applying a complex unitary matrix $P$ from the left or the right. $H$ is assumed to have real diagonal elements except where the spike joins the diagonal; $R$ has real diagonal elements. $P$ is formed as a sequence of plane rotations in planes ${k}_{1}$ to ${k}_{2}$.
If ${\mathbf{side}}=\text{'L'}$, $H$ is assumed to have a row spike, with nonzero elements ${h}_{{\mathit{k}}_{2},\mathit{k}}$, for $\mathit{k}={\mathit{k}}_{1},\dots ,{\mathit{k}}_{2}-1$. The rotations are applied from the left:
 $PH=R ,$
where $P=D{P}_{{k}_{2}-1}\cdots {P}_{{k}_{1}+1}{P}_{{k}_{1}}$, ${P}_{k}$ is a rotation in the $\left(k,{k}_{2}\right)$ plane and $D=\mathrm{diag}\left(1,\dots ,1,{d}_{{k}_{2}},1,\dots ,1\right)$ with $|{d}_{{k}_{2}}|=1$.
If ${\mathbf{side}}=\text{'R'}$, $H$ is assumed to have a column spike, with nonzero elements ${h}_{\mathit{k}+1,{\mathit{k}}_{1}}$, for $\mathit{k}={\mathit{k}}_{1},\dots ,{\mathit{k}}_{2}-1$. The rotations are applied from the right:
 $HPH=R ,$
where $P=D{P}_{{k}_{1}}{P}_{{k}_{1}+1}\cdots {P}_{{k}_{2}-1}$, ${P}_{k}$ is a rotation in the $\left({k}_{1},k+1\right)$ plane and $D=\mathrm{diag}\left(1,\dots ,1,{d}_{{k}_{1}},1,\dots ,1\right)$ with $|{d}_{{k}_{1}}|=1$.
The $2×2$ plane rotation part of ${P}_{k}$ has the form
 $( ck s¯k -sk ck )$
with ${c}_{k}$ real.

None.

## 5Arguments

1: $\mathbf{side}$Character(1) Input
On entry: specifies whether $H$ is operated on from the left or the right.
${\mathbf{side}}=\text{'L'}$
$H$ is pre-multiplied from the left.
${\mathbf{side}}=\text{'R'}$
$H$ is post-multiplied from the right.
Constraint: ${\mathbf{side}}=\text{'L'}$ or $\text{'R'}$.
2: $\mathbf{n}$Integer Input
On entry: $n$, the order of the matrix $H$.
Constraint: ${\mathbf{n}}\ge 0$.
3: $\mathbf{k1}$Integer Input
4: $\mathbf{k2}$Integer Input
On entry: the values ${k}_{1}$ and ${k}_{2}$.
If ${\mathbf{k1}}<1$ or ${\mathbf{k2}}\le {\mathbf{k1}}$ or ${\mathbf{k2}}>{\mathbf{n}}$, an immediate return is effected.
5: $\mathbf{c}\left({\mathbf{k2}}-1\right)$Real (Kind=nag_wp) array Output
On exit: ${\mathbf{c}}\left(\mathit{k}\right)$ holds ${c}_{\mathit{k}}$, the cosine of the rotation ${P}_{\mathit{k}}$, for $\mathit{k}={\mathit{k}}_{1},\dots ,{\mathit{k}}_{2}-1$.
6: $\mathbf{s}\left(*\right)$Complex (Kind=nag_wp) array Input/Output
Note: the dimension of the array s must be at least ${\mathbf{k2}}$.
On entry: the nonzero elements of the spike of $H$: ${\mathbf{s}}\left(\mathit{k}\right)$ must hold ${h}_{{\mathit{k}}_{2},\mathit{k}}$ if ${\mathbf{side}}=\text{'L'}$, and ${h}_{\mathit{k}+1,{\mathit{k}}_{1}}$ if ${\mathbf{side}}=\text{'R'}$, for $\mathit{k}={\mathit{k}}_{1},\dots ,{\mathit{k}}_{2}-1$.
On exit: ${\mathbf{s}}\left(\mathit{k}\right)$ holds ${s}_{\mathit{k}}$, the sine of the rotation ${P}_{\mathit{k}}$, for $\mathit{k}={\mathit{k}}_{1},\dots ,{\mathit{k}}_{2}-1$; ${\mathbf{s}}\left({\mathit{k}}_{2}\right)$ holds ${d}_{{k}_{2}}$, the ${k}_{2}$th diagonal element of $D$, if ${\mathbf{side}}=\text{'L'}$, or ${d}_{{k}_{1}}$, the ${k}_{1}$th diagonal element of $D$, if ${\mathbf{side}}=\text{'R'}$.
7: $\mathbf{a}\left({\mathbf{lda}},*\right)$Complex (Kind=nag_wp) array Input/Output
Note: the second dimension of the array a must be at least ${\mathbf{n}}$.
On entry: the upper triangular part of the $n×n$ upper spiked matrix $H$. The imaginary parts of the diagonal elements must be zero, except for the $\left({k}_{2},{k}_{2}\right)$ element if ${\mathbf{side}}=\text{'L'}$, or the $\left({k}_{1},{k}_{1}\right)$ element if ${\mathbf{side}}=\text{'R'}$.
On exit: the upper triangular matrix $R$. The imaginary parts of the diagonal elements are set to zero.
8: $\mathbf{lda}$Integer Input
On entry: the first dimension of the array a as declared in the (sub)program from which f06tsf is called.
Constraint: ${\mathbf{lda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.

None.

Not applicable.

## 8Parallelism and Performance

f06tsf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.