## MB04PY

### Applying an elementary reflector (using in-line code for a low order) to a matrix, from either the left or the right

[Specification] [Arguments] [Method] [References] [Comments] [Example]

Purpose

      To apply a real elementary reflector H to a real m-by-n matrix
      C, from either the left or the right. H is represented in the form
                                         ( 1 )
            H = I - tau * u *u',    u  = (   ),
                                         ( v )
      where tau is a real scalar and v is a real vector.

      If tau = 0, then H is taken to be the unit matrix.

      In-line code is used if H has order < 11.

Specification

          SUBROUTINE MB04PY( SIDE, M, N, V, TAU, C, LDC, DWORK )
    C     .. Scalar Arguments ..
          CHARACTER          SIDE
          INTEGER            LDC, M, N
          DOUBLE PRECISION   TAU
    C     .. Array Arguments ..
          DOUBLE PRECISION   C( LDC, * ), DWORK( * ), V( * )

Arguments

Mode Parameters

      SIDE    CHARACTER*1
              Indicates whether the elementary reflector should be
              applied from the left or from the right, as follows:
              = 'L':  Compute H * C;
              = 'R':  Compute C * H.

Input/Output Parameters

      M       (input) INTEGER
              The number of rows of the matrix C.  M >= 0.

      N       (input) INTEGER
              The number of columns of the matrix C.  N >= 0.

      V       (input) DOUBLE PRECISION array, dimension
              (M-1), if SIDE = 'L', or
              (N-1), if SIDE = 'R'.
              The vector v in the representation of H.

      TAU     (input) DOUBLE PRECISION
              The scalar factor of the elementary reflector H.

      C       (input/output) DOUBLE PRECISION array, dimension (LDC,N)
              On entry, the leading M-by-N part of this array must
              contain the matrix C.
              On exit, the leading M-by-N part of this array contains
              the matrix H * C, if SIDE = 'L', or C * H, if SIDE = 'R'.

      LDC     INTEGER
              The leading dimension of array C.  LDC >= MAX(1,M).

Workspace

      DWORK   DOUBLE PRECISION array, dimension (N), if SIDE = 'L', or
                                                (M), if SIDE = 'R'.
              DWORK is not referenced if H has order less than 11.

Method

      The routine applies the elementary reflector H, taking its special
      structure into account. The multiplications by the first component
      of u (which is 1) are avoided, to increase the efficiency.

Numerical Aspects

      The algorithm is backward stable.

Further Comments

      None

Example

Program Text

      None

Program Data

      None

Program Results

      None

Return to Supporting Routines index