Web pdp-10.trailing-edge.com

Trailing-Edge - PDP-10 Archives - decuslib10-02 - 43,50145/llsq.doc
There are 2 other files named llsq.doc in the archive. Click here to see a list.
```SUBROUTINE LLSQ

PURPOSE
TO SOLVE LINEAR LEAST SQUARES PROBLEMS, I.E. TO MINIMIZE
THE EUCLIDEAN NORM OF B-A*X, WHERE A IS A M BY N MATRIX
WITH M NOT LESS THAN N. IN THE SPECIAL CASE M=N SYSTEMS OF
LINEAR EQUATIONS MAY BE SOLVED.

USAGE
CALL LLSQ (A,B,M,N,L,X,IPIV,EPS,IER,AUX)

DESCRIPTION OF PARAMETERS
A	  - M BY N COEFFICIENT MATRIX (DESTROYED).
B	  - M BY L RIGHT HAND SIDE MATRIX (DESTROYED).
M	  - ROW NUMBER OF MATRICES A AND B.
N	  - COLUMN NUMBER OF MATRIX A, ROW NUMBER OF MATRIX X.
L	  - COLUMN NUMBER OF MATRICES B AND X.
X	  - N BY L SOLUTION MATRIX.
IPIV   - INTEGER OUTPUT VECTOR OF DIMENSION N WHICH
CONTAINS INFORMATIONS ON COLUMN INTERCHANGES
IN MATRIX A. (SEE REMARK NO.3).
EPS	  - INPUT PARAMETER WHICH SPECIFIES A RELATIVE
TOLERANCE FOR DETERMINATION OF RANK OF MATRIX A.
IER	  - A RESULTING ERROR PARAMETER.
AUX	  - AUXILIARY STORAGE ARRAY OF DIMENSION MAX(2*N,L).
ON RETURN FIRST L LOCATIONS OF AUX CONTAIN THE
RESULTING LEAST SQUARES.

REMARKS
(1) NO ACTION BESIDES ERROR MESSAGE IER=-2 IN CASE
M LESS THAN N.
(2) NO ACTION BESIDES ERROR MESSAGE IER=-1 IN CASE
OF A ZERO-MATRIX A.
(3) IF RANK K OF MATRIX A IS FOUND TO BE LESS THAN N BUT
GREATER THAN 0, THE PROCEDURE RETURNS WITH ERROR CODE
IER=K INTO CALLING PROGRAM. THE LAST N-K ELEMENTS OF
VECTOR IPIV DENOTE THE USELESS COLUMNS IN MATRIX A.
THE REMAINING USEFUL COLUMNS FORM A BASE OF MATRIX A.
(4) IF THE PROCEDURE WAS SUCCESSFUL, ERROR PARAMETER IER
IS SET TO 0.

SUBROUTINES AND FUNCTION SUBPROGRAMS REQUIRED
NONE

METHOD
HOUSEHOLDER TRANSFORMATIONS ARE USED TO TRANSFORM MATRIX A
TO UPPER TRIANGULAR FORM. AFTER HAVING APPLIED THE SAME
TRANSFORMATION TO THE RIGHT HAND SIDE MATRIX B, AN
APPROXIMATE SOLUTION OF THE PROBLEM IS COMPUTED BY
BACK SUBSTITUTION. FOR REFERENCE, SEE
G. GOLUB, NUMERICAL METHODS FOR SOLVING LINEAR LEAST
SQUARES PROBLEMS, NUMERISCHE MATHEMATIK, VOL.7,
ISS.3 (1965), PP.206-216.
```