Givens row-pair update (source code)

= Givens row-pair update
{c}
{title2=$x'=cx+sy,\quad y'=-sx+cy$}

Left <matrix multiplication> by a <Givens rotation> replaces rows $i,j$ of a <matrix> by
$$
A'_{ik}=cA_{ik}+sA_{jk},\qquad
A'_{jk}=-sA_{ik}+cA_{jk}.
$$
Both right-hand sides use the old entries. An in-place <algorithm> must save the first result temporarily, update the second entry, and only then overwrite the first. The reference BLAS `DROT` implementation follows this order with its temporary `DTEMP`.<DROT (Reference BLAS, LAPACK 3.12.1) by LAPACK project>[DROT source, lines 116–120 and 130–134: temporary first-row value and second-row update]{ref}

For elimination in column $k$, construct $(c,s)$ from $(A_{ik},A_{jk})$. This sets the lower component to zero in exact arithmetic. In <floating-point arithmetic> the computed expression can leave a small remainder; after computing the other updated entries, explicitly store $A'_{jk}=0$ and $A'_{ik}=r$. Previously eliminated columns stay zero if both participating rows are already zero there. This is why the ordering in <QR decomposition by Givens rotations> matters.