10
Comput. & Elect. Engng, Vol. 1, pp. 391~100. Pergamon Press, 1973. Printed in Great Britain. ON THE COMPUTATION OF THE SPAN OF A SET OF VECTORSf DAVID JORDAN and Louis F. GODBOUT, JR. University of Connecticut, Storrs, Connecticut 06268, U.S.A. (Received 23 August 1973) Abstract--This paper presents a computational approach for determining the span of a given set of vectors, X, belonging to a finite-dimensional Euclidean vector space, V, over the field of complex numbers, C. A basis for the sub-space, M, spanned by X is selected from the elements of X. The remaining dements of X are then represented in terms of the basis. The Gauss elimination technique with full pivoting as generalized to nonsquare, complex matrices is used throughout to determine basis vectors and dependent vector relationships. A discussion of computational requirements is included. The Appendix contains a listing of the FORTRAN IV program developed for use on the IBM System 360/65 computer. INTRODUCTION In many applications of the theory of finite-dimensional vector spaces, such as in the area of control theory[I-4], it is often required to find the sub-space spanned by a set of vectors [5]. In algebraic terms this is equivalent to finding the maximal number of linearly independent vectors contained in the set. The sub-space is then spanned by these indepen- dent vectors, forming a basis, and the dimension of the sub-space equals the number of independent vectors. This paper presents a computational approach to finding a basis for the sub-space spanned by a given set of vectors. In addition, the representation of the remaining dependent vectors belonging to the set is computed in terms of the basis. The setting is that of complex, finite-dimensional Euclidean vector spaces. Examples and an IBM System 360/FORTRAN IV computer program are included. BASIC RESULTS Consider the n-dimensional vector space, V, over the field of complex num~rs, C, with elements consisting of the set of n-tuples of numbers: x = (1) n where xl ..... xn are complex numbers. Define the set X = {xi; i = 1,2 ..... m} (2) 1"This work was supported in part by NSF Grants GK-37421 and GJ-9. Report No. 73-6. 391

On the computation of the span of a set of vectors

Embed Size (px)

Citation preview

Page 1: On the computation of the span of a set of vectors

Comput. & Elect. Engng, Vol. 1, pp. 391~100. Pergamon Press, 1973. Printed in Great Britain.

ON THE COMPUTATION OF THE SPAN OF A SET OF VECTORSf

DAVID JORDAN a n d L o u i s F. GODBOUT, JR.

University of Connecticut, Storrs, Connecticut 06268, U.S.A.

(Received 23 August 1973)

Abstract--This paper presents a computational approach for determining the span of a given set of vectors, X, belonging to a finite-dimensional Euclidean vector space, V, over the field of complex numbers, C. A basis for the sub-space, M, spanned by X is selected from the elements of X. The remaining dements of X are then represented in terms of the basis. The Gauss elimination technique with full pivoting as generalized to nonsquare, complex matrices is used throughout to determine basis vectors and dependent vector relationships. A discussion of computational requirements is included. The Appendix contains a listing of the FORTRAN IV program developed for use on the IBM System 360/65 computer.

I N T R O D U C T I O N

In many applications of the theory of finite-dimensional vector spaces, such as in the area of control theory[I-4], it is often required to find the sub-space spanned by a set of vectors [5]. In algebraic terms this is equivalent to finding the maximal number of linearly independent vectors contained in the set. The sub-space is then spanned by these indepen- dent vectors, forming a basis, and the dimension of the sub-space equals the number of independent vectors. This paper presents a computational approach to finding a basis for the sub-space spanned by a given set of vectors. In addition, the representation of the remaining dependent vectors belonging to the set is computed in terms of the basis. The setting is that of complex, finite-dimensional Euclidean vector spaces. Examples and an IBM System 360/FORTRAN IV computer program are included.

BASIC R E S U L T S

Consider the n-dimensional vector space, V, over the field of complex num~rs, C, with elements consisting of the set of n-tuples of numbers:

x = ( 1 )

