| 1 |
*-------------------------------------------------------------------- |
| 2 |
*\Documentation |
| 3 |
* |
| 4 |
*\Name: ICOPY |
| 5 |
* |
| 6 |
*\Description: |
| 7 |
* ICOPY copies an integer vector lx to an integer vector ly. |
| 8 |
* |
| 9 |
*\Usage: |
| 10 |
* call icopy ( n, lx, inc, ly, incy ) |
| 11 |
* |
| 12 |
*\Arguments: |
| 13 |
* n integer (input) |
| 14 |
* On entry, n is the number of elements of lx to be |
| 15 |
c copied to ly. |
| 16 |
* |
| 17 |
* lx integer array (input) |
| 18 |
* On entry, lx is the integer vector to be copied. |
| 19 |
* |
| 20 |
* incx integer (input) |
| 21 |
* On entry, incx is the increment between elements of lx. |
| 22 |
* |
| 23 |
* ly integer array (input) |
| 24 |
* On exit, ly is the integer vector that contains the |
| 25 |
* copy of lx. |
| 26 |
* |
| 27 |
* incy integer (input) |
| 28 |
* On entry, incy is the increment between elements of ly. |
| 29 |
* |
| 30 |
*\Enddoc |
| 31 |
* |
| 32 |
*-------------------------------------------------------------------- |
| 33 |
* |
| 34 |
subroutine icopy( n, lx, incx, ly, incy ) |
| 35 |
* |
| 36 |
* ---------------------------- |
| 37 |
* Specifications for arguments |
| 38 |
* ---------------------------- |
| 39 |
integer incx, incy, n |
| 40 |
integer lx( 1 ), ly( 1 ) |
| 41 |
* |
| 42 |
* ---------------------------------- |
| 43 |
* Specifications for local variables |
| 44 |
* ---------------------------------- |
| 45 |
integer i, ix, iy |
| 46 |
* |
| 47 |
* -------------------------- |
| 48 |
* First executable statement |
| 49 |
* -------------------------- |
| 50 |
if( n.le.0 ) |
| 51 |
$ return |
| 52 |
if( incx.eq.1 .and. incy.eq.1 ) |
| 53 |
$ go to 20 |
| 54 |
c |
| 55 |
c.....code for unequal increments or equal increments |
| 56 |
c not equal to 1 |
| 57 |
ix = 1 |
| 58 |
iy = 1 |
| 59 |
if( incx.lt.0 ) |
| 60 |
$ ix = ( -n+1 )*incx + 1 |
| 61 |
if( incy.lt.0 ) |
| 62 |
$ iy = ( -n+1 )*incy + 1 |
| 63 |
do 10 i = 1, n |
| 64 |
ly( iy ) = lx( ix ) |
| 65 |
ix = ix + incx |
| 66 |
iy = iy + incy |
| 67 |
10 continue |
| 68 |
return |
| 69 |
c |
| 70 |
c.....code for both increments equal to 1 |
| 71 |
c |
| 72 |
20 continue |
| 73 |
do 30 i = 1, n |
| 74 |
ly( i ) = lx( i ) |
| 75 |
30 continue |
| 76 |
return |
| 77 |
end |