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