001:       SUBROUTINE CORE_CSSSSM( M1, M2, NN, IB, K, A0, LDA0, A1, LDA1,
002:      $                       L0, LDL0, L1, LDL1, IPIV, INFO )
003: 
004: *********************************************************************
005: *     PLASMA core_blas routine (version 2.1.0)                      *
006: *     Author: Hatem Ltaief                                          *
007: *     Release Date: November, 15th 2009                             *
008: *     PLASMA is a software package provided by Univ. of Tennessee,  *
009: *     Univ. of California Berkeley and Univ. of Colorado Denver.    *
010: *********************************************************************
011: *
012: *     .. Scalar Arguments ..
013:       INTEGER            M1, M2, IB, NN, K
014:       INTEGER            LDL0, LDL1, LDA0, LDA1, INFO
015: *     ..
016: *     .. Array Arguments ..
017:       COMPLEX            A0( LDA0, * ), A1( LDA1, * )
018:       COMPLEX            L0( LDL0, * ), L1( LDL1, * )
019:       INTEGER            IPIV( * )
020: *     ..
021: *
022: *  Purpose
023: *  =======
024: *
025: *  CORE_CSSSSM applies the factor L computed by CORE_CTSTRF to a
026: *  complex matrix formed by coupling an M1-by-NN tile A0 on top
027: *  of a complex M2-by-NN tile A1.
028: *
029: *  Arguments
030: *  =========
031: *
032: *
033: *  M1      (input) INTEGER
034: *          The number of rows of the tile A0. M1 >= 0.
035: *
036: *  M2      (input) INTEGER
037: *          The number of rows of the tile A1. M2 >= 0.
038: *
039: *  NN      (input) INTEGER
040: *          The number of columns of the tiles A0 and A1. NN >= 0.
041: *
042: *  IB      (input) INTEGER
043: *          The inner-blocking size.  IB >= 0.
044: *
045: *  K       (input) INTEGER
046: *
047: *
048: *  A0      (input/output) COMPLEX array, dimension (LDA0,M1)
049: *          On entry, the M1-by-NN tile A0.
050: *          On exit, A0 is overwritten by the application of L.
051: *
052: *  LDA0    (input) INTEGER
053: *          The leading dimension of the tile A0. LDA0 >= max(1,M1).
054: *
055: *  A1      (input/output) COMPLEX array, dimension (LDA1,M2)
056: *          On entry, the M2-by-NN tile A1.
057: *          On exit, A1 is overwritten by the application of L.
058: *
059: *  LDA1    (input) INTEGER
060: *          The leading dimension of the tile A1. LDA1 >= max(1,M2).
061: *
062: *  L0      (input) COMPLEX array, dimension (LDL0,K)
063: *          The NB-by-NB lower triangular tile as returned by CORE_CTSTRF.
064: *
065: *  LDL0    (input) INTEGER
066: *          The leading dimension of the array L0. LDL0 >= max(1,K).
067: *
068: *  L1      (input) COMPLEX array, dimension (LDL1,NB)
069: *          The NB-by-NB tile as returned by CORE_CTSTRF.
070: *
071: *  LDL1    (input) INTEGER
072: *          The leading dimension of the array L1.  LDL1 >= max(1,NB).
073: *
074: *  IPIV    (input) INTEGER array, dimension (min(M,N))
075: *          as returned by CORE_CTSTRF.
076: *
077: *  INFO    (output) INTEGER
078: *          = 0: successful exit
079: *          < 0: if INFO = -k, the k-th argument had an illegal value
080: *
081: *  =====================================================================
082: *     ..
083: *     .. Internal variables ..
084:       INTEGER            II, I, IP, IM, SB
085: *     .. Parameters ..
086:       COMPLEX            CONE, MCONE
087:       PARAMETER          ( CONE = ( 1.0E+0, 0.0E+0 ) )
088:       PARAMETER          ( MCONE = ( -1.0E+0, 0.0E+0 ) )
089: *     ..
090: *     Test the input parameters.
091:       INFO = 0
092:       IF( M1.LT.0 ) THEN
093:          INFO = -1
094:       ELSE IF( M2.LT.0 ) THEN
095:          INFO = -2
096:       ELSE IF( NN.LT.0 ) THEN
097:          INFO = -3
098:       ELSE IF( IB.LT.0 ) THEN
099:          INFO = -4
100:       ELSE IF( K.LT.0 ) THEN
101:          INFO = -5
102:       END IF
103:       IF( INFO.NE.0 ) THEN
104:          CALL XERBLA( 'CORE_CSSSSM', -INFO )
105:          RETURN
106:       END IF
107: *
108: *     Quick return if possible.
109: *
110:       IF( M1.EQ.0 .OR. M2.EQ.0 .OR. NN.EQ.0 .OR. IB.EQ.0  .OR. K.EQ.0 )
111:      $   RETURN
112: *
113:       IP = 1
114: *
115:       DO 10 II = 1, K, IB
116:          SB = MIN( K-II+1, IB )
117:          DO 20 I = 1, IB
118: *
119:             IM = IPIV( IP )
120:             IF( IM.NE.II+I-1 ) THEN
121:                IM = IM - M1
122:                CALL CSWAP( NN, A0( II+I-1, 1 ), LDA0,
123:      $                    A1( IM, 1 ), LDA1 )
124:             END IF
125:             IP = IP+1
126: *
127:  20      CONTINUE
128:          CALL CTRSM( 'Left', 'Lower', 'Notranspose', 'Unit',
129:      $              SB, NN, CONE,
130:      $              L0( 1, II ), LDL0,
131:      $              A0( II, 1 ), LDA0 )
132: *
133:          CALL CGEMM( 'Notranspose', 'Notranspose',
134:      $              M2, NN, SB, MCONE,
135:      $              L1( 1, II ), LDL1,
136:      $              A0( II, 1 ), LDA0,
137:      $              CONE, A1, LDA1 )
138:      $
139:  10   CONTINUE
140: *
141:       RETURN
142: *
143: *     End of CORE_CSSSSM.
144: *
145:       END
146: