1 *> \brief \b CTFSM solves a matrix equation (one operand is a triangular matrix in RFP format).
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download CTFSM + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ctfsm.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ctfsm.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ctfsm.f">
21 * SUBROUTINE CTFSM( TRANSR, SIDE, UPLO, TRANS, DIAG, M, N, ALPHA, A,
24 * .. Scalar Arguments ..
25 * CHARACTER TRANSR, DIAG, SIDE, TRANS, UPLO
29 * .. Array Arguments ..
30 * COMPLEX A( 0: * ), B( 0: LDB-1, 0: * )
39 *> Level 3 BLAS like routine for A in RFP Format.
41 *> CTFSM solves the matrix equation
43 *> op( A )*X = alpha*B or X*op( A ) = alpha*B
45 *> where alpha is a scalar, X and B are m by n matrices, A is a unit, or
46 *> non-unit, upper or lower triangular matrix and op( A ) is one of
48 *> op( A ) = A or op( A ) = A**H.
50 *> A is in Rectangular Full Packed (RFP) Format.
52 *> The matrix X is overwritten on B.
60 *> TRANSR is CHARACTER*1
61 *> = 'N': The Normal Form of RFP A is stored;
62 *> = 'C': The Conjugate-transpose Form of RFP A is stored.
67 *> SIDE is CHARACTER*1
68 *> On entry, SIDE specifies whether op( A ) appears on the left
69 *> or right of X as follows:
71 *> SIDE = 'L' or 'l' op( A )*X = alpha*B.
73 *> SIDE = 'R' or 'r' X*op( A ) = alpha*B.
80 *> UPLO is CHARACTER*1
81 *> On entry, UPLO specifies whether the RFP matrix A came from
82 *> an upper or lower triangular matrix as follows:
83 *> UPLO = 'U' or 'u' RFP A came from an upper triangular matrix
84 *> UPLO = 'L' or 'l' RFP A came from a lower triangular matrix
91 *> TRANS is CHARACTER*1
92 *> On entry, TRANS specifies the form of op( A ) to be used
93 *> in the matrix multiplication as follows:
95 *> TRANS = 'N' or 'n' op( A ) = A.
97 *> TRANS = 'C' or 'c' op( A ) = conjg( A' ).
104 *> DIAG is CHARACTER*1
105 *> On entry, DIAG specifies whether or not RFP A is unit
106 *> triangular as follows:
108 *> DIAG = 'U' or 'u' A is assumed to be unit triangular.
110 *> DIAG = 'N' or 'n' A is not assumed to be unit
113 *> Unchanged on exit.
119 *> On entry, M specifies the number of rows of B. M must be at
121 *> Unchanged on exit.
127 *> On entry, N specifies the number of columns of B. N must be
129 *> Unchanged on exit.
135 *> On entry, ALPHA specifies the scalar alpha. When alpha is
136 *> zero then A is not referenced and B need not be set before
138 *> Unchanged on exit.
143 *> A is COMPLEX array, dimension (N*(N+1)/2)
144 *> NT = N*(N+1)/2. On entry, the matrix A in RFP Format.
145 *> RFP Format is described by TRANSR, UPLO and N as follows:
146 *> If TRANSR='N' then RFP A is (0:N,0:K-1) when N is even;
147 *> K=N/2. RFP A is (0:N-1,0:K) when N is odd; K=N/2. If
148 *> TRANSR = 'C' then RFP is the Conjugate-transpose of RFP A as
149 *> defined when TRANSR = 'N'. The contents of RFP A are defined
150 *> by UPLO as follows: If UPLO = 'U' the RFP A contains the NT
151 *> elements of upper packed A either in normal or
152 *> conjugate-transpose Format. If UPLO = 'L' the RFP A contains
153 *> the NT elements of lower packed A either in normal or
154 *> conjugate-transpose Format. The LDA of RFP A is (N+1)/2 when
155 *> TRANSR = 'C'. When TRANSR is 'N' the LDA is N+1 when N is
156 *> even and is N when is odd.
157 *> See the Note below for more details. Unchanged on exit.
162 *> B is COMPLEX array, dimension (LDB,N)
163 *> Before entry, the leading m by n part of the array B must
164 *> contain the right-hand side matrix B, and on exit is
165 *> overwritten by the solution matrix X.
171 *> On entry, LDB specifies the first dimension of B as declared
172 *> in the calling (sub) program. LDB must be at least
174 *> Unchanged on exit.
180 *> \author Univ. of Tennessee
181 *> \author Univ. of California Berkeley
182 *> \author Univ. of Colorado Denver
185 *> \date September 2012
187 *> \ingroup complexOTHERcomputational
189 *> \par Further Details:
190 * =====================
194 *> We first consider Standard Packed Format when N is even.
195 *> We give an example where N = 6.
197 *> AP is Upper AP is Lower
199 *> 00 01 02 03 04 05 00
200 *> 11 12 13 14 15 10 11
201 *> 22 23 24 25 20 21 22
202 *> 33 34 35 30 31 32 33
203 *> 44 45 40 41 42 43 44
204 *> 55 50 51 52 53 54 55
207 *> Let TRANSR = 'N'. RFP holds AP as follows:
208 *> For UPLO = 'U' the upper trapezoid A(0:5,0:2) consists of the last
209 *> three columns of AP upper. The lower triangle A(4:6,0:2) consists of
210 *> conjugate-transpose of the first three columns of AP upper.
211 *> For UPLO = 'L' the lower trapezoid A(1:6,0:2) consists of the first
212 *> three columns of AP lower. The upper triangle A(0:2,0:2) consists of
213 *> conjugate-transpose of the last three columns of AP lower.
214 *> To denote conjugate we place -- above the element. This covers the
215 *> case N even and TRANSR = 'N'.
234 *> Now let TRANSR = 'C'. RFP A in both UPLO cases is just the conjugate-
235 *> transpose of RFP A above. One therefore gets:
240 *> -- -- -- -- -- -- -- -- -- --
241 *> 03 13 23 33 00 01 02 33 00 10 20 30 40 50
242 *> -- -- -- -- -- -- -- -- -- --
243 *> 04 14 24 34 44 11 12 43 44 11 21 31 41 51
244 *> -- -- -- -- -- -- -- -- -- --
245 *> 05 15 25 35 45 55 22 53 54 55 22 32 42 52
248 *> We next consider Standard Packed Format when N is odd.
249 *> We give an example where N = 5.
251 *> AP is Upper AP is Lower
260 *> Let TRANSR = 'N'. RFP holds AP as follows:
261 *> For UPLO = 'U' the upper trapezoid A(0:4,0:2) consists of the last
262 *> three columns of AP upper. The lower triangle A(3:4,0:1) consists of
263 *> conjugate-transpose of the first two columns of AP upper.
264 *> For UPLO = 'L' the lower trapezoid A(0:4,0:2) consists of the first
265 *> three columns of AP lower. The upper triangle A(0:1,1:2) consists of
266 *> conjugate-transpose of the last two columns of AP lower.
267 *> To denote conjugate we place -- above the element. This covers the
268 *> case N odd and TRANSR = 'N'.
283 *> Now let TRANSR = 'C'. RFP A in both UPLO cases is just the conjugate-
284 *> transpose of RFP A above. One therefore gets:
289 *> -- -- -- -- -- -- -- -- --
290 *> 02 12 22 00 01 00 10 20 30 40 50
291 *> -- -- -- -- -- -- -- -- --
292 *> 03 13 23 33 11 33 11 21 31 41 51
293 *> -- -- -- -- -- -- -- -- --
294 *> 04 14 24 34 44 43 44 22 32 42 52
297 * =====================================================================
298 SUBROUTINE CTFSM( TRANSR, SIDE, UPLO, TRANS, DIAG, M, N, ALPHA, A,
301 * -- LAPACK computational routine (version 3.4.2) --
302 * -- LAPACK is a software package provided by Univ. of Tennessee, --
303 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
306 * .. Scalar Arguments ..
307 CHARACTER TRANSR, DIAG, SIDE, TRANS, UPLO
311 * .. Array Arguments ..
312 COMPLEX A( 0: * ), B( 0: LDB-1, 0: * )
315 * =====================================================================
319 PARAMETER ( CONE = ( 1.0E+0, 0.0E+0 ),
320 $ CZERO = ( 0.0E+0, 0.0E+0 ) )
322 * .. Local Scalars ..
323 LOGICAL LOWER, LSIDE, MISODD, NISODD, NORMALTRANSR,
325 INTEGER M1, M2, N1, N2, K, INFO, I, J
327 * .. External Functions ..
331 * .. External Subroutines ..
332 EXTERNAL XERBLA, CGEMM, CTRSM
334 * .. Intrinsic Functions ..
337 * .. Executable Statements ..
339 * Test the input parameters.
342 NORMALTRANSR = LSAME( TRANSR, 'N' )
343 LSIDE = LSAME( SIDE, 'L' )
344 LOWER = LSAME( UPLO, 'L' )
345 NOTRANS = LSAME( TRANS, 'N' )
346 IF( .NOT.NORMALTRANSR .AND. .NOT.LSAME( TRANSR, 'C' ) ) THEN
348 ELSE IF( .NOT.LSIDE .AND. .NOT.LSAME( SIDE, 'R' ) ) THEN
350 ELSE IF( .NOT.LOWER .AND. .NOT.LSAME( UPLO, 'U' ) ) THEN
352 ELSE IF( .NOT.NOTRANS .AND. .NOT.LSAME( TRANS, 'C' ) ) THEN
354 ELSE IF( .NOT.LSAME( DIAG, 'N' ) .AND. .NOT.LSAME( DIAG, 'U' ) )
357 ELSE IF( M.LT.0 ) THEN
359 ELSE IF( N.LT.0 ) THEN
361 ELSE IF( LDB.LT.MAX( 1, M ) ) THEN
365 CALL XERBLA( 'CTFSM ', -INFO )
369 * Quick return when ( (N.EQ.0).OR.(M.EQ.0) )
371 IF( ( M.EQ.0 ) .OR. ( N.EQ.0 ) )
374 * Quick return when ALPHA.EQ.(0E+0,0E+0)
376 IF( ALPHA.EQ.CZERO ) THEN
390 * If M is odd, set NISODD = .TRUE., and M1 and M2.
391 * If M is even, NISODD = .FALSE., and M.
393 IF( MOD( M, 2 ).EQ.0 ) THEN
409 * SIDE = 'L' and N is odd
411 IF( NORMALTRANSR ) THEN
413 * SIDE = 'L', N is odd, and TRANSR = 'N'
417 * SIDE ='L', N is odd, TRANSR = 'N', and UPLO = 'L'
421 * SIDE ='L', N is odd, TRANSR = 'N', UPLO = 'L', and
425 CALL CTRSM( 'L', 'L', 'N', DIAG, M1, N, ALPHA,
428 CALL CTRSM( 'L', 'L', 'N', DIAG, M1, N, ALPHA,
429 $ A( 0 ), M, B, LDB )
430 CALL CGEMM( 'N', 'N', M2, N, M1, -CONE, A( M1 ),
431 $ M, B, LDB, ALPHA, B( M1, 0 ), LDB )
432 CALL CTRSM( 'L', 'U', 'C', DIAG, M2, N, CONE,
433 $ A( M ), M, B( M1, 0 ), LDB )
438 * SIDE ='L', N is odd, TRANSR = 'N', UPLO = 'L', and
442 CALL CTRSM( 'L', 'L', 'C', DIAG, M1, N, ALPHA,
443 $ A( 0 ), M, B, LDB )
445 CALL CTRSM( 'L', 'U', 'N', DIAG, M2, N, ALPHA,
446 $ A( M ), M, B( M1, 0 ), LDB )
447 CALL CGEMM( 'C', 'N', M1, N, M2, -CONE, A( M1 ),
448 $ M, B( M1, 0 ), LDB, ALPHA, B, LDB )
449 CALL CTRSM( 'L', 'L', 'C', DIAG, M1, N, CONE,
450 $ A( 0 ), M, B, LDB )
457 * SIDE ='L', N is odd, TRANSR = 'N', and UPLO = 'U'
459 IF( .NOT.NOTRANS ) THEN
461 * SIDE ='L', N is odd, TRANSR = 'N', UPLO = 'U', and
464 CALL CTRSM( 'L', 'L', 'N', DIAG, M1, N, ALPHA,
465 $ A( M2 ), M, B, LDB )
466 CALL CGEMM( 'C', 'N', M2, N, M1, -CONE, A( 0 ), M,
467 $ B, LDB, ALPHA, B( M1, 0 ), LDB )
468 CALL CTRSM( 'L', 'U', 'C', DIAG, M2, N, CONE,
469 $ A( M1 ), M, B( M1, 0 ), LDB )
473 * SIDE ='L', N is odd, TRANSR = 'N', UPLO = 'U', and
476 CALL CTRSM( 'L', 'U', 'N', DIAG, M2, N, ALPHA,
477 $ A( M1 ), M, B( M1, 0 ), LDB )
478 CALL CGEMM( 'N', 'N', M1, N, M2, -CONE, A( 0 ), M,
479 $ B( M1, 0 ), LDB, ALPHA, B, LDB )
480 CALL CTRSM( 'L', 'L', 'C', DIAG, M1, N, CONE,
481 $ A( M2 ), M, B, LDB )
489 * SIDE = 'L', N is odd, and TRANSR = 'C'
493 * SIDE ='L', N is odd, TRANSR = 'C', and UPLO = 'L'
497 * SIDE ='L', N is odd, TRANSR = 'C', UPLO = 'L', and
501 CALL CTRSM( 'L', 'U', 'C', DIAG, M1, N, ALPHA,
502 $ A( 0 ), M1, B, LDB )
504 CALL CTRSM( 'L', 'U', 'C', DIAG, M1, N, ALPHA,
505 $ A( 0 ), M1, B, LDB )
506 CALL CGEMM( 'C', 'N', M2, N, M1, -CONE,
507 $ A( M1*M1 ), M1, B, LDB, ALPHA,
509 CALL CTRSM( 'L', 'L', 'N', DIAG, M2, N, CONE,
510 $ A( 1 ), M1, B( M1, 0 ), LDB )
515 * SIDE ='L', N is odd, TRANSR = 'C', UPLO = 'L', and
519 CALL CTRSM( 'L', 'U', 'N', DIAG, M1, N, ALPHA,
520 $ A( 0 ), M1, B, LDB )
522 CALL CTRSM( 'L', 'L', 'C', DIAG, M2, N, ALPHA,
523 $ A( 1 ), M1, B( M1, 0 ), LDB )
524 CALL CGEMM( 'N', 'N', M1, N, M2, -CONE,
525 $ A( M1*M1 ), M1, B( M1, 0 ), LDB,
527 CALL CTRSM( 'L', 'U', 'N', DIAG, M1, N, CONE,
528 $ A( 0 ), M1, B, LDB )
535 * SIDE ='L', N is odd, TRANSR = 'C', and UPLO = 'U'
537 IF( .NOT.NOTRANS ) THEN
539 * SIDE ='L', N is odd, TRANSR = 'C', UPLO = 'U', and
542 CALL CTRSM( 'L', 'U', 'C', DIAG, M1, N, ALPHA,
543 $ A( M2*M2 ), M2, B, LDB )
544 CALL CGEMM( 'N', 'N', M2, N, M1, -CONE, A( 0 ), M2,
545 $ B, LDB, ALPHA, B( M1, 0 ), LDB )
546 CALL CTRSM( 'L', 'L', 'N', DIAG, M2, N, CONE,
547 $ A( M1*M2 ), M2, B( M1, 0 ), LDB )
551 * SIDE ='L', N is odd, TRANSR = 'C', UPLO = 'U', and
554 CALL CTRSM( 'L', 'L', 'C', DIAG, M2, N, ALPHA,
555 $ A( M1*M2 ), M2, B( M1, 0 ), LDB )
556 CALL CGEMM( 'C', 'N', M1, N, M2, -CONE, A( 0 ), M2,
557 $ B( M1, 0 ), LDB, ALPHA, B, LDB )
558 CALL CTRSM( 'L', 'U', 'N', DIAG, M1, N, CONE,
559 $ A( M2*M2 ), M2, B, LDB )
569 * SIDE = 'L' and N is even
571 IF( NORMALTRANSR ) THEN
573 * SIDE = 'L', N is even, and TRANSR = 'N'
577 * SIDE ='L', N is even, TRANSR = 'N', and UPLO = 'L'
581 * SIDE ='L', N is even, TRANSR = 'N', UPLO = 'L',
584 CALL CTRSM( 'L', 'L', 'N', DIAG, K, N, ALPHA,
585 $ A( 1 ), M+1, B, LDB )
586 CALL CGEMM( 'N', 'N', K, N, K, -CONE, A( K+1 ),
587 $ M+1, B, LDB, ALPHA, B( K, 0 ), LDB )
588 CALL CTRSM( 'L', 'U', 'C', DIAG, K, N, CONE,
589 $ A( 0 ), M+1, B( K, 0 ), LDB )
593 * SIDE ='L', N is even, TRANSR = 'N', UPLO = 'L',
596 CALL CTRSM( 'L', 'U', 'N', DIAG, K, N, ALPHA,
597 $ A( 0 ), M+1, B( K, 0 ), LDB )
598 CALL CGEMM( 'C', 'N', K, N, K, -CONE, A( K+1 ),
599 $ M+1, B( K, 0 ), LDB, ALPHA, B, LDB )
600 CALL CTRSM( 'L', 'L', 'C', DIAG, K, N, CONE,
601 $ A( 1 ), M+1, B, LDB )
607 * SIDE ='L', N is even, TRANSR = 'N', and UPLO = 'U'
609 IF( .NOT.NOTRANS ) THEN
611 * SIDE ='L', N is even, TRANSR = 'N', UPLO = 'U',
614 CALL CTRSM( 'L', 'L', 'N', DIAG, K, N, ALPHA,
615 $ A( K+1 ), M+1, B, LDB )
616 CALL CGEMM( 'C', 'N', K, N, K, -CONE, A( 0 ), M+1,
617 $ B, LDB, ALPHA, B( K, 0 ), LDB )
618 CALL CTRSM( 'L', 'U', 'C', DIAG, K, N, CONE,
619 $ A( K ), M+1, B( K, 0 ), LDB )
623 * SIDE ='L', N is even, TRANSR = 'N', UPLO = 'U',
625 CALL CTRSM( 'L', 'U', 'N', DIAG, K, N, ALPHA,
626 $ A( K ), M+1, B( K, 0 ), LDB )
627 CALL CGEMM( 'N', 'N', K, N, K, -CONE, A( 0 ), M+1,
628 $ B( K, 0 ), LDB, ALPHA, B, LDB )
629 CALL CTRSM( 'L', 'L', 'C', DIAG, K, N, CONE,
630 $ A( K+1 ), M+1, B, LDB )
638 * SIDE = 'L', N is even, and TRANSR = 'C'
642 * SIDE ='L', N is even, TRANSR = 'C', and UPLO = 'L'
646 * SIDE ='L', N is even, TRANSR = 'C', UPLO = 'L',
649 CALL CTRSM( 'L', 'U', 'C', DIAG, K, N, ALPHA,
650 $ A( K ), K, B, LDB )
651 CALL CGEMM( 'C', 'N', K, N, K, -CONE,
652 $ A( K*( K+1 ) ), K, B, LDB, ALPHA,
654 CALL CTRSM( 'L', 'L', 'N', DIAG, K, N, CONE,
655 $ A( 0 ), K, B( K, 0 ), LDB )
659 * SIDE ='L', N is even, TRANSR = 'C', UPLO = 'L',
662 CALL CTRSM( 'L', 'L', 'C', DIAG, K, N, ALPHA,
663 $ A( 0 ), K, B( K, 0 ), LDB )
664 CALL CGEMM( 'N', 'N', K, N, K, -CONE,
665 $ A( K*( K+1 ) ), K, B( K, 0 ), LDB,
667 CALL CTRSM( 'L', 'U', 'N', DIAG, K, N, CONE,
668 $ A( K ), K, B, LDB )
674 * SIDE ='L', N is even, TRANSR = 'C', and UPLO = 'U'
676 IF( .NOT.NOTRANS ) THEN
678 * SIDE ='L', N is even, TRANSR = 'C', UPLO = 'U',
681 CALL CTRSM( 'L', 'U', 'C', DIAG, K, N, ALPHA,
682 $ A( K*( K+1 ) ), K, B, LDB )
683 CALL CGEMM( 'N', 'N', K, N, K, -CONE, A( 0 ), K, B,
684 $ LDB, ALPHA, B( K, 0 ), LDB )
685 CALL CTRSM( 'L', 'L', 'N', DIAG, K, N, CONE,
686 $ A( K*K ), K, B( K, 0 ), LDB )
690 * SIDE ='L', N is even, TRANSR = 'C', UPLO = 'U',
693 CALL CTRSM( 'L', 'L', 'C', DIAG, K, N, ALPHA,
694 $ A( K*K ), K, B( K, 0 ), LDB )
695 CALL CGEMM( 'C', 'N', K, N, K, -CONE, A( 0 ), K,
696 $ B( K, 0 ), LDB, ALPHA, B, LDB )
697 CALL CTRSM( 'L', 'U', 'N', DIAG, K, N, CONE,
698 $ A( K*( K+1 ) ), K, B, LDB )
713 * If N is odd, set NISODD = .TRUE., and N1 and N2.
714 * If N is even, NISODD = .FALSE., and K.
716 IF( MOD( N, 2 ).EQ.0 ) THEN
732 * SIDE = 'R' and N is odd
734 IF( NORMALTRANSR ) THEN
736 * SIDE = 'R', N is odd, and TRANSR = 'N'
740 * SIDE ='R', N is odd, TRANSR = 'N', and UPLO = 'L'
744 * SIDE ='R', N is odd, TRANSR = 'N', UPLO = 'L', and
747 CALL CTRSM( 'R', 'U', 'C', DIAG, M, N2, ALPHA,
748 $ A( N ), N, B( 0, N1 ), LDB )
749 CALL CGEMM( 'N', 'N', M, N1, N2, -CONE, B( 0, N1 ),
750 $ LDB, A( N1 ), N, ALPHA, B( 0, 0 ),
752 CALL CTRSM( 'R', 'L', 'N', DIAG, M, N1, CONE,
753 $ A( 0 ), N, B( 0, 0 ), LDB )
757 * SIDE ='R', N is odd, TRANSR = 'N', UPLO = 'L', and
760 CALL CTRSM( 'R', 'L', 'C', DIAG, M, N1, ALPHA,
761 $ A( 0 ), N, B( 0, 0 ), LDB )
762 CALL CGEMM( 'N', 'C', M, N2, N1, -CONE, B( 0, 0 ),
763 $ LDB, A( N1 ), N, ALPHA, B( 0, N1 ),
765 CALL CTRSM( 'R', 'U', 'N', DIAG, M, N2, CONE,
766 $ A( N ), N, B( 0, N1 ), LDB )
772 * SIDE ='R', N is odd, TRANSR = 'N', and UPLO = 'U'
776 * SIDE ='R', N is odd, TRANSR = 'N', UPLO = 'U', and
779 CALL CTRSM( 'R', 'L', 'C', DIAG, M, N1, ALPHA,
780 $ A( N2 ), N, B( 0, 0 ), LDB )
781 CALL CGEMM( 'N', 'N', M, N2, N1, -CONE, B( 0, 0 ),
782 $ LDB, A( 0 ), N, ALPHA, B( 0, N1 ),
784 CALL CTRSM( 'R', 'U', 'N', DIAG, M, N2, CONE,
785 $ A( N1 ), N, B( 0, N1 ), LDB )
789 * SIDE ='R', N is odd, TRANSR = 'N', UPLO = 'U', and
792 CALL CTRSM( 'R', 'U', 'C', DIAG, M, N2, ALPHA,
793 $ A( N1 ), N, B( 0, N1 ), LDB )
794 CALL CGEMM( 'N', 'C', M, N1, N2, -CONE, B( 0, N1 ),
795 $ LDB, A( 0 ), N, ALPHA, B( 0, 0 ), LDB )
796 CALL CTRSM( 'R', 'L', 'N', DIAG, M, N1, CONE,
797 $ A( N2 ), N, B( 0, 0 ), LDB )
805 * SIDE = 'R', N is odd, and TRANSR = 'C'
809 * SIDE ='R', N is odd, TRANSR = 'C', and UPLO = 'L'
813 * SIDE ='R', N is odd, TRANSR = 'C', UPLO = 'L', and
816 CALL CTRSM( 'R', 'L', 'N', DIAG, M, N2, ALPHA,
817 $ A( 1 ), N1, B( 0, N1 ), LDB )
818 CALL CGEMM( 'N', 'C', M, N1, N2, -CONE, B( 0, N1 ),
819 $ LDB, A( N1*N1 ), N1, ALPHA, B( 0, 0 ),
821 CALL CTRSM( 'R', 'U', 'C', DIAG, M, N1, CONE,
822 $ A( 0 ), N1, B( 0, 0 ), LDB )
826 * SIDE ='R', N is odd, TRANSR = 'C', UPLO = 'L', and
829 CALL CTRSM( 'R', 'U', 'N', DIAG, M, N1, ALPHA,
830 $ A( 0 ), N1, B( 0, 0 ), LDB )
831 CALL CGEMM( 'N', 'N', M, N2, N1, -CONE, B( 0, 0 ),
832 $ LDB, A( N1*N1 ), N1, ALPHA, B( 0, N1 ),
834 CALL CTRSM( 'R', 'L', 'C', DIAG, M, N2, CONE,
835 $ A( 1 ), N1, B( 0, N1 ), LDB )
841 * SIDE ='R', N is odd, TRANSR = 'C', and UPLO = 'U'
845 * SIDE ='R', N is odd, TRANSR = 'C', UPLO = 'U', and
848 CALL CTRSM( 'R', 'U', 'N', DIAG, M, N1, ALPHA,
849 $ A( N2*N2 ), N2, B( 0, 0 ), LDB )
850 CALL CGEMM( 'N', 'C', M, N2, N1, -CONE, B( 0, 0 ),
851 $ LDB, A( 0 ), N2, ALPHA, B( 0, N1 ),
853 CALL CTRSM( 'R', 'L', 'C', DIAG, M, N2, CONE,
854 $ A( N1*N2 ), N2, B( 0, N1 ), LDB )
858 * SIDE ='R', N is odd, TRANSR = 'C', UPLO = 'U', and
861 CALL CTRSM( 'R', 'L', 'N', DIAG, M, N2, ALPHA,
862 $ A( N1*N2 ), N2, B( 0, N1 ), LDB )
863 CALL CGEMM( 'N', 'N', M, N1, N2, -CONE, B( 0, N1 ),
864 $ LDB, A( 0 ), N2, ALPHA, B( 0, 0 ),
866 CALL CTRSM( 'R', 'U', 'C', DIAG, M, N1, CONE,
867 $ A( N2*N2 ), N2, B( 0, 0 ), LDB )
877 * SIDE = 'R' and N is even
879 IF( NORMALTRANSR ) THEN
881 * SIDE = 'R', N is even, and TRANSR = 'N'
885 * SIDE ='R', N is even, TRANSR = 'N', and UPLO = 'L'
889 * SIDE ='R', N is even, TRANSR = 'N', UPLO = 'L',
892 CALL CTRSM( 'R', 'U', 'C', DIAG, M, K, ALPHA,
893 $ A( 0 ), N+1, B( 0, K ), LDB )
894 CALL CGEMM( 'N', 'N', M, K, K, -CONE, B( 0, K ),
895 $ LDB, A( K+1 ), N+1, ALPHA, B( 0, 0 ),
897 CALL CTRSM( 'R', 'L', 'N', DIAG, M, K, CONE,
898 $ A( 1 ), N+1, B( 0, 0 ), LDB )
902 * SIDE ='R', N is even, TRANSR = 'N', UPLO = 'L',
905 CALL CTRSM( 'R', 'L', 'C', DIAG, M, K, ALPHA,
906 $ A( 1 ), N+1, B( 0, 0 ), LDB )
907 CALL CGEMM( 'N', 'C', M, K, K, -CONE, B( 0, 0 ),
908 $ LDB, A( K+1 ), N+1, ALPHA, B( 0, K ),
910 CALL CTRSM( 'R', 'U', 'N', DIAG, M, K, CONE,
911 $ A( 0 ), N+1, B( 0, K ), LDB )
917 * SIDE ='R', N is even, TRANSR = 'N', and UPLO = 'U'
921 * SIDE ='R', N is even, TRANSR = 'N', UPLO = 'U',
924 CALL CTRSM( 'R', 'L', 'C', DIAG, M, K, ALPHA,
925 $ A( K+1 ), N+1, B( 0, 0 ), LDB )
926 CALL CGEMM( 'N', 'N', M, K, K, -CONE, B( 0, 0 ),
927 $ LDB, A( 0 ), N+1, ALPHA, B( 0, K ),
929 CALL CTRSM( 'R', 'U', 'N', DIAG, M, K, CONE,
930 $ A( K ), N+1, B( 0, K ), LDB )
934 * SIDE ='R', N is even, TRANSR = 'N', UPLO = 'U',
937 CALL CTRSM( 'R', 'U', 'C', DIAG, M, K, ALPHA,
938 $ A( K ), N+1, B( 0, K ), LDB )
939 CALL CGEMM( 'N', 'C', M, K, K, -CONE, B( 0, K ),
940 $ LDB, A( 0 ), N+1, ALPHA, B( 0, 0 ),
942 CALL CTRSM( 'R', 'L', 'N', DIAG, M, K, CONE,
943 $ A( K+1 ), N+1, B( 0, 0 ), LDB )
951 * SIDE = 'R', N is even, and TRANSR = 'C'
955 * SIDE ='R', N is even, TRANSR = 'C', and UPLO = 'L'
959 * SIDE ='R', N is even, TRANSR = 'C', UPLO = 'L',
962 CALL CTRSM( 'R', 'L', 'N', DIAG, M, K, ALPHA,
963 $ A( 0 ), K, B( 0, K ), LDB )
964 CALL CGEMM( 'N', 'C', M, K, K, -CONE, B( 0, K ),
965 $ LDB, A( ( K+1 )*K ), K, ALPHA,
967 CALL CTRSM( 'R', 'U', 'C', DIAG, M, K, CONE,
968 $ A( K ), K, B( 0, 0 ), LDB )
972 * SIDE ='R', N is even, TRANSR = 'C', UPLO = 'L',
975 CALL CTRSM( 'R', 'U', 'N', DIAG, M, K, ALPHA,
976 $ A( K ), K, B( 0, 0 ), LDB )
977 CALL CGEMM( 'N', 'N', M, K, K, -CONE, B( 0, 0 ),
978 $ LDB, A( ( K+1 )*K ), K, ALPHA,
980 CALL CTRSM( 'R', 'L', 'C', DIAG, M, K, CONE,
981 $ A( 0 ), K, B( 0, K ), LDB )
987 * SIDE ='R', N is even, TRANSR = 'C', and UPLO = 'U'
991 * SIDE ='R', N is even, TRANSR = 'C', UPLO = 'U',
994 CALL CTRSM( 'R', 'U', 'N', DIAG, M, K, ALPHA,
995 $ A( ( K+1 )*K ), K, B( 0, 0 ), LDB )
996 CALL CGEMM( 'N', 'C', M, K, K, -CONE, B( 0, 0 ),
997 $ LDB, A( 0 ), K, ALPHA, B( 0, K ), LDB )
998 CALL CTRSM( 'R', 'L', 'C', DIAG, M, K, CONE,
999 $ A( K*K ), K, B( 0, K ), LDB )
1003 * SIDE ='R', N is even, TRANSR = 'C', UPLO = 'U',
1006 CALL CTRSM( 'R', 'L', 'N', DIAG, M, K, ALPHA,
1007 $ A( K*K ), K, B( 0, K ), LDB )
1008 CALL CGEMM( 'N', 'N', M, K, K, -CONE, B( 0, K ),
1009 $ LDB, A( 0 ), K, ALPHA, B( 0, 0 ), LDB )
1010 CALL CTRSM( 'R', 'U', 'C', DIAG, M, K, CONE,
1011 $ A( ( K+1 )*K ), K, B( 0, 0 ), LDB )