01:       SUBROUTINE CLACP2( UPLO, M, N, A, LDA, B, LDB )
02: *
03: *  -- LAPACK auxiliary routine (version 3.2) --
04: *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
05: *     November 2006
06: *
07: *     .. Scalar Arguments ..
08:       CHARACTER          UPLO
09:       INTEGER            LDA, LDB, M, N
10: *     ..
11: *     .. Array Arguments ..
12:       REAL               A( LDA, * )
13:       COMPLEX            B( LDB, * )
14: *     ..
15: *
16: *  Purpose
17: *  =======
18: *
19: *  CLACP2 copies all or part of a real two-dimensional matrix A to a
20: *  complex matrix B.
21: *
22: *  Arguments
23: *  =========
24: *
25: *  UPLO    (input) CHARACTER*1
26: *          Specifies the part of the matrix A to be copied to B.
27: *          = 'U':      Upper triangular part
28: *          = 'L':      Lower triangular part
29: *          Otherwise:  All of the matrix A
30: *
31: *  M       (input) INTEGER
32: *          The number of rows of the matrix A.  M >= 0.
33: *
34: *  N       (input) INTEGER
35: *          The number of columns of the matrix A.  N >= 0.
36: *
37: *  A       (input) REAL array, dimension (LDA,N)
38: *          The m by n matrix A.  If UPLO = 'U', only the upper trapezium
39: *          is accessed; if UPLO = 'L', only the lower trapezium is
40: *          accessed.
41: *
42: *  LDA     (input) INTEGER
43: *          The leading dimension of the array A.  LDA >= max(1,M).
44: *
45: *  B       (output) COMPLEX array, dimension (LDB,N)
46: *          On exit, B = A in the locations specified by UPLO.
47: *
48: *  LDB     (input) INTEGER
49: *          The leading dimension of the array B.  LDB >= max(1,M).
50: *
51: *  =====================================================================
52: *
53: *     .. Local Scalars ..
54:       INTEGER            I, J
55: *     ..
56: *     .. External Functions ..
57:       LOGICAL            LSAME
58:       EXTERNAL           LSAME
59: *     ..
60: *     .. Intrinsic Functions ..
61:       INTRINSIC          MIN
62: *     ..
63: *     .. Executable Statements ..
64: *
65:       IF( LSAME( UPLO, 'U' ) ) THEN
66:          DO 20 J = 1, N
67:             DO 10 I = 1, MIN( J, M )
68:                B( I, J ) = A( I, J )
69:    10       CONTINUE
70:    20    CONTINUE
71: *
72:       ELSE IF( LSAME( UPLO, 'L' ) ) THEN
73:          DO 40 J = 1, N
74:             DO 30 I = J, M
75:                B( I, J ) = A( I, J )
76:    30       CONTINUE
77:    40    CONTINUE
78: *
79:       ELSE
80:          DO 60 J = 1, N
81:             DO 50 I = 1, M
82:                B( I, J ) = A( I, J )
83:    50       CONTINUE
84:    60    CONTINUE
85:       END IF
86: *
87:       RETURN
88: *
89: *     End of CLACP2
90: *
91:       END
92: