cdotu.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /* cdotu.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. /* Complex */ VOID cdotu_(complex * ret_val, integer *n, complex *cx, integer
  14. *incx, complex *cy, integer *incy)
  15. {
  16. /* System generated locals */
  17. integer i__1, i__2, i__3;
  18. complex q__1, q__2;
  19. /* Local variables */
  20. integer i__, ix, iy;
  21. complex ctemp;
  22. /* .. Scalar Arguments .. */
  23. /* .. */
  24. /* .. Array Arguments .. */
  25. /* .. */
  26. /* Purpose */
  27. /* ======= */
  28. /* CDOTU forms the dot product of two vectors. */
  29. /* Further Details */
  30. /* =============== */
  31. /* jack dongarra, linpack, 3/11/78. */
  32. /* modified 12/3/93, array(1) declarations changed to array(*) */
  33. /* .. Local Scalars .. */
  34. /* .. */
  35. /* Parameter adjustments */
  36. --cy;
  37. --cx;
  38. /* Function Body */
  39. ctemp.r = 0.f, ctemp.i = 0.f;
  40. ret_val->r = 0.f, ret_val->i = 0.f;
  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. q__2.r = cx[i__2].r * cy[i__3].r - cx[i__2].i * cy[i__3].i, q__2.i =
  62. cx[i__2].r * cy[i__3].i + cx[i__2].i * cy[i__3].r;
  63. q__1.r = ctemp.r + q__2.r, q__1.i = ctemp.i + q__2.i;
  64. ctemp.r = q__1.r, ctemp.i = q__1.i;
  65. ix += *incx;
  66. iy += *incy;
  67. /* L10: */
  68. }
  69. ret_val->r = ctemp.r, ret_val->i = ctemp.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. q__2.r = cx[i__2].r * cy[i__3].r - cx[i__2].i * cy[i__3].i, q__2.i =
  78. cx[i__2].r * cy[i__3].i + cx[i__2].i * cy[i__3].r;
  79. q__1.r = ctemp.r + q__2.r, q__1.i = ctemp.i + q__2.i;
  80. ctemp.r = q__1.r, ctemp.i = q__1.i;
  81. /* L30: */
  82. }
  83. ret_val->r = ctemp.r, ret_val->i = ctemp.i;
  84. return ;
  85. } /* cdotu_ */