2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123 REAL ZERO, ONE
2124 parameter( zero = 0.0, one = 1.0 )
2125 REAL ROGUE
2126 parameter( rogue = -1.0e10 )
2127
2128 REAL TRANSL
2129 INTEGER LDA, M, N, NMAX
2130 LOGICAL RESET
2131 CHARACTER*1 DIAG, UPLO
2132 CHARACTER*2 TYPE
2133
2134 REAL A( NMAX, * ), AA( * )
2135
2136 INTEGER I, IBEG, IEND, J
2137 LOGICAL GEN, LOWER, SYM, TRI, UNIT, UPPER
2138
2139 REAL SBEG
2141
2142 gen = type.EQ.'GE'
2143 sym = type.EQ.'SY'
2144 tri = type.EQ.'TR'
2145 upper = ( sym.OR.tri ).AND.uplo.EQ.'U'
2146 lower = ( sym.OR.tri ).AND.uplo.EQ.'L'
2147 unit = tri.AND.diag.EQ.'U'
2148
2149
2150
2151 DO 20 j = 1, n
2152 DO 10 i = 1, m
2153 IF( gen.OR.( upper.AND.i.LE.j ).OR.( lower.AND.i.GE.j ) )
2154 $ THEN
2155 a( i, j ) =
sbeg( reset ) + transl
2156 IF( i.NE.j )THEN
2157
2158 IF( n.GT.3.AND.j.EQ.n/2 )
2159 $ a( i, j ) = zero
2160 IF( sym )THEN
2161 a( j, i ) = a( i, j )
2162 ELSE IF( tri )THEN
2163 a( j, i ) = zero
2164 END IF
2165 END IF
2166 END IF
2167 10 CONTINUE
2168 IF( tri )
2169 $ a( j, j ) = a( j, j ) + one
2170 IF( unit )
2171 $ a( j, j ) = one
2172 20 CONTINUE
2173
2174
2175
2176 IF( type.EQ.'GE' )THEN
2177 DO 50 j = 1, n
2178 DO 30 i = 1, m
2179 aa( i + ( j - 1 )*lda ) = a( i, j )
2180 30 CONTINUE
2181 DO 40 i = m + 1, lda
2182 aa( i + ( j - 1 )*lda ) = rogue
2183 40 CONTINUE
2184 50 CONTINUE
2185 ELSE IF( type.EQ.'SY'.OR.type.EQ.'TR' )THEN
2186 DO 90 j = 1, n
2187 IF( upper )THEN
2188 ibeg = 1
2189 IF( unit )THEN
2190 iend = j - 1
2191 ELSE
2192 iend = j
2193 END IF
2194 ELSE
2195 IF( unit )THEN
2196 ibeg = j + 1
2197 ELSE
2198 ibeg = j
2199 END IF
2200 iend = n
2201 END IF
2202 DO 60 i = 1, ibeg - 1
2203 aa( i + ( j - 1 )*lda ) = rogue
2204 60 CONTINUE
2205 DO 70 i = ibeg, iend
2206 aa( i + ( j - 1 )*lda ) = a( i, j )
2207 70 CONTINUE
2208 DO 80 i = iend + 1, lda
2209 aa( i + ( j - 1 )*lda ) = rogue
2210 80 CONTINUE
2211 90 CONTINUE
2212 END IF
2213 RETURN
2214
2215
2216
real function sbeg(reset)