~ubuntu-branches/ubuntu/lucid/pdl/lucid

« back to all changes in this revision

Viewing changes to Lib/Slatec/slatec/spofa.f

  • Committer: Bazaar Package Importer
  • Author(s): Ben Gertzfield
  • Date: 2002-04-08 18:47:16 UTC
  • Revision ID: james.westby@ubuntu.com-20020408184716-0hf64dc96kin3htp
Tags: upstream-2.3.2
ImportĀ upstreamĀ versionĀ 2.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
*DECK SPOFA
 
2
      SUBROUTINE SPOFA (A, LDA, N, INFO)
 
3
C***BEGIN PROLOGUE  SPOFA
 
4
C***PURPOSE  Factor a real symmetric positive definite matrix.
 
5
C***LIBRARY   SLATEC (LINPACK)
 
6
C***CATEGORY  D2B1B
 
7
C***TYPE      SINGLE PRECISION (SPOFA-S, DPOFA-D, CPOFA-C)
 
8
C***KEYWORDS  LINEAR ALGEBRA, LINPACK, MATRIX FACTORIZATION,
 
9
C             POSITIVE DEFINITE
 
10
C***AUTHOR  Moler, C. B., (U. of New Mexico)
 
11
C***DESCRIPTION
 
12
C
 
13
C     SPOFA factors a real symmetric positive definite matrix.
 
14
C
 
15
C     SPOFA is usually called by SPOCO, but it can be called
 
16
C     directly with a saving in time if  RCOND  is not needed.
 
17
C     (Time for SPOCO) = (1 + 18/N)*(Time for SPOFA) .
 
18
C
 
19
C     On Entry
 
20
C
 
21
C        A       REAL(LDA, N)
 
22
C                the symmetric matrix to be factored.  Only the
 
23
C                diagonal and upper triangle are used.
 
24
C
 
25
C        LDA     INTEGER
 
26
C                the leading dimension of the array  A .
 
27
C
 
28
C        N       INTEGER
 
29
C                the order of the matrix  A .
 
30
C
 
31
C     On Return
 
32
C
 
33
C        A       an upper triangular matrix  R  so that  A = TRANS(R)*R
 
34
C                where  TRANS(R)  is the transpose.
 
35
C                The strict lower triangle is unaltered.
 
36
C                If  INFO .NE. 0 , the factorization is not complete.
 
37
C
 
38
C        INFO    INTEGER
 
39
C                = 0  for normal return.
 
40
C                = K  signals an error condition.  The leading minor
 
41
C                     of order  K  is not positive definite.
 
42
C
 
43
C***REFERENCES  J. J. Dongarra, J. R. Bunch, C. B. Moler, and G. W.
 
44
C                 Stewart, LINPACK Users' Guide, SIAM, 1979.
 
45
C***ROUTINES CALLED  SDOT
 
46
C***REVISION HISTORY  (YYMMDD)
 
47
C   780814  DATE WRITTEN
 
48
C   890831  Modified array declarations.  (WRB)
 
49
C   890831  REVISION DATE from Version 3.2
 
50
C   891214  Prologue converted to Version 4.0 format.  (BAB)
 
51
C   900326  Removed duplicate information from DESCRIPTION section.
 
52
C           (WRB)
 
53
C   920501  Reformatted the REFERENCES section.  (WRB)
 
54
C***END PROLOGUE  SPOFA
 
55
      INTEGER LDA,N,INFO
 
56
      REAL A(LDA,*)
 
57
C
 
58
      REAL SDOT,T
 
59
      REAL S
 
60
      INTEGER J,JM1,K
 
61
C***FIRST EXECUTABLE STATEMENT  SPOFA
 
62
         DO 30 J = 1, N
 
63
            INFO = J
 
64
            S = 0.0E0
 
65
            JM1 = J - 1
 
66
            IF (JM1 .LT. 1) GO TO 20
 
67
            DO 10 K = 1, JM1
 
68
               T = A(K,J) - SDOT(K-1,A(1,K),1,A(1,J),1)
 
69
               T = T/A(K,K)
 
70
               A(K,J) = T
 
71
               S = S + T*T
 
72
   10       CONTINUE
 
73
   20       CONTINUE
 
74
            S = A(J,J) - S
 
75
            IF (S .LE. 0.0E0) GO TO 40
 
76
            A(J,J) = SQRT(S)
 
77
   30    CONTINUE
 
78
         INFO = 0
 
79
   40 CONTINUE
 
80
      RETURN
 
81
      END