BLAS++ 2024.05.31
BLAS C++ API
Loading...
Searching...
No Matches
rotmg: Generate modified (fast) Givens plane rotation

Functions

template<typename T >
void blas::rotmg (T *d1, T *d2, T *a, T b, T param[5])
 Construct modified (fast) plane rotation, H, that eliminates b, such that.
 
void blas::rotmg (float *d1, float *d2, float *a, float b, float param[5])
 
void blas::rotmg (double *d1, double *d2, double *a, double b, double param[5])
 

Detailed Description

Function Documentation

◆ rotmg()

template<typename T >
void blas::rotmg ( T *  d1,
T *  d2,
T *  a,
b,
param[5] 
)

Construct modified (fast) plane rotation, H, that eliminates b, such that.

\[ \begin{bmatrix} z \\ 0 \end{bmatrix} = H \begin{bmatrix} \sqrt{d_1} & 0 \\ 0 & \sqrt{d_2} \end{bmatrix} \begin{bmatrix} a \\ b \end{bmatrix}. \]

See also
rotm to apply the rotation.

With modified plane rotations, vectors u and v are held in factored form as

\[ \begin{bmatrix} u^T \\ v^T \end{bmatrix} = \begin{bmatrix} \sqrt{d_1} & 0 \\ 0 & \sqrt{d_2} \end{bmatrix} \begin{bmatrix} x^T \\ y^T \end{bmatrix}. \]

Application of H to vectors x and y requires 4n flops (2n mul, 2n add) instead of 6n flops (4n mul, 2n add) as in standard plane rotations.

Let param = [ flag, \(h_{11}, h_{21}, h_{12}, h_{22}\) ]. Then H has one of the following forms:

  • For flag = -1,

    \[ H = \begin{bmatrix} h_{11} & h_{12} \\ h_{21} & h_{22} \end{bmatrix} \]

  • For flag = 0,

    \[ H = \begin{bmatrix} 1 & h_{12} \\ h_{21} & 1 \end{bmatrix} \]

  • For flag = 1,

    \[ H = \begin{bmatrix} h_{11} & 1 \\ -1 & h_{22} \end{bmatrix} \]

  • For flag = -2,

    \[ H = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} \]

Generic implementation for arbitrary data types.

Parameters
[in,out]d1sqrt(d1) is scaling factor for vector x.
[in,out]d2sqrt(d2) is scaling factor for vector y.
[in,out]aOn entry, scalar a. On exit, set to z.
[in]bOn entry, scalar b.
[out]paramArray of length 5 giving parameters of modified plane rotation, as described above.

Further details

Hammarling, Sven. A note on modifications to the Givens plane rotation. IMA Journal of Applied Mathematics, 13:215-218, 1974. http://dx.doi.org/10.1093/imamat/13.2.215 (Note the notation swaps u <=> x, v <=> y, d_i -> l_i.)