Update to 2.0.0 tree from current Fremantle build
[opencv] / 3rdparty / lapack / slacpy.c
1 #include "clapack.h"
2
3 /* Subroutine */ int slacpy_(char *uplo, integer *m, integer *n, real *a, 
4         integer *lda, real *b, integer *ldb)
5 {
6     /* System generated locals */
7     integer a_dim1, a_offset, b_dim1, b_offset, i__1, i__2;
8
9     /* Local variables */
10     integer i__, j;
11     extern logical lsame_(char *, char *);
12
13
14 /*  -- LAPACK auxiliary routine (version 3.1) -- */
15 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
16 /*     November 2006 */
17
18 /*     .. Scalar Arguments .. */
19 /*     .. */
20 /*     .. Array Arguments .. */
21 /*     .. */
22
23 /*  Purpose */
24 /*  ======= */
25
26 /*  SLACPY copies all or part of a two-dimensional matrix A to another */
27 /*  matrix B. */
28
29 /*  Arguments */
30 /*  ========= */
31
32 /*  UPLO    (input) CHARACTER*1 */
33 /*          Specifies the part of the matrix A to be copied to B. */
34 /*          = 'U':      Upper triangular part */
35 /*          = 'L':      Lower triangular part */
36 /*          Otherwise:  All of the matrix A */
37
38 /*  M       (input) INTEGER */
39 /*          The number of rows of the matrix A.  M >= 0. */
40
41 /*  N       (input) INTEGER */
42 /*          The number of columns of the matrix A.  N >= 0. */
43
44 /*  A       (input) REAL array, dimension (LDA,N) */
45 /*          The m by n matrix A.  If UPLO = 'U', only the upper triangle */
46 /*          or trapezoid is accessed; if UPLO = 'L', only the lower */
47 /*          triangle or trapezoid is accessed. */
48
49 /*  LDA     (input) INTEGER */
50 /*          The leading dimension of the array A.  LDA >= max(1,M). */
51
52 /*  B       (output) REAL array, dimension (LDB,N) */
53 /*          On exit, B = A in the locations specified by UPLO. */
54
55 /*  LDB     (input) INTEGER */
56 /*          The leading dimension of the array B.  LDB >= max(1,M). */
57
58 /*  ===================================================================== */
59
60 /*     .. Local Scalars .. */
61 /*     .. */
62 /*     .. External Functions .. */
63 /*     .. */
64 /*     .. Intrinsic Functions .. */
65 /*     .. */
66 /*     .. Executable Statements .. */
67
68     /* Parameter adjustments */
69     a_dim1 = *lda;
70     a_offset = 1 + a_dim1;
71     a -= a_offset;
72     b_dim1 = *ldb;
73     b_offset = 1 + b_dim1;
74     b -= b_offset;
75
76     /* Function Body */
77     if (lsame_(uplo, "U")) {
78         i__1 = *n;
79         for (j = 1; j <= i__1; ++j) {
80             i__2 = min(j,*m);
81             for (i__ = 1; i__ <= i__2; ++i__) {
82                 b[i__ + j * b_dim1] = a[i__ + j * a_dim1];
83 /* L10: */
84             }
85 /* L20: */
86         }
87     } else if (lsame_(uplo, "L")) {
88         i__1 = *n;
89         for (j = 1; j <= i__1; ++j) {
90             i__2 = *m;
91             for (i__ = j; i__ <= i__2; ++i__) {
92                 b[i__ + j * b_dim1] = a[i__ + j * a_dim1];
93 /* L30: */
94             }
95 /* L40: */
96         }
97     } else {
98         i__1 = *n;
99         for (j = 1; j <= i__1; ++j) {
100             i__2 = *m;
101             for (i__ = 1; i__ <= i__2; ++i__) {
102                 b[i__ + j * b_dim1] = a[i__ + j * a_dim1];
103 /* L50: */
104             }
105 /* L60: */
106         }
107     }
108     return 0;
109
110 /*     End of SLACPY */
111
112 } /* slacpy_ */