# BVLS Bounded Variable Least Squares Solver

BVLS is a FORTRAN77 library which solves a least squares problem with bounds on the variables, by Charles Lawson and Richard Hanson.

Given an M by N matrix, A, and an M-vector, B, BVLS computes an N-vector X that solves the least-squares problem:

A * X = B
subject to BND(1,J) <= X(J) <= BND(2,J) for 1 <= J <= N.

The program allows the user to bound some or all of the variables. The user is also free to constrain some variables with only a one-sided bounded. The values BND(1,J) = -huge(ONE) and BND(2,J) = huge(ONE) are suggested choices to designate that there is no constraint in that direction. The parameter ONE is 1.0 in the working precision.

This algorithm is a generalization of the routine NNLS, which solves the least-squares problem:

A * X = B
subject to 0 <= X(J) for all J.

The subroutine NNLS appeared in 'Solving Least Squares Problems' by Lawson and Hanson, Prentice-Hall, 1974. Work on BVLS was started by Charles Lawson and Richard Hanson at Jet Propulsion Laboratory, 1973 June 12. Many modifications were subsequently made.

The original source code is available through NETLIB at
http://www.netlib.org/lawson-hanson/index.html.

### Languages:

BVLS is available in a FORTRAN77 version and a FORTRAN90 version.

### Related Data and Programs:

BRENT, a FORTRAN77 library which contains Richard Brent's routines for finding the zero, local minimizer, or global minimizer of a scalar function of a scalar argument, without the use of derivative information.

PRAXIS, a FORTRAN77 library which minimizes a scalar function of several variables.

QR_SOLVE, a FORTRAN77 library which computes the least squares solution of a linear system A*x=b.

TEST_LS, a FORTRAN77 library which implements linear least squares test problems of the form A*x=b.

TOMS611, a FORTRAN77 library which seeks the minimizer of a scalar functional of multiple variables.

### Author:

Charles Lawson, Richard Hanson.

### Reference:

1. Charles Lawson, Richard Hanson,
Solving Least Squares Problems,
Revised edition,
SIAM, 1995,
ISBN: 0898713560,
LC: QA275.L38.

### Source Code:

• bvls.f, the source code.
• bvls.sh, commands to compile the source code.

### List of Routines:

• BVLS solves a least squares problem with bounds on the variables.
• BVLS_REPORT reports on the results of a successful call to BVLS.
• CONSTRAINED_FEASIBLE determines if each coefficient is interior.
• HTC constructs a Householder transformation.
• INITIALIZE initializes internal data.
• MOVE_COEF_I moves coefficient I from set P to set Z.
• MOVE_INDEX_J moves the index J from set Z to set P.
• NRM2 returns the Euclidean norm of a vector.
• R8MAT_COPY copies an R8MAT.
• R8MAT_MV multiplies a matrix times a vector.
• R8MAT_MTV multiplies a transposed matrix times a vector
• R8MAT_UNIFORM_01 returns a unit pseudorandom R8MAT.
• R8VEC_COPY copies an R8VEC.
• R8VEC_UNIFORM_01 returns a unit pseudorandom R8VEC.
• ROTG defines a Givens rotation.
• SELECT_ANOTHER_COEFF searches set Z for a new coefficient to solve for.
• TERMINATION handles the termination of the BVLS algorithm.
• TEST_COEF_J
• TEST_SET_P_AGAINST_CONSTRAINTS
• TIMESTAMP prints out the current YMDHMS date as a timestamp.

You can go up one level to the FORTRAN90 source codes.

Last revised on 25 June 2014.