zdotu.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /* zdotu.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. /* Double Complex */ VOID zdotu_(doublecomplex * ret_val, integer *n,
  14. doublecomplex *zx, integer *incx, doublecomplex *zy, integer *incy)
  15. {
  16. /* System generated locals */
  17. integer i__1, i__2, i__3;
  18. doublecomplex z__1, z__2;
  19. /* Local variables */
  20. integer i__, ix, iy;
  21. doublecomplex ztemp;
  22. /* .. Scalar Arguments .. */
  23. /* .. */
  24. /* .. Array Arguments .. */
  25. /* .. */
  26. /* Purpose */
  27. /* ======= */
  28. /* ZDOTU forms the dot product of two vectors. */
  29. /* Further Details */
  30. /* =============== */
  31. /* jack dongarra, 3/11/78. */
  32. /* modified 12/3/93, array(1) declarations changed to array(*) */
  33. /* .. Local Scalars .. */
  34. /* .. */
  35. /* Parameter adjustments */
  36. --zy;
  37. --zx;
  38. /* Function Body */
  39. ztemp.r = 0., ztemp.i = 0.;
  40. ret_val->r = 0., ret_val->i = 0.;
  41. if (*n <= 0) {
  42. return ;
  43. }
  44. if (*incx == 1 && *incy == 1) {
  45. goto L20;
  46. }
  47. /* code for unequal increments or equal increments */
  48. /* not equal to 1 */
  49. ix = 1;
  50. iy = 1;
  51. if (*incx < 0) {
  52. ix = (-(*n) + 1) * *incx + 1;
  53. }
  54. if (*incy < 0) {
  55. iy = (-(*n) + 1) * *incy + 1;
  56. }
  57. i__1 = *n;
  58. for (i__ = 1; i__ <= i__1; ++i__) {
  59. i__2 = ix;
  60. i__3 = iy;
  61. z__2.r = zx[i__2].r * zy[i__3].r - zx[i__2].i * zy[i__3].i, z__2.i =
  62. zx[i__2].r * zy[i__3].i + zx[i__2].i * zy[i__3].r;
  63. z__1.r = ztemp.r + z__2.r, z__1.i = ztemp.i + z__2.i;
  64. ztemp.r = z__1.r, ztemp.i = z__1.i;
  65. ix += *incx;
  66. iy += *incy;
  67. /* L10: */
  68. }
  69. ret_val->r = ztemp.r, ret_val->i = ztemp.i;
  70. return ;
  71. /* code for both increments equal to 1 */
  72. L20:
  73. i__1 = *n;
  74. for (i__ = 1; i__ <= i__1; ++i__) {
  75. i__2 = i__;
  76. i__3 = i__;
  77. z__2.r = zx[i__2].r * zy[i__3].r - zx[i__2].i * zy[i__3].i, z__2.i =
  78. zx[i__2].r * zy[i__3].i + zx[i__2].i * zy[i__3].r;
  79. z__1.r = ztemp.r + z__2.r, z__1.i = ztemp.i + z__2.i;
  80. ztemp.r = z__1.r, ztemp.i = z__1.i;
  81. /* L30: */
  82. }
  83. ret_val->r = ztemp.r, ret_val->i = ztemp.i;
  84. return ;
  85. } /* zdotu_ */