# NAG Library Routine Document

## 1Purpose

f06wcf (dsfrk) performs one of the symmetric rank-$k$ update operations
 $C←αAAT + βC or C←αATA + βC ,$
where $A$ is a real matrix, $C$ is an $n$ by $n$ real symmetric matrix stored in Rectangular Full Packed (RFP) format, and $\alpha$ and $\beta$ are real scalars.

## 2Specification

Fortran Interface
 Subroutine f06wcf ( uplo, n, k, a, lda, beta, c)
 Integer, Intent (In) :: n, k, lda Real (Kind=nag_wp), Intent (In) :: alpha, a(lda,*), beta Real (Kind=nag_wp), Intent (Inout) :: c(n*(n+1)/2) Character (1), Intent (In) :: transr, uplo, trans
#include nagmk26.h
 void f06wcf_ ( const char *transr, const char *uplo, const char *trans, const Integer *n, const Integer *k, const double *alpha, const double a[], const Integer *lda, const double *beta, double c[], const Charlen length_transr, const Charlen length_uplo, const Charlen length_trans)
The routine may be called by its LAPACK name dsfrk.

## 3Description

f06wcf (dsfrk) performs one of the symmetric rank-$k$ update operations
 $C←αAAT + βC or C←αATA + βC ,$
where $A$ is a real matrix, $C$ is an $n$ by $n$ real symmetric matrix stored in Rectangular Full Packed (RFP) format, and $\alpha$ and $\beta$ are real scalars. The RFP storage format is described in Section 3.3.3 in the F07 Chapter Introduction.
If $n=0$ or if $\beta =1.0$ and either $k=0$ or $\alpha =0.0$ then f06wcf (dsfrk) returns immediately. If $\beta =0.0$ and either $k=0$ or $\alpha =0.0$ then $C$ is set to the zero matrix.

## 4References

Gustavson F G, Waśniewski J, Dongarra J J and Langou J (2010) Rectangular full packed format for Cholesky's algorithm: factorization, solution, and inversion ACM Trans. Math. Software 37, 2

## 5Arguments

1:     $\mathbf{transr}$ – Character(1)Input
On entry: specifies whether the RFP representation of $C$ is normal or transposed.
${\mathbf{transr}}=\text{'N'}$
The matrix $C$ is stored in normal RFP format.
${\mathbf{transr}}=\text{'T'}$
The matrix $C$ is stored in transposed RFP format.
Constraint: ${\mathbf{transr}}=\text{'N'}$ or $\text{'T'}$.
2:     $\mathbf{uplo}$ – Character(1)Input
On entry: specifies whether the upper or lower triangular part of $C$ is stored in RFP format.
${\mathbf{uplo}}=\text{'U'}$
The upper triangular part of $C$ is stored in RFP format.
${\mathbf{uplo}}=\text{'L'}$
The lower triangular part of $C$ is stored in RFP format.
Constraint: ${\mathbf{uplo}}=\text{'U'}$ or $\text{'L'}$.
3:     $\mathbf{trans}$ – Character(1)Input
On entry: specifies the operation to be performed.
${\mathbf{trans}}=\text{'N'}$
$C←\alpha A{A}^{\mathrm{T}}+\beta C$.
${\mathbf{trans}}=\text{'T'}$
$C←\alpha {A}^{\mathrm{T}}A+\beta C$.
Constraint: ${\mathbf{trans}}=\text{'N'}$ or $\text{'T'}$.
4:     $\mathbf{n}$ – IntegerInput
On entry: $n$, the order of the matrix $C$.
Constraint: ${\mathbf{n}}\ge 0$.
5:     $\mathbf{k}$ – IntegerInput
On entry: $k$, the number of columns of $A$ if ${\mathbf{trans}}=\text{'N'}$, or the number of rows of $A$ if ${\mathbf{trans}}=\text{'T'}$.
Constraint: ${\mathbf{k}}\ge 0$.
6:     $\mathbf{alpha}$ – Real (Kind=nag_wp)Input
On entry: the scalar $\alpha$.
7:     $\mathbf{a}\left({\mathbf{lda}},*\right)$ – Real (Kind=nag_wp) arrayInput
Note: the second dimension of the array a must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$ if ${\mathbf{trans}}=\text{'N'}$ and at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$ if ${\mathbf{trans}}=\text{'T'}$.
On entry: the matrix $A$; $A$ is $n$ by $k$ if ${\mathbf{trans}}=\text{'N'}$, or $k$ by $n$ if ${\mathbf{trans}}=\text{'T'}$. If ${\mathbf{alpha}}=0.0$, a is not referenced.
8:     $\mathbf{lda}$ – IntegerInput
On entry: the first dimension of the array a as declared in the (sub)program from which f06wcf (dsfrk) is called.
Constraints:
• if ${\mathbf{trans}}=\text{'N'}$, ${\mathbf{lda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• if ${\mathbf{trans}}=\text{'T'}$, ${\mathbf{lda}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$.
9:     $\mathbf{beta}$ – Real (Kind=nag_wp)Input
On entry: the scalar $\beta$.
10:   $\mathbf{c}\left({\mathbf{n}}×\left({\mathbf{n}}+1\right)/2\right)$ – Real (Kind=nag_wp) arrayInput/Output
On entry: the upper or lower triangular part (as specified by uplo) of the $n$ by $n$ symmetric matrix $C$, stored in RFP format (as specified by transr). The storage format is described in detail in Section 3.3.3 in the F07 Chapter Introduction.
On exit: the updated matrix $C$, that is its upper or lower triangular part stored in RFP format.

None.

Not applicable.

## 8Parallelism and Performance

f06wcf (dsfrk) 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.

None.

## 10Example

This example reads in the lower triangular part of a symmetric matrix $C$ which it converts to RFP format. It also reads in $\alpha$, $\beta$ and a $6$ by $4$ matrix $A$ and then performs the symmetric rank-$4$ update $C←\alpha A{A}^{\mathrm{T}}+\beta C$.

### 10.1Program Text

Program Text (f06wcfe.f90)

### 10.2Program Data

Program Data (f06wcfe.d)

### 10.3Program Results

Program Results (f06wcfe.r)

© The Numerical Algorithms Group Ltd, Oxford, UK. 2017