LAPACK 3.3.1
Linear Algebra PACKage

icopy.f

Go to the documentation of this file.
00001       SUBROUTINE ICOPY( N, SX, INCX, SY, INCY )
00002 *
00003 *  -- LAPACK auxiliary test routine (version 3.1) --
00004 *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
00005 *     November 2006
00006 *
00007 *     .. Scalar Arguments ..
00008       INTEGER            INCX, INCY, N
00009 *     ..
00010 *     .. Array Arguments ..
00011       INTEGER            SX( * ), SY( * )
00012 *     ..
00013 *
00014 *  Purpose
00015 *  =======
00016 *
00017 *  ICOPY copies an integer vector x to an integer vector y.
00018 *  Uses unrolled loops for increments equal to 1.
00019 *
00020 *  Arguments
00021 *  =========
00022 *
00023 *  N       (input) INTEGER
00024 *          The length of the vectors SX and SY.
00025 *
00026 *  SX      (input) INTEGER array, dimension (1+(N-1)*abs(INCX))
00027 *          The vector X.
00028 *
00029 *  INCX    (input) INTEGER
00030 *          The spacing between consecutive elements of SX.
00031 *
00032 *  SY      (output) INTEGER array, dimension (1+(N-1)*abs(INCY))
00033 *          The vector Y.
00034 *
00035 *  INCY    (input) INTEGER
00036 *          The spacing between consecutive elements of SY.
00037 *
00038 *  =====================================================================
00039 *
00040 *     .. Local Scalars ..
00041       INTEGER            I, IX, IY, M, MP1
00042 *     ..
00043 *     .. Intrinsic Functions ..
00044       INTRINSIC          MOD
00045 *     ..
00046 *     .. Executable Statements ..
00047 *
00048       IF( N.LE.0 )
00049      $   RETURN
00050       IF( INCX.EQ.1 .AND. INCY.EQ.1 )
00051      $   GO TO 20
00052 *
00053 *     Code for unequal increments or equal increments not equal to 1
00054 *
00055       IX = 1
00056       IY = 1
00057       IF( INCX.LT.0 )
00058      $   IX = ( -N+1 )*INCX + 1
00059       IF( INCY.LT.0 )
00060      $   IY = ( -N+1 )*INCY + 1
00061       DO 10 I = 1, N
00062          SY( IY ) = SX( IX )
00063          IX = IX + INCX
00064          IY = IY + INCY
00065    10 CONTINUE
00066       RETURN
00067 *
00068 *     Code for both increments equal to 1
00069 *
00070 *     Clean-up loop
00071 *
00072    20 CONTINUE
00073       M = MOD( N, 7 )
00074       IF( M.EQ.0 )
00075      $   GO TO 40
00076       DO 30 I = 1, M
00077          SY( I ) = SX( I )
00078    30 CONTINUE
00079       IF( N.LT.7 )
00080      $   RETURN
00081    40 CONTINUE
00082       MP1 = M + 1
00083       DO 50 I = MP1, N, 7
00084          SY( I ) = SX( I )
00085          SY( I+1 ) = SX( I+1 )
00086          SY( I+2 ) = SX( I+2 )
00087          SY( I+3 ) = SX( I+3 )
00088          SY( I+4 ) = SX( I+4 )
00089          SY( I+5 ) = SX( I+5 )
00090          SY( I+6 ) = SX( I+6 )
00091    50 CONTINUE
00092       RETURN
00093 *
00094 *     End of ICOPY
00095 *
00096       END
 All Files Functions