~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to routines/slicot/sb04nw.f

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
      SUBROUTINE SB04NW( ABSCHR, UL, N, M, C, LDC, INDX, AB, LDAB, D )
 
2
C
 
3
C     RELEASE 4.0, WGS COPYRIGHT 1999.
 
4
C
 
5
C     PURPOSE
 
6
C
 
7
C     To construct the right-hand side D for a system of equations in
 
8
C     Hessenberg form solved via SB04NY (case with 1 right-hand side).
 
9
C
 
10
C     ARGUMENTS
 
11
C
 
12
C     Mode Parameters
 
13
C
 
14
C     ABSCHR  CHARACTER*1
 
15
C             Indicates whether AB contains A or B, as follows:
 
16
C             = 'A':  AB contains A;
 
17
C             = 'B':  AB contains B.
 
18
C
 
19
C     UL      CHARACTER*1
 
20
C             Indicates whether AB is upper or lower Hessenberg matrix,
 
21
C             as follows:
 
22
C             = 'U':  AB is upper Hessenberg;
 
23
C             = 'L':  AB is lower Hessenberg.
 
24
C
 
25
C     Input/Output Parameters
 
26
C
 
27
C     N       (input) INTEGER
 
28
C             The order of the matrix A.  N >= 0.
 
29
C
 
30
C     M       (input) INTEGER
 
31
C             The order of the matrix B.  M >= 0.
 
32
C
 
33
C     C       (input) DOUBLE PRECISION array, dimension (LDC,M)
 
34
C             The leading N-by-M part of this array must contain both 
 
35
C             the not yet modified part of the coefficient matrix C of
 
36
C             the Sylvester equation AX + XB = C, and both the currently
 
37
C             computed part of the solution of the Sylvester equation.
 
38
C
 
39
C     LDC     INTEGER
 
40
C             The leading dimension of array C.  LDC >= MAX(1,N).
 
41
C
 
42
C     INDX    (input) INTEGER
 
43
C             The position of the column/row of C to be used in the
 
44
C             construction of the right-hand side D.
 
45
C
 
46
C     AB      (input) DOUBLE PRECISION array, dimension (LDAB,*)
 
47
C             The leading N-by-N or M-by-M part of this array must
 
48
C             contain either A or B of the Sylvester equation
 
49
C             AX + XB = C.
 
50
C
 
51
C     LDAB    INTEGER
 
52
C             The leading dimension of array AB.
 
53
C             LDAB >= MAX(1,N) or LDAB >= MAX(1,M) (depending on
 
54
C             ABSCHR = 'A' or ABSCHR = 'B', respectively).
 
55
C
 
56
C     D       (output) DOUBLE PRECISION array, dimension (*)
 
57
C             The leading N or M part of this array (depending on
 
58
C             ABSCHR = 'B' or ABSCHR = 'A', respectively) contains the
 
59
C             right-hand side.
 
60
C
 
61
C     NUMERICAL ASPECTS
 
62
C
 
63
C     None.
 
64
C
 
65
C     CONTRIBUTORS
 
66
C
 
67
C     Release 3.0: V. Sima, Katholieke Univ. Leuven, Belgium, Aug. 1997.
 
68
C     Supersedes Release 2.0 routine SB04BW by M. Vanbegin, and
 
69
C     P. Van Dooren, Philips Research Laboratory, Brussels, Belgium.
 
70
C
 
71
C     REVISIONS
 
72
C
 
73
C     -
 
74
C
 
75
C     KEYWORDS
 
76
C
 
77
C     Hessenberg form, orthogonal transformation, real Schur form,
 
78
C     Sylvester equation.
 
79
C
 
80
C     ******************************************************************
 
81
C
 
82
C     .. Parameters ..
 
83
      DOUBLE PRECISION  ONE
 
84
      PARAMETER         ( ONE = 1.0D0 )
 
85
C     .. Scalar Arguments ..
 
86
      CHARACTER         ABSCHR, UL
 
87
      INTEGER           INDX, LDAB, LDC, M, N
 
88
C     .. Array Arguments ..
 
89
      DOUBLE PRECISION  AB(LDAB,*), C(LDC,*), D(*)
 
90
C     .. External Functions ..
 
91
      LOGICAL           LSAME
 
92
      EXTERNAL          LSAME
 
93
C     .. External Subroutines ..
 
94
      EXTERNAL          DCOPY, DGEMV
 
95
C     .. Executable Statements ..
 
96
C
 
97
C     For speed, no tests on the input scalar arguments are made.
 
98
C     Quick return if possible.
 
99
C
 
100
      IF ( N.EQ.0 .OR. M.EQ.0 )
 
101
     $   RETURN
 
102
C
 
103
      IF ( LSAME( ABSCHR, 'B' ) ) THEN
 
104
C
 
105
C        Construct the column of the right-hand side.
 
106
C
 
107
         CALL DCOPY( N, C(1,INDX), 1, D, 1 )
 
108
         IF ( LSAME( UL, 'U' ) ) THEN
 
109
            IF ( INDX.GT.1 ) THEN
 
110
               CALL DGEMV( 'N', N, INDX-1, -ONE, C, LDC, AB(1,INDX), 1,
 
111
     $                     ONE, D, 1 )
 
112
            END IF
 
113
         ELSE
 
114
            IF ( INDX.LT.M ) THEN
 
115
               CALL DGEMV( 'N', N, M-INDX, -ONE, C(1,INDX+1), LDC,
 
116
     $                    AB(INDX+1,INDX), 1, ONE, D, 1 )
 
117
            END IF
 
118
         END IF
 
119
      ELSE
 
120
C
 
121
C        Construct the row of the right-hand side.
 
122
C
 
123
         CALL DCOPY( M, C(INDX,1), LDC, D, 1 )
 
124
         IF ( LSAME( UL, 'U' ) ) THEN
 
125
            IF ( INDX.LT.N ) THEN
 
126
               CALL DGEMV( 'T', N-INDX, M, -ONE, C(INDX+1,1), LDC,
 
127
     $                    AB(INDX,INDX+1), LDAB, ONE, D, 1 )
 
128
            END IF
 
129
         ELSE
 
130
            IF ( INDX.GT.1 ) THEN
 
131
               CALL DGEMV( 'T', INDX-1, M, -ONE, C, LDC, AB(INDX,1),
 
132
     $                     LDAB, ONE, D, 1 )
 
133
            END IF
 
134
         END IF
 
135
      END IF
 
136
C
 
137
      RETURN
 
138
C *** Last line of SB04NW ***
 
139
      END