LAPACK 3.12.0 LAPACK: Linear Algebra PACKage
Searching...
No Matches

## ◆ strsm()

 subroutine strsm ( character side, character uplo, character transa, character diag, integer m, integer n, real alpha, real, dimension(lda,*) a, integer lda, real, dimension(ldb,*) b, integer ldb )

STRSM

Purpose:
``` STRSM  solves one of the matrix equations

op( A )*X = alpha*B,   or   X*op( A ) = alpha*B,

where alpha is a scalar, X and B are m by n matrices, A is a unit, or
non-unit,  upper or lower triangular matrix  and  op( A )  is one  of

op( A ) = A   or   op( A ) = A**T.

The matrix X is overwritten on B.```
Parameters
 [in] SIDE ``` SIDE is CHARACTER*1 On entry, SIDE specifies whether op( A ) appears on the left or right of X as follows: SIDE = 'L' or 'l' op( A )*X = alpha*B. SIDE = 'R' or 'r' X*op( A ) = alpha*B.``` [in] UPLO ``` UPLO is CHARACTER*1 On entry, UPLO specifies whether the matrix A is an upper or lower triangular matrix as follows: UPLO = 'U' or 'u' A is an upper triangular matrix. UPLO = 'L' or 'l' A is a lower triangular matrix.``` [in] TRANSA ``` TRANSA is CHARACTER*1 On entry, TRANSA specifies the form of op( A ) to be used in the matrix multiplication as follows: TRANSA = 'N' or 'n' op( A ) = A. TRANSA = 'T' or 't' op( A ) = A**T. TRANSA = 'C' or 'c' op( A ) = A**T.``` [in] DIAG ``` DIAG is CHARACTER*1 On entry, DIAG specifies whether or not A is unit triangular as follows: DIAG = 'U' or 'u' A is assumed to be unit triangular. DIAG = 'N' or 'n' A is not assumed to be unit triangular.``` [in] M ``` M is INTEGER On entry, M specifies the number of rows of B. M must be at least zero.``` [in] N ``` N is INTEGER On entry, N specifies the number of columns of B. N must be at least zero.``` [in] ALPHA ``` ALPHA is REAL On entry, ALPHA specifies the scalar alpha. When alpha is zero then A is not referenced and B need not be set before entry.``` [in] A ``` A is REAL array, dimension ( LDA, k ), where k is m when SIDE = 'L' or 'l' and k is n when SIDE = 'R' or 'r'. Before entry with UPLO = 'U' or 'u', the leading k by k upper triangular part of the array A must contain the upper triangular matrix and the strictly lower triangular part of A is not referenced. Before entry with UPLO = 'L' or 'l', the leading k by k lower triangular part of the array A must contain the lower triangular matrix and the strictly upper triangular part of A is not referenced. Note that when DIAG = 'U' or 'u', the diagonal elements of A are not referenced either, but are assumed to be unity.``` [in] LDA ``` LDA is INTEGER On entry, LDA specifies the first dimension of A as declared in the calling (sub) program. When SIDE = 'L' or 'l' then LDA must be at least max( 1, m ), when SIDE = 'R' or 'r' then LDA must be at least max( 1, n ).``` [in,out] B ``` B is REAL array, dimension ( LDB, N ) Before entry, the leading m by n part of the array B must contain the right-hand side matrix B, and on exit is overwritten by the solution matrix X.``` [in] LDB ``` LDB is INTEGER On entry, LDB specifies the first dimension of B as declared in the calling (sub) program. LDB must be at least max( 1, m ).```
Further Details:
```  Level 3 Blas routine.

-- Written on 8-February-1989.
Jack Dongarra, Argonne National Laboratory.
Iain Duff, AERE Harwell.
Jeremy Du Croz, Numerical Algorithms Group Ltd.
Sven Hammarling, Numerical Algorithms Group Ltd.```

Definition at line 180 of file strsm.f.

