zdotc.c 2.6 KB

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