cdotc.c 2.6 KB

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