1 /* ./src_f77/clacpy.f -- translated by f2c (version 20030320).
2    You must link the resulting object file with the libraries:
3 	-lf2c -lm   (in that order)
4 */
5 
6 #include <punc/vf2c.h>
7 
clacpy_(char * uplo,integer * m,integer * n,complex * a,integer * lda,complex * b,integer * ldb,ftnlen uplo_len)8 /* Subroutine */ int clacpy_(char *uplo, integer *m, integer *n, complex *a,
9 	integer *lda, complex *b, integer *ldb, ftnlen uplo_len)
10 {
11     /* System generated locals */
12     integer a_dim1, a_offset, b_dim1, b_offset, i__1, i__2, i__3, i__4;
13 
14     /* Local variables */
15     static integer i__, j;
16     extern logical lsame_(char *, char *, ftnlen, ftnlen);
17 
18 
19 /*  -- LAPACK auxiliary routine (version 3.0) -- */
20 /*     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., */
21 /*     Courant Institute, Argonne National Lab, and Rice University */
22 /*     February 29, 1992 */
23 
24 /*     .. Scalar Arguments .. */
25 /*     .. */
26 /*     .. Array Arguments .. */
27 /*     .. */
28 
29 /*  Purpose */
30 /*  ======= */
31 
32 /*  CLACPY copies all or part of a two-dimensional matrix A to another */
33 /*  matrix B. */
34 
35 /*  Arguments */
36 /*  ========= */
37 
38 /*  UPLO    (input) CHARACTER*1 */
39 /*          Specifies the part of the matrix A to be copied to B. */
40 /*          = 'U':      Upper triangular part */
41 /*          = 'L':      Lower triangular part */
42 /*          Otherwise:  All of the matrix A */
43 
44 /*  M       (input) INTEGER */
45 /*          The number of rows of the matrix A.  M >= 0. */
46 
47 /*  N       (input) INTEGER */
48 /*          The number of columns of the matrix A.  N >= 0. */
49 
50 /*  A       (input) COMPLEX array, dimension (LDA,N) */
51 /*          The m by n matrix A.  If UPLO = 'U', only the upper trapezium */
52 /*          is accessed; if UPLO = 'L', only the lower trapezium is */
53 /*          accessed. */
54 
55 /*  LDA     (input) INTEGER */
56 /*          The leading dimension of the array A.  LDA >= max(1,M). */
57 
58 /*  B       (output) COMPLEX array, dimension (LDB,N) */
59 /*          On exit, B = A in the locations specified by UPLO. */
60 
61 /*  LDB     (input) INTEGER */
62 /*          The leading dimension of the array B.  LDB >= max(1,M). */
63 
64 /*  ===================================================================== */
65 
66 /*     .. Local Scalars .. */
67 /*     .. */
68 /*     .. External Functions .. */
69 /*     .. */
70 /*     .. Intrinsic Functions .. */
71 /*     .. */
72 /*     .. Executable Statements .. */
73 
74     /* Parameter adjustments */
75     a_dim1 = *lda;
76     a_offset = 1 + a_dim1;
77     a -= a_offset;
78     b_dim1 = *ldb;
79     b_offset = 1 + b_dim1;
80     b -= b_offset;
81 
82     /* Function Body */
83     if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) {
84 	i__1 = *n;
85 	for (j = 1; j <= i__1; ++j) {
86 	    i__2 = min(j,*m);
87 	    for (i__ = 1; i__ <= i__2; ++i__) {
88 		i__3 = i__ + j * b_dim1;
89 		i__4 = i__ + j * a_dim1;
90 		b[i__3].r = a[i__4].r, b[i__3].i = a[i__4].i;
91 /* L10: */
92 	    }
93 /* L20: */
94 	}
95 
96     } else if (lsame_(uplo, "L", (ftnlen)1, (ftnlen)1)) {
97 	i__1 = *n;
98 	for (j = 1; j <= i__1; ++j) {
99 	    i__2 = *m;
100 	    for (i__ = j; i__ <= i__2; ++i__) {
101 		i__3 = i__ + j * b_dim1;
102 		i__4 = i__ + j * a_dim1;
103 		b[i__3].r = a[i__4].r, b[i__3].i = a[i__4].i;
104 /* L30: */
105 	    }
106 /* L40: */
107 	}
108 
109     } else {
110 	i__1 = *n;
111 	for (j = 1; j <= i__1; ++j) {
112 	    i__2 = *m;
113 	    for (i__ = 1; i__ <= i__2; ++i__) {
114 		i__3 = i__ + j * b_dim1;
115 		i__4 = i__ + j * a_dim1;
116 		b[i__3].r = a[i__4].r, b[i__3].i = a[i__4].i;
117 /* L50: */
118 	    }
119 /* L60: */
120 	}
121     }
122 
123     return 0;
124 
125 /*     End of CLACPY */
126 
127 } /* clacpy_ */
128 
129