dcopy.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* dcopy.f -- translated by f2c (version 20061008).
  2. You must link the resulting object file with libf2c:
  3. on Microsoft Windows system, link with libf2c.lib;
  4. on Linux or Unix systems, link with .../path/to/libf2c.a -lm
  5. or, if you install libf2c.a in a standard place, with -lf2c -lm
  6. -- in that order, at the end of the command line, as in
  7. cc *.o -lf2c -lm
  8. Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
  9. http://www.netlib.org/f2c/libf2c.zip
  10. */
  11. #include "f2c.h"
  12. #include "blaswrap.h"
  13. /* Subroutine */ int dcopy_(integer *n, doublereal *dx, integer *incx,
  14. doublereal *dy, integer *incy)
  15. {
  16. /* System generated locals */
  17. integer i__1;
  18. /* Local variables */
  19. integer i__, m, ix, iy, mp1;
  20. /* .. Scalar Arguments .. */
  21. /* .. */
  22. /* .. Array Arguments .. */
  23. /* .. */
  24. /* Purpose */
  25. /* ======= */
  26. /* copies a vector, x, to a vector, y. */
  27. /* uses unrolled loops for increments equal to one. */
  28. /* jack dongarra, linpack, 3/11/78. */
  29. /* modified 12/3/93, array(1) declarations changed to array(*) */
  30. /* .. Local Scalars .. */
  31. /* .. */
  32. /* .. Intrinsic Functions .. */
  33. /* .. */
  34. /* Parameter adjustments */
  35. --dy;
  36. --dx;
  37. /* Function Body */
  38. if (*n <= 0) {
  39. return 0;
  40. }
  41. if (*incx == 1 && *incy == 1) {
  42. goto L20;
  43. }
  44. /* code for unequal increments or equal increments */
  45. /* not equal to 1 */
  46. ix = 1;
  47. iy = 1;
  48. if (*incx < 0) {
  49. ix = (-(*n) + 1) * *incx + 1;
  50. }
  51. if (*incy < 0) {
  52. iy = (-(*n) + 1) * *incy + 1;
  53. }
  54. i__1 = *n;
  55. for (i__ = 1; i__ <= i__1; ++i__) {
  56. dy[iy] = dx[ix];
  57. ix += *incx;
  58. iy += *incy;
  59. /* L10: */
  60. }
  61. return 0;
  62. /* code for both increments equal to 1 */
  63. /* clean-up loop */
  64. L20:
  65. m = *n % 7;
  66. if (m == 0) {
  67. goto L40;
  68. }
  69. i__1 = m;
  70. for (i__ = 1; i__ <= i__1; ++i__) {
  71. dy[i__] = dx[i__];
  72. /* L30: */
  73. }
  74. if (*n < 7) {
  75. return 0;
  76. }
  77. L40:
  78. mp1 = m + 1;
  79. i__1 = *n;
  80. for (i__ = mp1; i__ <= i__1; i__ += 7) {
  81. dy[i__] = dx[i__];
  82. dy[i__ + 1] = dx[i__ + 1];
  83. dy[i__ + 2] = dx[i__ + 2];
  84. dy[i__ + 3] = dx[i__ + 3];
  85. dy[i__ + 4] = dx[i__ + 4];
  86. dy[i__ + 5] = dx[i__ + 5];
  87. dy[i__ + 6] = dx[i__ + 6];
  88. /* L50: */
  89. }
  90. return 0;
  91. } /* dcopy_ */