NAG FL Interfacef08nuf (zunmhr)

1Purpose

f08nuf multiplies an arbitrary complex matrix $C$ by the complex unitary matrix $Q$ which was determined by f08nsf when reducing a complex general matrix to Hessenberg form.

2Specification

Fortran Interface
 Subroutine f08nuf ( side, m, n, ilo, ihi, a, lda, tau, c, ldc, work, info)
 Integer, Intent (In) :: m, n, ilo, ihi, lda, ldc, lwork Integer, Intent (Out) :: info Complex (Kind=nag_wp), Intent (In) :: tau(*) Complex (Kind=nag_wp), Intent (Inout) :: a(lda,*), c(ldc,*) Complex (Kind=nag_wp), Intent (Out) :: work(max(1,lwork)) Character (1), Intent (In) :: side, trans
#include <nag.h>
 void f08nuf_ (const char *side, const char *trans, const Integer *m, const Integer *n, const Integer *ilo, const Integer *ihi, Complex a[], const Integer *lda, const Complex tau[], Complex c[], const Integer *ldc, Complex work[], const Integer *lwork, Integer *info, const Charlen length_side, const Charlen length_trans)
The routine may be called by the names f08nuf, nagf_lapackeig_zunmhr or its LAPACK name zunmhr.

3Description

f08nuf is intended to be used following a call to f08nsf, which reduces a complex general matrix $A$ to upper Hessenberg form $H$ by a unitary similarity transformation: $A=QH{Q}^{\mathrm{H}}$. f08nsf represents the matrix $Q$ as a product of ${i}_{\mathrm{hi}}-{i}_{\mathrm{lo}}$ elementary reflectors. Here ${i}_{\mathrm{lo}}$ and ${i}_{\mathrm{hi}}$ are values determined by f08nvf when balancing the matrix; if the matrix has not been balanced, ${i}_{\mathrm{lo}}=1$ and ${i}_{\mathrm{hi}}=n$.
This routine may be used to form one of the matrix products
 $QC , QHC , CQ ​ or ​ CQH ,$
overwriting the result on $C$ (which may be any complex rectangular matrix).
A common application of this routine is to transform a matrix $V$ of eigenvectors of $H$ to the matrix $\mathit{QV}$ of eigenvectors of $A$.

4References

Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore

5Arguments