n

where xl . . . . . xn are complex numbers. Define the set

X = {xi; i = 1,2 . . . . . m} (2)

1"This work was supported in part by NSF Grants GK-37421 and GJ-9. Report No. 73-6.

391

Page 2: On the computation of the span of a set of vectors

392 [)AVID .JORDAN and Louis F. GOI)BOUT. JR.

as a group of given vectors. The sub-space, M, spanned by the set X is defined as:

M = t . ~ ' (3) ~y, y = ~ i x ' , ~ i e C , i - - I, m i . i = 1

It is well known[5] that there exists at least one subset, Z c X such that any y ~ M can be represented as a linear combination of the vectors in Z and the set Z is linearly independent. Such a subset is a basis for M and the number of elements in Z is the dimension of M.

The geometric concepts of span, dimension, linear independence and basis are easy to describe and understand. However, application of these concepts to physical problems where vectors are represented by arrays of numbers presents computat ional difficulties not apparent in the theory. Linear independence is a very difficult property to test computa- tionally due to the finite word length representation of numbers in digital computers. In general, the best that can be established is linear independence outside some tolerance limit. Typically, two normalized vectors, x and y, are considered linearly independent if [Ix - yll > e where e is a small positive number "near" the accuracy limit of the particular computer in use and H" I1 is any vector norm. Thus any computat ional method for deter- mining span must necessarily be limited to problems which assure that machine error will be bounded by e, and which are not ill-conditioned to the extent that all normalized linearly independent vectors satisfy Itx - Yll > ~:. Since machine error generally increases with the number of computations, these considerations place an upper bound on the vector space dimension, n, for which an algorithm remains reliable.

In order to facilitate the computat ional process, the set, X, is arranged in columns to form the n x m matrix A :

A = [ x l i x 2: ix" l (4)

In this form the number of linearly independent vectors in X is equivalent to the rank of A. Thus the dimension of M can be found by a rank test on A. Since the stated objective is to define a basis for M and represent all vectors in X in terms of this basis, the chosen com- putational method should satisfy all these objectives in as efficient and accurate a manner as is feasible.

There are many methods for finding matrix rank[6-9~ ; however, the most efficient and accurate method that preserves vector identity while testing rank appears to be Gauss el imination[@ In order to maximize accuracy and minimize logic difficulties, Gauss elimination with full pivoting[6, 10] is selected. Using elementary row and column opera- tions the matrix A is transformed into upper triangular, row and column permuted form:

,7t = P A Q = 1°11~411 "~121 , - ,", L J L _ ! L J t51

I" D I - - I"

Matrix P combines row permutation and column elimination operations while matrix Q is restricted to column permutation operations. Matrix A~t is non-singular and upper triangular. Full pivoting assures that each element in the ith row of A 12 and the off-diagonal elements of the ith row ofA 11 are bounded above in magnitude by the ith diagonal element

of A l l . Examination of A1 ~ shows that rank (A) = r and the columns of A corresponding to

Page 3: On the computation of the span of a set of vectors

On the computat ion of the span of a set of vectors 393

I ~ 1 / form basis for the r-dimensional sub-space M. Thus the span of X is defined by q

a 1

transforming A into the form of equation (5). It should be noted that the resulting basis is not, generally, the only basis for M that can be selected from X. However, this procedure attempts to select those vectors exhibiting the strongest degree of linear independence.

It remains to determine the representation of the dependent vectors of X in terms of the chosen basis for M. Consider the set of linear equations:

AlIW = A12 (6)

where W is an r x (m - r) matrix of unknowns. Solving these equations for W by back substitution yields the dependence of columns of-412 on those of A11. Correspondingly, formation of the matrix

E w ] ,7, Z = Q - I . _ ,

satisfies the equation

a z = 0. (8)

Thus, the jth column of W represents the dependence of the j-permuted column of A on the chosen basis vectors. Rearrangement of the elements of W by rows then yields the representation of dependent vectors in X on the chosen basis.

C O M P U T A T I O N A L C O N S I D E R A T I O N S

The above algorithm can be separated into two parts for analysis of computational burden; the elimination stage for determining the dimension and a basis for M, and the back substitution phase for determining dependent vector relationships. Computational burden will be expressed in terms of the number of multiplications as this is a representative measure of computational work. Using Gauss elimination as extended to non-square matrices, the elimination phase comprises Me multiplications where

Me = ~', (m - i)(n - i). (9) i = 1

Similarly, the back substitution procedure for m - r columns of r variables each requires M b multiplications where

r - - 1

Mb = (m -- r) ~ i. (10) i = 1

Combining and expanding equations (9) and (10) yields a total of M t multiplications where

M t = n r m - - ~ + r - m - ~ + r. (11)

If n = 10, m -- 20, r -- 8 this yields a total of 1060 multiplications. Implementation of the above algorithm with a computer program requires careful

programming to preserve computational efficiency and accuracy. In order to obtain reliable results it is necessary to have confidence in at least ten significant figures of accuracy at all

Page 4: On the computation of the span of a set of vectors

394 DAVID JORDAN and LOUIS F. GODBOUT, JR.

stages of computation. For the IBM System 360 this requires that double precision arith- metic be used. Since FORTRAN IV does not provide complex double precision computa- tions it was necessary to include suitable complex number routines in the program development. A critical factor in achieving reliable performance is selection of an appro- priate value for e, the rank test criterion. In applying the program it has been found that a value of 10-10 achieves a good balance between generality of the program and reliability of results for vector space dimensions less than approximately 20. The Appendix contains a listing of the program used to implement the algorithm.

E X A M P L E S

In order to test the reliability of the computer program and the effectiveness of the algorithm it was decided to experiment with semi-randomly generated sets of vectors. In each case, n - 2 n-dimensional vectors were generated randomly. Then n + 2 new linearly dependent vectors were randomly generated from these. This process was carried out several times each for values ofn equal to 5, 10, 15, and 20. Evaluation of the results indicate that the given program is quite reliable for n < 20. To illustrate operation of the algorithm the following example is included. Let the set X be given by:

Defining

yields

fli Jl i: • 1 Ii- l [i it t x = + 2 j , + 8 j , 2 j , +

+ 3j_] 12 + 12j_J 3J-1 +

p = 0 11 0 0

1 - ~ = 0 1

1 0

(12)

(13)

12+ 12j 1 + j 3 + 3 j 3 - 3 /

=PAQ= 0 3 z + ~ j [ 0 0 (14)

0 0 0 0

where the permuted column order is 2, 4, 1, 3. Examination of equation (14) shows that vectors 2 and 4 form a basis for the two-dimensional sub-space M and that vectors 1 and 3 satisfy the dependency relations :,

x 1 =¼x 2 and x 3 = - ~ j x 2. (15)

C O N C L U S I O N S

This paper discusses the computation of the span of a set of given n-dimensional complex vectors. Gauss elimination techniques are shown to yield excellent results for determining the dimension of and a basis for the sub-space spanned and for expressing the non-basis vectors in terms of the basis vectors. The technique is limited in practice to vector spaces of

Page 5: On the computation of the span of a set of vectors

On the computation of the span of a set of vectors 395

dimension less than approximately twenty using double precision on the IBM System 360. An interesting study would be the development of similar or new approaches to handle larger vector spaces and/or ill-conditioned sets of vectors.

R E F E R E N C E S

1, C. T. Chen, Introduction to Linear System Theory. Holt, Rinehart & Winston (1970). 2. D. G. Luenberger, Optimization by Vector Space Methods. Wiley (1969). 3, W. A. Porter, Modern Foundations of Systems Engineering. Macmillan (1966). 4, L. A. Zadeh and C. A. DeSoer, Linear System Theory: The State Space Approach. McGraw-Hill (1963). 5. P. R. Halmos, Finite Dimensional Vector Spaces, 2nd Edn. Van Nostrand (1958). 6, L. Fox, ,,in Introduction to Numerical Linear Algebra. Oxford University Press (1964). 7. G. Golub and W. Kahan, Calculating the singular values and pseudoinverse of a matrix, SIAM J. Numer.

Analy. 2, 205-222 (1965). 8. N. N. Gupta, An optimum method for the computation of matrix rank, IEEE Trans. Systems, Man and

Cybernet. 437-438 (July 1972). 9. G. Peters and J. H. Wilkinson, The least squares problem and pseudo-inverses, Computer J. 13, 309-316

(1970). 10, G. Forsythe and C. B. Moler, Computer Solution of Linear Algebraic Systems. Prentice-Hall (1967).

C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C 4000 4001 4002 4003 400¢ 4005 4006 4007 4008 4 0 0 9 4 0 [ 0 4011 4012 4013

A P P E N D I X

MAIN ROUTINE - - VECTOR DEPENDENCE

IMPLICIT REAL *8(A-HtO-Z) CO~M~N ARtAItXR,XItERS,IRtI~,IRANK DIMENSION ARI20,40I,AII20,4O)tXR(4O,4OItXII4Ot4OI,IR(2OIt

IIC(40),ICU(401,ICA(40)

THIS ROUTINE FINDS A MAXIMUM INDEPENDENT SUBSET OF A GIVEN SET OF COMPLEX (REAL) VECTORS AND DETERMINES THE DEPENDENCE COEFFICIENTS OF THE OTHER VECTORS WITH RESPECT TC THE INDEPENDENT ~ET

THE METHOD USED IS A GENERALIZATION OF THE GAUSS ELIMINATION METHOD WITH FULL PIVOTING TO RANK TESTING AND PARTITION SOLVING OF NON-SQU~RE COMPLEX MATRICES.

NOTE... COMPUTATION IS DONE IN DOUBLE PRECISION FOR BOTH REAl AND ~OMPLEX OPTIONS

VARIABLES

A,R+I X,R÷I EPS IR IC ICU ICA IRANK NC NV ICMPLX

IEND

FORMAT(LHI) FORMAT(//) FORMAT(/////]

ARRAY STORING INPUT VECTORS BY COLUMNS ARRAY CONTAINING VECTOR DEPENDENCY COEFFICIENTS THRESHOLD FOR RANK TEST ROW INTERCHANGE INDEX VECTOR FOR GAUSS ELIMINATION CqLUMN INTERCHANGE INDEX VECTOR FOR GAUSS ELIMINATION ROW UNSORTING INDEX VECTOR COLUMN UNSDRTING INDEX VECTOR RANK OF A MATRIX - ' N O , OF INDEPENDENT VECTORS DIMENSION OF VECTOR SPACE NUMBER OF VECTORS IN SET OPTION TO TREAT COMPLEX VECTORS (GTE I - COMPLEX/ LTE 0 - REAL) OPTION TO ENTER ANOTHER PROBLEM AFTER COMPLETION OF PRESENT ONE ( IN EFFECT IF GT OI

F O R M A T ( 4 D 2 0 . [ O ) FORMAT(SILO) FORMAT(6D20. LO) F O R M A T ( 3 ( D 1 8 . l O t t • J = ~ D I T . L O ) ) F D R M A T ( S X , 2 0 | 5 I FORMAT(5X,DZO. IO t t * V E C T O R ( t ~ I S , o ) +e l FORMAT(SXtDZO. LOtt + j * l O 2 0 . / O t ~ * V E C T O R ( ~ t I 3 t l ) ÷ t ) FORMAT(5X, IVECTOR DEPENDENCY R O U T I N E ) t / ) FDRNATI5X~°THE VECTOR SPACE DIMENSION IS t , I 3 t / ) FDRMAT(5Xt lVECTORS ARE R E A L I j / ) FORMAT(5X, 'VECTORS ARE C O M P L E X l e / )

Page 6: On the computation of the span of a set of vectors

396 DAVID JORDAN and LOUIS F. GODBOUT, JR.

4014 FORMAT(SXt'THE FOLLOWING I t | 3 , ' VECTORS ARE ENTERED', / ) 4016 FORMAT(616Xt'VECTOR e,12,SX)| 4017 FORMATI3(16X,'VECTOR ' ,12 ,15X) I 4018 FORMATI5X,'A.NOTHER PROBLEM FOLLOWS I , / l 4019 FORMATISX,'NC MORE PROBLEMS FOLLOW',/I 4020 FORMAT(5X,'THE GIVEN VECTORS ARE LINEARLY INDEPENDENT',//,

15X,'THEY SPAN A ' , 1 3 , ' DIMENSIONAL SUBSPACE',/) 4021 FORMATISX,'THE FOLLOWING VECTORS FORM THE BASIS FOR a ' ,

I 1 3 , ' DI"IENSIONAL SUBSPACE',/) 4022 FORMAT(5X,'THE FOI_LF)WIN,; ARE THE DEPENDENT VECT']~ RELATIONSHIPS',

i / ) 4023 F]RMAT(SX,'VECTO~(',I3,, ) = , , / | 4024 F]RMAT(SX,'THIS ENDS PRINTOUT FOR THIS PROF~LEM',/I 4025 FORMAT(BX,'NC MORF PROBLEMS FOLLOW',/) 4020 F,JRMAT(SX,'THr_ CALCULATED NUMBER OF INOEPENOENT VECTORS IS ZERO',

i / ) 4027 FORMAT(//,5X,'THE ONE VECTOR CASE IS NOT CONSIDEREO ~Y THIS PRnGRA

[M. i ) C C INPUT DIMENSIONS, OPTIONS, AND VECTORS C

IO READ 4004, NC ,NV, ICMPLX ,I END PRINT 4DO0 P~INT 4001 PRINT 40].0 PRINT 40LI,NC IF(ICMPL×}I3,13, 14

i3 PPINT 4012 GO TO 15

t4 PRINT 4013 15 Cr)NT I NI '"

IF(IENOIIF,17,1d 17 PRINT 4019

G(] TO 20 18 PRINT 4018 2D CONTINUE

~PINT 4014,NV IF( ICMPLX)25,25,60

25 DO 30 J=I,NV READ 4003,(AR(I,J) ,I=I,NC) DO 28 I=I,NC

28 A| ( I,J)=O.OOO 30 CONTINUE

DO 55 L=I,NV,6 I ~ { NV-L- 5 | 35,40, 40

35 L'IOO=NV-L + i GO TO 45

4.0 LMOD=6 45 LL=L+LMOD- I

PRINT 4016,I I , I =L ,LL ) PRINT 4001 DO 50 I=I,NC PRINT 4005, { AR( I , Ji ,J=L, LL)

5O CONTINUE PRINT 4001

55 CONTINUE GO TO 95

60 CONTINUE DO 65 J=I,NV READ 4003, {AR( I , J) ,AI ( I , J ) , I=I,NC)

,55 CONTINUE DO O0 L=I,NV,3 IF ( NV-L-2 ) 70,75, }'5

70 LMOD=NV-L+I G~ TO BO

75 LMOD= 3 ~0 LL =L+LMOD-I

PRINT 4017,( I,I=L,LLI PRINT 4001 OC] 85 [:I,NC PRINT 4006, (AR(I ,J },AI (I , J| , J=L,LL}

85 CDNTINUE PRINT 4001

90 C,']NT I NUE 95 CONTINUE

C C CHECK FOR 1-DIMENSIONAL SPACE C

IFI(NC .NE. I | .AND. {NV .NE. I f ) GO TO 91 PRINT 4027

Page 7: On the computation of the span of a set of vectors

On the computation of the span of a set of vectors 397

GO TO 500 C C PRESET CONSTANTS C

91 EPS=I.OD-IO C C BEGIN GAUSS ELIMINATION WITH FULL PIVOTING C TO DETERMINE RANK AND GET DECOMPOSITION C

ADUM=O.ODO O0 100 I=I,NC DO 100 J : I , N V IF I ICMPLX) 96,96,97

96 ABS:DABS(AR( I , J l I • GO TO 98

97 CALL CABS(ABS,AR(I,J),AI|I,JI| 98 IFIABS-ADUMIIO0~[OO,99 99 ADUM=ABS

100 CnNTINUE EPS=EPS*ADUM CALL GAUSS(NC,NV,ICMPLXI

C C TERMINATE IF ALL VECTORS ARE INDEPENDENT OR 'ZERO' C

IF(IRANK-NVII20,11O, IIO IlO PRINT 4O20,1RANK

GO TO 500 120 CONTINUE

IFIIRANK)IZZ,122,124 [22 PRINT 4026

GO TO 500 124 CONTINUE

C C FIND DEPENDENT VECTOR RELATIONSHIPS C

CALL BAKSUB( IRANK,NV,ICMPLX| C C ORGANIZE AND PRINTOUT RESULTS C

IRANKP=IRANK÷I IST=O DO 140 I=I,NV DO 135 J=X,IRANK IF ( IC IJ ) - I ) I32 , I )O , [32

130 I S T = I S T + I ICUIISTI=J

t32 CONTINUE 135 CONTINUE 140 CONTINUE

NRHS=NV-IRANK IST=O DO 155 I=I,NV DO 150 J=I,NRHS JP=IRANK+J IFIICIJP)-I)147,145,147

145 IST=IST÷I ICA(ISTI=J

147 CONTINUE /50 CONTINUE 155 CONTINUE

C PRINT 4000 PRINT 4001 PRINT 4021,1RANK PRINT 4OO7,IICIICUIII)tI=I,IRANKI PRINT 4001 PRINT 4022 DO 200 I:I,NRHS IP=ICA(II÷IRANK PRINT 4023 ,ICIIP~ DO 180 J=I,IRANK IFIICMPLXIITO,170,175

170 PRINT 4OO8,XRIICIICU(JII,ICA(III,ICIICUIJ)I GO TO 180

175 PRINT 40og,xRI IC I ICUIJ } | , ICA( I I I ,X I I IC I ICUIJ | | , ICA( I I | , IC( ICU(J | ) 180 CONTINUE

PRINT 4001 200 CONTINUE

Page 8: On the computation of the span of a set of vectors

398 DAVID JORDAN and LouIs F. GODBOUT, JR.

TERMINATION PROCEDURE

500 PRINT 4002 PRINT 6024 IF(IEND)520,5ZO,510

510 PRINT 4018 GO TO I0

520 PRINT 4025 PRINT 4000 STOP END

SUBROUTINE GAUSSIN,M, ICMpL~I IMPLICIT R~AL ~ 8 I A - H ~ U - £ I COMMON AR,AI,XR,XI,EPS,IR,IC,IRANK DIMENSION AR(20,40}~AI(2D,40|~XR{40~40I.XII4D,40)~IRI20|,

IIC{60),ICUI40),ICA(40)

THIS SUBROUTINE CALCULATES THE OUASl L-U DECOMPOSITION USING GAUSS ELIMINATION WITH FULL PIVOTING OF THE GENERALLY NON-SOUARE MATRIX AR {AR AND AT, IF COMPLEX) . NOTE: RANK IS RETURNED .

C C. C C C C C C C PRESET ROW AND COLUMN INTERCHANGE INDICES C

DO i00 I=I,N 100 IR { I )= I

O0 LOS I= I ,M 105 I C ( I | = I

IF [N-M) I IO, I I 0 , I 15 110 NN=N

IROW=O IRAN~,=N GO TO 120

L15 NN=M IROW=I IRANK=M

120 CONTINUE NM=NN-I

C C BEGIN ELIMINATION PROCEDURE C

DO 250 LS=I,NM IS=iS IS=iS A~AG=O,O00

C C SEARCH FOR PIVOT C

DO 140 I=LS,N O0 140 J=LS,M IF(ICMPLX)125,125,128

125 ADUM=DABS(AR(IR(I|,IC[ J) | ) GO TO 130

128 CALL CABS(ADUM,AR( IR(I ),It(J); ,AI(IR{I),ICIJ))) i30 CONTINUE

IF I AOUM-AMAG ) L4O, 140, 135 135 IS=l

JS=J AMAG=ADUM

140 CONTINUE C C TEST FOR COMPLETION C

IF [AMAG-EPS) 145, [45,150 145 IRANK=LS- I

GO TO 300 150 CONTINUE

C C INTERCHANGING ROW AND COLUMN INDICES C

IT=fRIES) IR(LS)=IR( IS) IR [ IS I= IT IT=IC(LS) ICILS)=IC{ IS) IC{JSI=IT

Page 9: On the computation of the span of a set of vectors

On the computation of the span of a set of vectors 399

C C ELIMINATE IC(L.S) COLUMN C

LS P=LS+I O0 170 I'=LSP~N IFIICMPLXI [53t153,155

153 Q= AR ( IR( I ) ,IC(LS) ]'/AR( IR (LS) t I CILS)) GO TO 158

155 C~LL C D I V ( Q R , Q I , A R ( I R ( I | , I C [ L S I I t A I I I R I I | t I C I L S | I , IAR( IR(LS|, IC (LS)) ,A l l I R( LSI ,IC [LS) ) |

15;:} CONTIN'J~ O0 170 J=LSP,M IF ([C',IPLX) 163, 163, 165

163 AR( IR ( I ) , IC(J) I=AR [ IR(I ) , IC(JI I-Q*AR(IR(LS), ICI J) ) GO TO 170

ib5 CALL CMUL(qTR,QTI,QR,QI,AR(IR(LS),IC(JI),AI(IR(LS),IC(J))) AR(IR(1),IC(J))=AR{IR( I I , IC(J) I -QTR AI ( IR(1) , IC( J ) ) = A I ( I R ( I ) , IC(JJl-QTI

170 CONTINUE C C FINISH O::F LAST ROW OR COLUMN C

AMAG=O ,OPO IS=NN JS=NN IF ( LS-."I'4 ) 230,1T5 t 175

115 IF(IROW| [ / ? , L77,190 l i t DO 185 I=NN, M

IF(ICMPLXI179,[79,181 179 AOUM=OA~S(AR(IP(NN),IC(I| )1

GO TO 183 lBl CALL CABS( ADUM,AR( IR(NN| , IC(I ) ) ,AI ( IR[NN|, IC( I ;@ | 183 CONTINUE

IF (ADUM-AMA,S) 185,185, 184 184 I ':;= I

AM AG=AI)UM 185 CONTINUE

IT=|C( IS| IC| IS)=IC(NN) IC (NN)=IT GO TO 210

190 CONTINUE AMAG=O.ODO DO 200 I=NN,N IF(ICMPLX) 193,193t195

193 AOUM=DAFIS( AOUM,AR( IR( I l , IC(NNI I , A I (IR( I I , IC(NN| | | GO TO 197

ig5 CALL" CA~S(ADUM,AR{IR(1),IC(NN))~AI(IR(1),IC(NN])I 197 CONTINUE

IF (ADUM-AMAG |200,200,198 198 JS=I

AM AG=A.r)'JM Z00 CONTINUE

IT=IR(JS) IR(JS)=IR|NN) IR(NN]=IT

210 CONTINUE IF ( AMAG-EP S| 220,230,230

220 IRANK=NN- I 2:}0 CONTINUE 250 CONTINUE 300 CgNTINUE

RETURN ENO

SUBROUTINE BAKSUB[N,M, ICMPLX} IMPLICIT R~'AL ~BIA-HI. EI--L; CaMMON AR, A| t XRt X|, EPS,I R, IC, I RANK DIMENSIrJN ARI20,4OI,A|(ZOtAOItXRI~O,L-O|,XIIAO,4OItIR(2OIt

[ IC { 401 , ICU(AOl, I CA (401 C C THIS SUBROUTINE SOLVES THE L-U DECOMPOSED C SYSTEM A(I,I)wwX = A( [ ,2 ) WHERE A ( I , L I AND A(Lo2| C ARE PARTITIONS 0;: TH =- A MATRIX WITH A ( I , I ) PSEUDO-DECOMPOSED C

NR=M-I R.ANK N.~= IRANK-I DO 200 L=ItNR LP=L+IRANK

Page 10: On the computation of the span of a set of vectors

400 DAVID JORDAN and LOUIS F, GODBOUT, JR.

PRESET LAST X ENTRY FOR BACK SUBSTITUTION

IF(ICMPLX)ILO)ltO, I I5 LID XR(IC(IRANKI,L)=AR(IR(IRANK),IC(LP))/AR(IR(IRANK),IC(IRANK))

GO TO 120 I15 CALL CDIV(XR(IC(IRANK),L),XI(IC(IRANK),L),

.*IAR(IR(IQANK),IC(LP|),AI(IR(IRANK),IC(LP} ), 2AR(IR(IRANK),IC(IRANK)),AI(IR(IRANK),IC(IRANK)))

t2O CONTINUE

DO ~ACK SUBSTITUTION

DO 175 I=I,N~ II=IRANK-I IF(ICMPLX)I25,125)I30

125 DUM=AR(IR(II),IC(LP)) GO TO 135

130 DUMR=AR(IR(II)tIC(LP)| DUMI=AI(IR(II),IC(LP|!

135 CONTINUE O0 155 J = l , l JJ=IRANK-J+I IF(ICMPLX)I40,140,145

I~0 DUM=OUM-AR(IR(II),IC(JJ)I*XR(IC(JJ),L) GO TO 150

145 CALL CMUL(PR)Pl tAR(IR( I I I , IC(JJ) ) ,AI ( IRI I I ) , IC(JJ) ) , IXR( IC(JJ ) ,L I ,X I ( IC (JJ ) ,L | I

DUMR=OUMR-PR DUMI=DUMI-PI

150 CONTINUE 155 CONTINUE

I F I I C M P L X I t 6 0 , 1 6 0 ) L b 5 [60 X R ( I C ( I I ) t L | = O U M / A R ( I R ( I I I , I C ( I I ) )

GO TO 170 165 CALL CDIV(XRIIC(IIItLItXI(IC(II))L),DUMRtOUMI,

I A R ( I R ( I I ) , I C ( I I ) ) , A I ( I R ( I I ) , I C ( I I ) ) ) 170 CONTINUE 175 CONTINUE 200 CONTINUE

RETURN END

SUBROUTINE CMULIA, B,CI,C2)DI,D2)

COMPLEX MULTIPLICATION ROUTINE

IMPLICIT REAL *8(A-H,O-Z) A:CI~Ol-C2*O2 B=CI~O2+C2*D£ RETURN END

50 4000

lO0

IiO

SUBROUTINE CDIV(ArBfCLtC21DI,D2 ~

COMPLEX DIVISION ROUTINE

I~PLICIT REAL *8(A-HtO-Z) E=DI*DI~D2*O2 IF(E-I.OD-40150,IOO,IOO PRINT 40O0 FORMATI5Xt'DIVIDE CHECK IN CDIV--OIVIDEND RETURNED . ' , I ) A=C1 B=C2 GO TO LID A=ICI*OI+C2*D2)IE B=(C2*DI-Ct*O2)IE CONTINUE RETURN END

SUBROUTINE CABSIA,CLtC2I

ROUTINE FINDS MODULUS OF A COMPLEX NUMBER

T~PLiCIT REAL ~BIA-H,O-ZI A=OSQRT(CI*C[+C2*C2) RETURN END