File: icopy.f

package info (click to toggle)
python-scipy 0.18.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 75,464 kB
  • ctags: 79,406
  • sloc: python: 143,495; cpp: 89,357; fortran: 81,650; ansic: 79,778; makefile: 364; sh: 265
file content (77 lines) | stat: -rw-r--r-- 1,949 bytes parent folder | download | duplicates (37)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
*--------------------------------------------------------------------
*\Documentation
*
*\Name: ICOPY
*
*\Description:
*     ICOPY copies an integer vector lx to an integer vector ly.
*
*\Usage:
*     call icopy ( n, lx, inc, ly, incy )
*
*\Arguments:
*    n        integer (input)
*             On entry, n is the number of elements of lx to be
c             copied to ly.
*
*    lx       integer array (input)
*             On entry, lx is the integer vector to be copied.
*
*    incx     integer (input)
*             On entry, incx is the increment between elements of lx.
*
*    ly       integer array (input)
*             On exit, ly is the integer vector that contains the
*             copy of lx.
*
*    incy     integer (input)
*             On entry, incy is the increment between elements of ly.
*
*\Enddoc
*
*--------------------------------------------------------------------
*
      subroutine icopy( n, lx, incx, ly, incy )
*
*     ----------------------------
*     Specifications for arguments
*     ----------------------------
      integer    incx, incy, n
      integer    lx( 1 ), ly( 1 )
*
*     ----------------------------------
*     Specifications for local variables
*     ----------------------------------
      integer           i, ix, iy
*
*     --------------------------
*     First executable statement
*     --------------------------
      if( n.le.0 )
     $   return
      if( incx.eq.1 .and. incy.eq.1 )
     $   go to 20
c
c.....code for unequal increments or equal increments
c     not equal to 1
      ix = 1
      iy = 1
      if( incx.lt.0 )
     $   ix = ( -n+1 )*incx + 1
      if( incy.lt.0 )
     $   iy = ( -n+1 )*incy + 1
      do 10 i = 1, n
         ly( iy ) = lx( ix )
         ix = ix + incx
         iy = iy + incy
   10 continue
      return
c
c.....code for both increments equal to 1
c
   20 continue
      do 30 i = 1, n
         ly( i ) = lx( i )
   30 continue
      return
      end