Module_Hous_Procedures

Copyright 2024 IRD

This file is part of statpack.

statpack is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

statpack is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You can find a copy of the GNU Lesser General Public License in the statpack/doc directory.

Authors: Pascal Terray (LOCEAN/IPSL, Paris, France)


MODULE EXPORTING HOUSEHOLDER REFLECTIONS.

LATEST REVISION : 11/03/2024


subroutine hous1 ( u, tau )

Purpose

HOUS1 generates a real elementary reflector H of order n, such that

H * X = D , with H’ * H = I and D’ = ( beta 0 )

where beta is scalar and X is an n-element real vector.

H is represented in the form

H = I + tau * ( v * v’ ) ,

where tau is a real scalar and v is an n-element real vector with v(1) = 1.

If the elements of X(2:n) are all zero or size(X)=1, then tau = 0 and H is taken to be the unit matrix.

Otherwise 1 <= tau <= 2.

Arguments

U (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, the vector X.

On exit, it is overwritten with the vector [beta v(2:n) ].

TAU (OUTPUT) real(stnd)
On exit, the value tau.

Further Details

This subroutine is based on the routine DLARFG in LAPACK77 (version 3) with improvements suggested in references (1), (2) and (3).

For more details, see:

  1. Anderson, E., and Fahey, M., 1997:
    Performance improvements to LAPACK for the Cray Scientific Library. LAPACK Working Note No 126.
  2. Anderson, E., 2018:
    Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
  3. Hanson, R.J., and Hopkins, T., 2018:
    Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.

subroutine hous1 ( u, tau, beta )

Purpose

HOUS1 generates a real elementary reflector H of order n, such that

H * X = D , with H’ * H = I and D’ = ( beta 0 )

where beta is scalar and X is an n-element real vector.

H is represented in the form

H = I + tau * ( v * v’ ) ,

where tau is a real scalar and v is an n-element real vector with v(1) = 1.

If the elements of X(2:n) are all zero or size(X)=1, then tau = 0 and H is taken to be the unit matrix.

Otherwise 1 <= tau <= 2.

Arguments

U (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, the vector x.

On exit, it is overwritten with the vector [ 1 v(2:n) ].

TAU (OUTPUT) real(stnd)
On exit, the value tau.
BETA (OUTPUT) real(stnd)
On exit, the value beta.

Further Details

This subroutine is based on the routine DLARFG in LAPACK77 (version 3) with improvements suggested in references (1), (2) and (3).

For more details, see:

  1. Anderson, E., and Fahey, M., 1997:
    Performance improvements to LAPACK for the Cray Scientific Library. LAPACK Working Note No 126.
  2. Anderson, E., 2018:
    Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
  3. Hanson, R.J., and Hopkins, T., 2018:
    Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.

subroutine hous2 ( pivot, u, tau )

Purpose

HOUS2 generates a real elementary reflector H of order n, such that

H * X = D , with H’ * H = I , X’ = ( alpha x ) and D’ = ( beta 0 )

where alpha and beta are scalars, and x is an (n-1)-element real vector.

H is represented in the form

H = I + tau * ( v * v’ ) ,

where tau is a real scalar and v is an n-element real vector with v(1) = 1.

If the elements of x are all zero, then tau = 0 and H is taken to be the unit matrix.

Otherwise 1 <= tau <= 2.

Arguments

PIVOT (INPUT/OUTPUT) real(stnd)
On entry, the value alpha. On exit, it is overwritten with the value beta.
U (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, the (n-1)-element vector x.

On exit, it is overwritten with the vector v(2:n) .

TAU (OUTPUT) real(stnd)
On exit, the value tau.

Further Details

This subroutine is based on the routine DLARFG in LAPACK77 (version 3) with improvements suggested in references (1), (2) and (3).

For more details, see:

  1. Anderson, E., and Fahey, M., 1997:
    Performance improvements to LAPACK for the Cray Scientific Library. LAPACK Working Note No 126.
  2. Anderson, E., 2018:
    Algorithm 978: Safe scaling in the level 1 BLAS ACM Trans. Math. Soft., Vol. 44, No 1, Article 12, 1-28.
  3. Hanson, R.J., and Hopkins, T., 2018:
    Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24, 1-23.

subroutine apply_hous1 ( u, tau, vec )

Purpose

APPLY_HOUS1 applies a real elementary reflector H generated by HOUS1 to a real vector C. H is represented in the form

H = I + tau * ( v * v’ ) ,

where tau is a real scalar and v is an n-element real vector with v(1) = 1.

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

Arguments

U (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, U(2:) contains the vector v(2:) in the representation of H as output by HOUS1. U is not used if tau = 0.

U is restored on exit.

TAU (INPUT) real(stnd)
The value tau in the representation of H as output by HOUS1.
VEC (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, the real vector C.

On exit, C is overwritten by the vector H * C

Further Details

It is assumed that size( VEC )>=size( U ) .

subroutine apply_hous1 ( u, tau, mat, left )

Purpose

APPLY_HOUS1 applies a real elementary reflector H generated by HOUS1 to a real n-by-m or m-by-n matrix, C, from the left or the right. H is represented in the form

H = I + tau * ( v * v’ ) ,

where tau is a real scalar and v is an n-element real vector with v(1) = 1.

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

Arguments

U (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, U(2:) contains the vector v(2:) in the representation of H as output by HOUS1. U is not used if tau = 0.

U is restored on exit.

TAU (INPUT) real(stnd)
The value tau in the representation of H as output by HOUS1.
MAT (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, the n-by-m or m-by-n matrix C.

On exit, C is overwritten by the matrix H * C (LEFT=true) or C * H (LEFT=false).

LEFT (INPUT) logical(lgl)

If:

  • LEFT=true, H is applied to the real matrix C from the left;
  • LEFT=false, H is applied to the real matrix C from the right.

Further Details

It is assumed that:

  • size( MAT, 1 ) >= size( U ) if LEFT=true;
  • size( MAT, 2 ) >= size( U ) if LEFT=false.

subroutine apply_hous2 ( u, tau, piv, vec )

Purpose

APPLY_HOUS2 applies a real n-by-n elementary reflector H generated by HOUS2 to a real vector C. H is represented in the form

H = I + tau * ( v * v’ ) ,

where tau is a real scalar and v is an n-element real vector with v(1) = 1.

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

Arguments

U (INPUT) real(stnd), dimension(:)
On entry, U contains the vector v(2:n) in the representation of H as output by HOUS2. U is not used if tau = 0.
TAU (INPUT) real(stnd)
The value tau in the representation of H as output by HOUS2.
PIV (INPUT/OUTPUT) real(stnd)

On entry, the scalar C[1].

On exit, PIV is overwritten by the scalar (H * C)[1].

VEC (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, the real vector C[2:].

On exit, C is overwritten by the vector (H * C)[2:].

Further Details

It is assumed that size( VEC ) >= size( U ).

subroutine apply_hous2 ( u, tau, vec_piv, mat, left )

Purpose

APPLY_HOUS2 applies a real n-by-n elementary reflector H generated by HOUS2 to a real n-by-m or m-by-n matrix, C, from the left or the right. H is represented in the form

H = I + tau * ( v * v’ ) ,

where tau is a real scalar and v is an n-element real vector with v(1) = 1.

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

Arguments

U (INPUT) real(stnd), dimension(:)
On entry, U contains the vector v(2:n) in the representation of H as output by HOUS2. U is not used if tau = 0.
TAU (INPUT) real(stnd)
The value tau in the representation of H as output by HOUS2.
VEC_PIV (INPUT/OUTPUT) real(stnd), dimension(:)

If LEFT=true:

  • On entry, the row_vector C[1,:];
  • On exit, VEC_PIV is overwritten by the vector (H * C)[1,:].

If LEFT=false:

  • On entry, the column_vector C[:,1];
  • On exit, VEC_PIV is overwritten by the vector (C * H)[:,1].
MAT (INPUT/OUTPUT) real(stnd), dimension(:,:)

If LEFT=true:

  • On entry, the (n-1)-by-m matrix C[2:,:];
  • On exit, MAT is overwritten by the matrix (H * C)[2:,:].

If LEFT=false:

  • On entry, the m-by-(n-1) matrix C[:,2:];
  • On exit, MAT is overwritten by the matrix (C * H)[:,2:].
LEFT (INPUT) logical(lgl)

If:

  • LEFT=true, H is applied to the real matrix C from the left;
  • LEFT=false, H is applied to the real matrix C from the right.

Further Details

It is assumed that:

  • size( MAT, 1 ) >= size( U ) and size( MAT, 2 ) >= size( VEC_PIV ) if LEFT=true;
  • size( MAT, 2 ) >= size( U ) and size( MAT, 1 ) >= size( VEC_PIV ) if LEFT=false.

subroutine h1 ( u, beta, tau )

Purpose

H1 generates a real elementary reflector H of order n, such that

H * X = D , with H’ * H = I and D’ = ( beta 0 )

where beta is scalar and X is an n-element real vector.

H is represented in the form

H = I + tau * ( v * v’ ) ,

where tau is a real scalar and v is a real n-element vector.

Arguments

U (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, U contains the pivot vector X.

On exit, U contains the vector v of the Householder reflector.

BETA (OUTPUT) real(stnd)
On exit, the value beta.
TAU (OUTPUT) real(stnd)
On exit, the value tau.

Further Details

On output, H is the identity matrix if TAU = 0.

This subroutine is adapted from:

  1. Lawson, C.L., and Hanson, R.J., 1974:
    Solving least square problems. Prentice-Hall.
  2. Hanson, R.J., and Hopkins, T., 2017:
    Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24 (December 2017), 23 pages.

subroutine h1 ( u, beta, tau, vec )

Purpose

H1 generates a real elementary reflector H of order n, such that

H * X = D , with H’ * H = I and D’ = ( beta 0 )

where beta is scalar and X is an n-element real vector.

H is represented in the form

H = I + tau * ( v * v’ ) ,

where tau is a real scalar and v is a real n-element vector.

The real elementary reflector H is then applied to a real vector C .

Arguments

U (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, U contains the pivot vector X.

On exit, U contains the vector v of the Householder reflector.

BETA (OUTPUT) real(stnd)
On exit, the value beta.
TAU (OUTPUT) real(stnd)
On exit, the value tau.
VEC (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, the real vector C .

On exit, C is overwritten by the vector H * C .

Further Details

On output, H is the identity matrix if TAU = 0.

It is assumed that size( VEC ) >= size( U ) = n .

This subroutine is adapted from:

  1. Lawson, C.L., and Hanson, R.J., 1974:
    Solving least square problems. Prentice-Hall.
  2. Hanson, R.J., and Hopkins, T., 2017:
    Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24 (December 2017), 23 pages.

subroutine h1 ( u, beta, tau, mat, left )

Purpose

H1 generates a real elementary reflector H of order n, such that

H * X = D , with H’ * H = I and D’ = ( beta 0 )

where beta is scalar and X is an n-element real vector.

H is represented in the form

H = I + tau * ( v * v’ ) ,

where tau is a real scalar and v is a real n-element vector.

The real elementary reflector H is then applied to a real matrix C from the left or the right.

Arguments

U (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, U contains the pivot vector X.

On exit, U contains the vector v of the Householder reflector.

BETA (OUTPUT) real(stnd)
On exit, the value beta.
TAU (OUTPUT) real(stnd)
On exit, the value tau.
MAT (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, the n-by-m or m-by-n real matrix C.

On exit, C is overwritten by the matrix H * C (if LEFT=true) or C * H (if LEFT=false).

LEFT (INPUT) logical(lgl)

If:

  • LEFT=true, H is applied to the real matrix C from the left;
  • LEFT=false, H is applied to the real matrix C from the right.

Further Details

On output, H is the identity matrix if TAU = 0.

It is assumed that:

  • size( MAT, 1 ) >= size( U ) if LEFT=true;
  • size( MAT, 2 ) >= size( U ) if LEFT=false.

This subroutine is adapted from:

  1. Lawson, C.L., and Hanson, R.J., 1974:
    Solving least square problems. Prentice-Hall.
  2. Hanson, R.J., and Hopkins, T., 2017:
    Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24 (December 2017), 23 pages.

subroutine h2 ( beta, u, up, tau )

Purpose

H2 generates a real elementary reflector H of order n, such that

H * X = D , with H’ * H = I , X’ = ( alpha x ) and D’ = ( beta 0 )

where alpha and beta are scalars, and x is an (n-1)-element real vector.

H is represented in the form

H = I + tau * ( v * v’ ) ,

where tau is a real scalar and v is a real n-element vector.

Arguments

BETA (INPUT/OUTPUT) real(stnd)

On entry, the value alpha.

On exit, it is overwritten with the value beta.

U (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, U contains the pivot (n-1)-element vector x.

On exit, U contains the vector v(2:) of the Householder reflector.

UP (OUTPUT) real(stnd)
On exit, UP contains the value v(1) of the Householder reflector.
TAU (OUTPUT) real(stnd)
On exit, TAU contains the value tau of the Householder reflector.

Further Details

On output, H is the identity matrix if TAU = 0.

This subroutine is adapted from:

  1. Lawson, C.L., and Hanson, R.J., 1974:
    Solving least square problems. Prentice-Hall.
  2. Hanson, R.J., and Hopkins, T., 2017:
    Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24 (December 2017), 23 pages.

subroutine h2 ( beta, u, up, tau, piv, vec )

Purpose

H2 generates a real elementary reflector H of order n, such that

H * X = D , with H’ * H = I , X’ = ( alpha x ) and D’ = ( beta 0 )

where alpha and beta are scalars, and x is an (n-1)-element real vector.

H is represented in the form

H = I + tau * ( v * v’ ) ,

where tau is a real scalar and v is a real n-element vector.

The real elementary reflector H is then applied to a real vector C .

Arguments

BETA (INPUT/OUTPUT) real(stnd)

On entry, the value alpha.

On exit, it is overwritten with the value beta.

U (INPUT/OUTPUT) real(stnd), dimension(:)
On entry, U contains the pivot (n-1)-element vector x. On exit, U contains the vector v(2:) of the Householder reflector.
UP (OUTPUT) real(stnd)
On exit, UP contains the value v(1) of the Householder reflector.
TAU (OUTPUT) real(stnd)
On exit, TAU contains the value tau of the Householder reflector.
PIV (INPUT/OUTPUT) real(stnd)

On entry, the scalar C[1].

On exit, PIV is overwritten by the scalar (H * C)[1].

VEC (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, the real vector C[2:].

On exit, C is overwritten by the vector (H * C)[2:].

Further Details

On output, H is the identity matrix if TAU = 0.

It is assumed that size( VEC ) >= size( U ) .

This subroutine is adapted from:

  1. Lawson, C.L., and Hanson, R.J., 1974:
    Solving least square problems. Prentice-Hall.
  2. Hanson, R.J., and Hopkins, T., 2017:
    Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24 (December 2017), 23 pages.

subroutine h2 ( beta, u, up, tau, vec_piv, mat, left )

Purpose

H2 generates a real elementary reflector H of order n, such that

H * X = D , with H’ * H = I , X’ = ( alpha x ) and D’ = ( beta 0 )

where alpha and beta are scalars, and x is an (n-1)-element real vector.

H is represented in the form

H = I + tau * ( v * v’ ) ,

where tau is a real scalar and v is a real n-element vector.

The real elementary reflector H is then applied to a real matrix C from the left or the right.

Arguments

BETA (INPUT/OUTPUT) real(stnd)

On entry, the value alpha.

On exit, it is overwritten with the value beta.

U (INPUT/OUTPUT) real(stnd), dimension(:)
On entry, U contains the pivot (n-1)-element vector x. On exit, U contains the vector v(2:) of the Householder reflector.
UP (OUTPUT) real(stnd)
On exit, UP contains the value v(1) of the Householder reflector.
TAU (OUTPUT) real(stnd)
On exit, TAU contains the value tau of the Householder reflector.
VEC_PIV (INPUT/OUTPUT) real(stnd), dimension(:)

If LEFT=true:

  • On entry, the row_vector C[1,:];
  • On exit, VEC_PIV is overwritten by the vector (H * C)[1,:].

If LEFT=false:

  • On entry, the column_vector C[:,1];
  • On exit, VEC_PIV is overwritten by the vector (C * H)[:,1].
MAT (INPUT/OUTPUT) real(stnd), dimension(:,:)

If LEFT=true:

  • On entry, the (n-1)-by-m matrix C[2:,:];
  • On exit, MAT is overwritten by the matrix (H * C)[2:,:] .

If LEFT=false:

  • On entry, the m-by-(n-1) matrix C[:,2:];
  • On exit, MAT is overwritten by the matrix (C * H)[:,2:].
LEFT (INPUT) logical(lgl)

If:

  • LEFT=true, H is applied to the real matrix C from the left;
  • LEFT=false, H is applied to the real matrix C from the right.

Further Details

On output, H is the identity matrix if TAU = 0.

It is assumed that:

  • size( MAT, 1 ) >= size( U ) and size( MAT, 2 ) >= size( VEC_PIV ) if LEFT=true;
  • size( MAT, 2 ) >= size( U ) and size( MAT, 1 ) >= size( VEC_PIV ) if LEFT=false.

This subroutine is adapted from:

  1. Lawson, C.L., and Hanson, R.J., 1974:
    Solving least square problems. Prentice-Hall.
  2. Hanson, R.J., and Hopkins, T., 2017:
    Remark on Algorithm 539: A Modern Fortran Reference Implementation for Carefully Computing the Euclidean Norm. ACM Trans. Math. Softw., Vol. 44, No 3, Article 24 (December 2017), 23 pages.

subroutine apply_h1 ( u, tau, vec )

Purpose

APPLY_H1 applies a real elementary reflector H generated by H1 to a real vector C . H is represented in the form

H = I + tau * ( v * v’ ) ,

where tau is a real scalar and v is a real n-element vector.

Arguments

U (INPUT) real(stnd), dimension(:)
On entry, U contains the vector v of the Householder reflector, as generated by H1.
TAU (INPUT) real(stnd)
On entry, the scalar tau of the Householder reflector, as generated by H1.
VEC (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, the real vector C .

On exit, C is overwritten by the vector H * C .

Further Details

It is assumed that size( VEC ) >= size( U ) .

This subroutine is adapted from

  1. Lawson, C.L., and Hanson, R.J., 1974:
    Solving least square problems. Prentice-Hall.

subroutine apply_h1 ( u, tau, mat, left )

Purpose

APPLY_H1 applies a real elementary reflector H generated by H1 to a real n-by-m or m-by-n matrix, C, from the left or the right. H is represented in the form

H = I + tau * ( v * v’ ) ,

where tau is a real scalar and v is a real n-element vector.

Arguments

U (INPUT) real(stnd), dimension(:)
On entry, U contains the vector v of the Householder reflector, as generated by H1.
TAU (INPUT) real(stnd)
On entry, the scalar tau of the Householder reflector, as generated by H1.
MAT (INPUT/OUTPUT) real(stnd), dimension(:,:)

On entry, the n-by-m or m-by-n matrix C.

On exit, C is overwritten by the matrix H * C (LEFT=true) or C * H (LEFT=false).

LEFT (INPUT) logical(lgl)

If:

  • LEFT=true, H is applied to the real matrix C from the left;
  • LEFT=false, H is applied to the real matrix C from the right.

Further Details

It is assumed that:

  • size( MAT, 1 ) >= size( U ) if LEFT=true;
  • size( MAT, 2 ) >= size( U ) if LEFT=false.

This subroutine is adapted from:

  1. Lawson, C.L., and Hanson, R.J., 1974:
    Solving least square problems. Prentice-Hall.

subroutine apply_h2 ( u, up, tau, piv, vec )

Purpose

APPLY_H2 applies a real elementary reflector H generated by H2 to a real vector C . H is represented in the form

H = I + tau * ( v * v’ ) ,

where tau is a real scalar and v is a real n-element vector.

Arguments

U (INPUT) real(stnd), dimension(:)
On entry, U contains the vector v(2:) of the Householder reflector, as generated by H2.
UP (INPUT) real(stnd)
On entry, the value v(1) of the Householder reflector, as generated by H2.
TAU (INPUT) real(stnd)
On entry, the scalar tau of the Householder reflector, as generated by H2.
PIV (INPUT/OUTPUT) real(stnd)

On entry, the scalar C[1].

On exit, PIV is overwritten by the scalar (H * C)[1].

VEC (INPUT/OUTPUT) real(stnd), dimension(:)

On entry, the real vector C[2:].

On exit, C is overwritten by the vector (H * C)[2:].

Further Details

It is assumed that size( VEC ) >= size( U ) .

This subroutine is adapted from:

  1. Lawson, C.L., and Hanson, R.J., 1974:
    Solving least square problems. Prentice-Hall.

subroutine apply_h2 ( u, up, tau, vec_piv, mat, left )

Purpose

APPLY_H2 applies a real elementary reflector H generated by H2 to a real n-by-m or m-by-n matrix, C, from the left or the right. H is represented in the form

H = I + tau * ( v * v’ ) ,

where tau is a real scalar and v is a real n-element vector.

Arguments

U (INPUT) real(stnd), dimension(:)
On entry, U contains the vector v(2:) of the Householder reflector, as generated by H2.
UP (INPUT) real(stnd)
On entry, the value v(1) of the Householder reflector, as generated by H2.
TAU (INPUT) real(stnd)
On entry, the scalar tau of the Householder reflector, as generated by H2.
VEC_PIV (INPUT/OUTPUT) real(stnd), dimension(:)

If LEFT=true:

  • On entry, the row_vector C[1,:];
  • On exit, VEC_PIV is overwritten by the vector (H * C)[1,:].

If LEFT=false:

  • On entry, the column_vector C[:,1];
  • On exit, VEC_PIV is overwritten by the vector (C * H)[:,1].
MAT (INPUT/OUTPUT) real(stnd), dimension(:,:)

If LEFT=true:

  • On entry, the (n-1)-by-m matrix C[2:,:];
  • On exit, MAT is overwritten by the matrix (H * C)[2:,:] .

If LEFT=false:

  • On entry, the m-by-(n-1) matrix C[:,2:];
  • On exit, MAT is overwritten by the matrix (C * H)[:,2:].
LEFT (INPUT) logical(lgl)

If:

  • LEFT=true, H is applied to the real matrix C from the left;
  • LEFT=false, H is applied to the real matrix C from the right.

Further Details

It is assumed that:

  • size( MAT, 1 ) >= size( U ) and size( MAT, 2 ) >= size( VEC_PIV ) if LEFT=true;
  • size( MAT, 2 ) >= size( U ) and size( MAT, 1 ) >= size( VEC_PIV ) if LEFT=false.

This subroutine is adapted from:

  1. Lawson, C.L., and Hanson, R.J., 1974:
    Solving least square problems. Prentice-Hall.
Flag Counter