181*
182* -- Reference BLAS level3 routine --
183* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
184* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
185*
186* .. Scalar Arguments ..
187 REAL ALPHA
188 INTEGER LDA,LDB,M,N
189 CHARACTER DIAG,SIDE,TRANSA,UPLO
190* ..
191* .. Array Arguments ..
192 REAL A(LDA,*),B(LDB,*)
193* ..
194*
195* =====================================================================
196*
197* .. External Functions ..
198 LOGICAL LSAME
199 EXTERNAL lsame
200* ..
201* .. External Subroutines ..
202 EXTERNAL xerbla
203* ..
204* .. Intrinsic Functions ..
205 INTRINSIC max
206* ..
207* .. Local Scalars ..
208 REAL TEMP
209 INTEGER I,INFO,J,K,NROWA
210 LOGICAL LSIDE,NOUNIT,UPPER
211* ..
212* .. Parameters ..
213 REAL ONE,ZERO
214 parameter(one=1.0e+0,zero=0.0e+0)
215* ..
216*
217* Test the input parameters.
218*
219 lside = lsame(side,'L')
220 IF (lside) THEN
221 nrowa = m
222 ELSE
223 nrowa = n
224 END IF
225 nounit = lsame(diag,'N')
226 upper = lsame(uplo,'U')
227*
228 info = 0
229 IF ((.NOT.lside) .AND. (.NOT.lsame(side,'R'))) THEN
230 info = 1
231 ELSE IF ((.NOT.upper) .AND. (.NOT.lsame(uplo,'L'))) THEN
232 info = 2
233 ELSE IF ((.NOT.lsame(transa,'N')) .AND.
234 + (.NOT.lsame(transa,'T')) .AND.
235 + (.NOT.lsame(transa,'C'))) THEN
236 info = 3
237 ELSE IF ((.NOT.lsame(diag,'U')) .AND.
238 + (.NOT.lsame(diag,'N'))) THEN
239 info = 4
240 ELSE IF (m.LT.0) THEN
241 info = 5
242 ELSE IF (n.LT.0) THEN
243 info = 6
244 ELSE IF (lda.LT.max(1,nrowa)) THEN
245 info = 9
246 ELSE IF (ldb.LT.max(1,m)) THEN
247 info = 11
248 END IF
249 IF (info.NE.0) THEN
250 CALL xerbla('STRSM ',info)
251 RETURN
252 END IF
253*
254* Quick return if possible.
255*
256 IF (m.EQ.0 .OR. n.EQ.0) RETURN
257*
258* And when alpha.eq.zero.
259*
260 IF (alpha.EQ.zero) THEN
261 DO 20 j = 1,n
262 DO 10 i = 1,m
263 b(i,j) = zero
264 10 CONTINUE
265 20 CONTINUE
266 RETURN
267 END IF
268*
269* Start the operations.
270*
271 IF (lside) THEN
272 IF (lsame(transa,'N')) THEN
273*
274* Form B := alpha*inv( A )*B.
275*
276 IF (upper) THEN
277 DO 60 j = 1,n
278 IF (alpha.NE.one) THEN
279 DO 30 i = 1,m
280 b(i,j) = alpha*b(i,j)
281 30 CONTINUE
282 END IF
283 DO 50 k = m,1,-1
284 IF (b(k,j).NE.zero) THEN
285 IF (nounit) b(k,j) = b(k,j)/a(k,k)
286 DO 40 i = 1,k - 1
287 b(i,j) = b(i,j) - b(k,j)*a(i,k)
288 40 CONTINUE
289 END IF
290 50 CONTINUE
291 60 CONTINUE
292 ELSE
293 DO 100 j = 1,n
294 IF (alpha.NE.one) THEN
295 DO 70 i = 1,m
296 b(i,j) = alpha*b(i,j)
297 70 CONTINUE
298 END IF
299 DO 90 k = 1,m
300 IF (b(k,j).NE.zero) THEN
301 IF (nounit) b(k,j) = b(k,j)/a(k,k)
302 DO 80 i = k + 1,m
303 b(i,j) = b(i,j) - b(k,j)*a(i,k)
304 80 CONTINUE
305 END IF
306 90 CONTINUE
307 100 CONTINUE
308 END IF
309 ELSE
310*
311* Form B := alpha*inv( A**T )*B.
312*
313 IF (upper) THEN
314 DO 130 j = 1,n
315 DO 120 i = 1,m
316 temp = alpha*b(i,j)
317 DO 110 k = 1,i - 1
318 temp = temp - a(k,i)*b(k,j)
319 110 CONTINUE
320 IF (nounit) temp = temp/a(i,i)
321 b(i,j) = temp
322 120 CONTINUE
323 130 CONTINUE
324 ELSE
325 DO 160 j = 1,n
326 DO 150 i = m,1,-1
327 temp = alpha*b(i,j)
328 DO 140 k = i + 1,m
329 temp = temp - a(k,i)*b(k,j)
330 140 CONTINUE
331 IF (nounit) temp = temp/a(i,i)
332 b(i,j) = temp
333 150 CONTINUE
334 160 CONTINUE
335 END IF
336 END IF
337 ELSE
338 IF (lsame(transa,'N')) THEN
339*
340* Form B := alpha*B*inv( A ).
341*
342 IF (upper) THEN
343 DO 210 j = 1,n
344 IF (alpha.NE.one) THEN
345 DO 170 i = 1,m
346 b(i,j) = alpha*b(i,j)
347 170 CONTINUE
348 END IF
349 DO 190 k = 1,j - 1
350 IF (a(k,j).NE.zero) THEN
351 DO 180 i = 1,m
352 b(i,j) = b(i,j) - a(k,j)*b(i,k)
353 180 CONTINUE
354 END IF
355 190 CONTINUE
356 IF (nounit) THEN
357 temp = one/a(j,j)
358 DO 200 i = 1,m
359 b(i,j) = temp*b(i,j)
360 200 CONTINUE
361 END IF
362 210 CONTINUE
363 ELSE
364 DO 260 j = n,1,-1
365 IF (alpha.NE.one) THEN
366 DO 220 i = 1,m
367 b(i,j) = alpha*b(i,j)
368 220 CONTINUE
369 END IF
370 DO 240 k = j + 1,n
371 IF (a(k,j).NE.zero) THEN
372 DO 230 i = 1,m
373 b(i,j) = b(i,j) - a(k,j)*b(i,k)
374 230 CONTINUE
375 END IF
376 240 CONTINUE
377 IF (nounit) THEN
378 temp = one/a(j,j)
379 DO 250 i = 1,m
380 b(i,j) = temp*b(i,j)
381 250 CONTINUE
382 END IF
383 260 CONTINUE
384 END IF
385 ELSE
386*
387* Form B := alpha*B*inv( A**T ).
388*
389 IF (upper) THEN
390 DO 310 k = n,1,-1
391 IF (nounit) THEN
392 temp = one/a(k,k)
393 DO 270 i = 1,m
394 b(i,k) = temp*b(i,k)
395 270 CONTINUE
396 END IF
397 DO 290 j = 1,k - 1
398 IF (a(j,k).NE.zero) THEN
399 temp = a(j,k)
400 DO 280 i = 1,m
401 b(i,j) = b(i,j) - temp*b(i,k)
402 280 CONTINUE
403 END IF
404 290 CONTINUE
405 IF (alpha.NE.one) THEN
406 DO 300 i = 1,m
407 b(i,k) = alpha*b(i,k)
408 300 CONTINUE
409 END IF
410 310 CONTINUE
411 ELSE
412 DO 360 k = 1,n
413 IF (nounit) THEN
414 temp = one/a(k,k)
415 DO 320 i = 1,m
416 b(i,k) = temp*b(i,k)
417 320 CONTINUE
418 END IF
419 DO 340 j = k + 1,n
420 IF (a(j,k).NE.zero) THEN
421 temp = a(j,k)
422 DO 330 i = 1,m
423 b(i,j) = b(i,j) - temp*b(i,k)
424 330 CONTINUE
425 END IF
426 340 CONTINUE
427 IF (alpha.NE.one) THEN
428 DO 350 i = 1,m
429 b(i,k) = alpha*b(i,k)
430 350 CONTINUE
431 END IF
432 360 CONTINUE
433 END IF
434 END IF
435 END IF
436*
437 RETURN
438*
439* End of STRSM
440*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the call graph for this function:
Here is the caller graph for this function: