| 1 |
/* ./util_f77/icopy.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 |
|
| 8 |
/* -------------------------------------------------------------------- */ |
| 9 |
/* \Documentation */ |
| 10 |
|
| 11 |
/* \Name: ICOPY */ |
| 12 |
|
| 13 |
/* \Description: */ |
| 14 |
/* ICOPY copies an integer vector lx to an integer vector ly. */ |
| 15 |
|
| 16 |
/* \Usage: */ |
| 17 |
/* call icopy ( n, lx, inc, ly, incy ) */ |
| 18 |
|
| 19 |
/* \Arguments: */ |
| 20 |
/* n integer (input) */ |
| 21 |
/* On entry, n is the number of elements of lx to be */ |
| 22 |
/* copied to ly. */ |
| 23 |
|
| 24 |
/* lx integer array (input) */ |
| 25 |
/* On entry, lx is the integer vector to be copied. */ |
| 26 |
|
| 27 |
/* incx integer (input) */ |
| 28 |
/* On entry, incx is the increment between elements of lx. */ |
| 29 |
|
| 30 |
/* ly integer array (input) */ |
| 31 |
/* On exit, ly is the integer vector that contains the */ |
| 32 |
/* copy of lx. */ |
| 33 |
|
| 34 |
/* incy integer (input) */ |
| 35 |
/* On entry, incy is the increment between elements of ly. */ |
| 36 |
|
| 37 |
/* \Enddoc */ |
| 38 |
|
| 39 |
/* -------------------------------------------------------------------- */ |
| 40 |
|
| 41 |
/* Subroutine */ int icopy_(integer *n, integer *lx, integer *incx, integer * |
| 42 |
ly, integer *incy) |
| 43 |
{ |
| 44 |
/* System generated locals */ |
| 45 |
integer i__1; |
| 46 |
|
| 47 |
/* Local variables */ |
| 48 |
static integer i__, ix, iy; |
| 49 |
|
| 50 |
|
| 51 |
/* ---------------------------- */ |
| 52 |
/* Specifications for arguments */ |
| 53 |
/* ---------------------------- */ |
| 54 |
|
| 55 |
/* ---------------------------------- */ |
| 56 |
/* Specifications for local variables */ |
| 57 |
/* ---------------------------------- */ |
| 58 |
|
| 59 |
/* -------------------------- */ |
| 60 |
/* First executable statement */ |
| 61 |
/* -------------------------- */ |
| 62 |
/* Parameter adjustments */ |
| 63 |
--ly; |
| 64 |
--lx; |
| 65 |
|
| 66 |
/* Function Body */ |
| 67 |
if (*n <= 0) { |
| 68 |
return 0; |
| 69 |
} |
| 70 |
if (*incx == 1 && *incy == 1) { |
| 71 |
goto L20; |
| 72 |
} |
| 73 |
|
| 74 |
/* .....code for unequal increments or equal increments */ |
| 75 |
/* not equal to 1 */ |
| 76 |
ix = 1; |
| 77 |
iy = 1; |
| 78 |
if (*incx < 0) { |
| 79 |
ix = (-(*n) + 1) * *incx + 1; |
| 80 |
} |
| 81 |
if (*incy < 0) { |
| 82 |
iy = (-(*n) + 1) * *incy + 1; |
| 83 |
} |
| 84 |
i__1 = *n; |
| 85 |
for (i__ = 1; i__ <= i__1; ++i__) { |
| 86 |
ly[iy] = lx[ix]; |
| 87 |
ix += *incx; |
| 88 |
iy += *incy; |
| 89 |
/* L10: */ |
| 90 |
} |
| 91 |
return 0; |
| 92 |
|
| 93 |
/* .....code for both increments equal to 1 */ |
| 94 |
|
| 95 |
L20: |
| 96 |
i__1 = *n; |
| 97 |
for (i__ = 1; i__ <= i__1; ++i__) { |
| 98 |
ly[i__] = lx[i__]; |
| 99 |
/* L30: */ |
| 100 |
} |
| 101 |
return 0; |
| 102 |
} /* icopy_ */ |
| 103 |
|