1: $\mathbf{side}$Character(1) Input
On entry: indicates how $Q$ or ${Q}^{\mathrm{H}}$ is to be applied to $C$.
${\mathbf{side}}=\text{'L'}$
$Q$ or ${Q}^{\mathrm{H}}$ is applied to $C$ from the left.
${\mathbf{side}}=\text{'R'}$
$Q$ or ${Q}^{\mathrm{H}}$ is applied to $C$ from the right.
Constraint: ${\mathbf{side}}=\text{'L'}$ or $\text{'R'}$.
2: $\mathbf{trans}$Character(1) Input
On entry: indicates whether $Q$ or ${Q}^{\mathrm{H}}$ is to be applied to $C$.
${\mathbf{trans}}=\text{'N'}$
$Q$ is applied to $C$.
${\mathbf{trans}}=\text{'C'}$
${Q}^{\mathrm{H}}$ is applied to $C$.
Constraint: ${\mathbf{trans}}=\text{'N'}$ or $\text{'C'}$.
3: $\mathbf{m}$Integer Input
On entry: $m$, the number of rows of the matrix $C$; $m$ is also the order of $Q$ if ${\mathbf{side}}=\text{'L'}$.
Constraint: ${\mathbf{m}}\ge 0$.
4: $\mathbf{n}$Integer Input
On entry: $n$, the number of columns of the matrix $C$; $n$ is also the order of $Q$ if ${\mathbf{side}}=\text{'R'}$.
Constraint: ${\mathbf{n}}\ge 0$.
5: $\mathbf{ilo}$Integer Input
6: $\mathbf{ihi}$Integer Input
On entry: these must be the same arguments ilo and ihi, respectively, as supplied to f08nsf.
Constraints:
• if ${\mathbf{side}}=\text{'L'}$ and ${\mathbf{m}}>0$, $1\le {\mathbf{ilo}}\le {\mathbf{ihi}}\le {\mathbf{m}}$;
• if ${\mathbf{side}}=\text{'L'}$ and ${\mathbf{m}}=0$, ${\mathbf{ilo}}=1$ and ${\mathbf{ihi}}=0$;
• if ${\mathbf{side}}=\text{'R'}$ and ${\mathbf{n}}>0$, $1\le {\mathbf{ilo}}\le {\mathbf{ihi}}\le {\mathbf{n}}$;
• if ${\mathbf{side}}=\text{'R'}$ and ${\mathbf{n}}=0$, ${\mathbf{ilo}}=1$ and ${\mathbf{ihi}}=0$.
7: $\mathbf{a}\left({\mathbf{lda}},*\right)$Complex (Kind=nag_wp) array Input
Note: the second dimension of the array a must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$ if ${\mathbf{side}}=\text{'L'}$ and at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$ if ${\mathbf{side}}=\text{'R'}$.
On entry: details of the vectors which define the elementary reflectors, as returned by f08nsf.
8: $\mathbf{lda}$Integer Input
On entry: the first dimension of the array a as declared in the (sub)program from which f08nuf is called.
Constraints:
• if ${\mathbf{side}}=\text{'L'}$, ${\mathbf{lda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$;
• if ${\mathbf{side}}=\text{'R'}$, ${\mathbf{lda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
9: $\mathbf{tau}\left(*\right)$Complex (Kind=nag_wp) array Input
Note: the dimension of the array tau must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}-1\right)$ if ${\mathbf{side}}=\text{'L'}$ and at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}-1\right)$ if ${\mathbf{side}}=\text{'R'}$.
On entry: further details of the elementary reflectors, as returned by f08nsf.
10: $\mathbf{c}\left({\mathbf{ldc}},*\right)$Complex (Kind=nag_wp) array Input/Output
Note: the second dimension of the array c must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: the $m$ by $n$ matrix $C$.
On exit: c is overwritten by $QC$ or ${Q}^{\mathrm{H}}C$ or $CQ$ or $C{Q}^{\mathrm{H}}$ as specified by side and trans.
11: $\mathbf{ldc}$Integer Input
On entry: the first dimension of the array c as declared in the (sub)program from which f08nuf is called.
Constraint: ${\mathbf{ldc}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$.
12: $\mathbf{work}\left(\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{lwork}}\right)\right)$Complex (Kind=nag_wp) array Workspace
On exit: if ${\mathbf{info}}={\mathbf{0}}$, the real part of ${\mathbf{work}}\left(1\right)$ contains the minimum value of lwork required for optimal performance.
13: $\mathbf{lwork}$Integer Input
On entry: the dimension of the array work as declared in the (sub)program from which f08nuf is called.
If ${\mathbf{lwork}}=-1$, a workspace query is assumed; the routine only calculates the optimal size of the work array, returns this value as the first entry of the work array, and no error message related to lwork is issued.
Suggested value: for optimal performance, ${\mathbf{lwork}}\ge {\mathbf{n}}×\mathit{nb}$ if ${\mathbf{side}}=\text{'L'}$ and at least ${\mathbf{m}}×\mathit{nb}$ if ${\mathbf{side}}=\text{'R'}$, where $\mathit{nb}$ is the optimal block size.
Constraints:
• if ${\mathbf{side}}=\text{'L'}$, ${\mathbf{lwork}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$ or ${\mathbf{lwork}}=-1$;
• if ${\mathbf{side}}=\text{'R'}$, ${\mathbf{lwork}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$ or ${\mathbf{lwork}}=-1$.
14: $\mathbf{info}$Integer Output
On exit: ${\mathbf{info}}=0$ unless the routine detects an error (see Section 6).

6Error Indicators and Warnings

${\mathbf{info}}<0$
If ${\mathbf{info}}=-i$, argument $i$ had an illegal value. An explanatory message is output, and execution of the program is terminated.

7Accuracy

The computed result differs from the exact result by a matrix $E$ such that
 $E2 = Oε C2 ,$
where $\epsilon$ is the machine precision.

8Parallelism and Performance

f08nuf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
f08nuf 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.

The total number of real floating-point operations is approximately $8n{q}^{2}$ if ${\mathbf{side}}=\text{'L'}$ and $8m{q}^{2}$ if ${\mathbf{side}}=\text{'R'}$, where $q={i}_{\mathrm{hi}}-{i}_{\mathrm{lo}}$.
The real analogue of this routine is f08ngf.

10Example

This example computes all the eigenvalues of the matrix $A$, where
 $A = -3.97-5.04i -4.11+3.70i -0.34+1.01i 1.29-0.86i 0.34-1.50i 1.52-0.43i 1.88-5.38i 3.36+0.65i 3.31-3.85i 2.50+3.45i 0.88-1.08i 0.64-1.48i -1.10+0.82i 1.81-1.59i 3.25+1.33i 1.57-3.44i ,$
and those eigenvectors which correspond to eigenvalues $\lambda$ such that $\mathrm{Re}\left(\lambda \right)<0$. Here $A$ is general and must first be reduced to upper Hessenberg form $H$ by f08nsf. The program then calls f08psf to compute the eigenvalues, and f08pxf to compute the required eigenvectors of $H$ by inverse iteration. Finally f08nuf is called to transform the eigenvectors of $H$ back to eigenvectors of the original matrix $A$.

10.1Program Text

Program Text (f08nufe.f90)

10.2Program Data

Program Data (f08nufe.d)

10.3Program Results

Program Results (f08nufe.r)