dzsum1.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /* dzsum1.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. doublereal _starpu_dzsum1_(integer *n, doublecomplex *cx, integer *incx)
  14. {
  15. /* System generated locals */
  16. integer i__1, i__2;
  17. doublereal ret_val;
  18. /* Builtin functions */
  19. double z_abs(doublecomplex *);
  20. /* Local variables */
  21. integer i__, nincx;
  22. doublereal stemp;
  23. /* -- LAPACK auxiliary routine (version 3.2) -- */
  24. /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
  25. /* November 2006 */
  26. /* .. Scalar Arguments .. */
  27. /* .. */
  28. /* .. Array Arguments .. */
  29. /* .. */
  30. /* Purpose */
  31. /* ======= */
  32. /* DZSUM1 takes the sum of the absolute values of a complex */
  33. /* vector and returns a double precision result. */
  34. /* Based on DZASUM from the Level 1 BLAS. */
  35. /* The change is to use the 'genuine' absolute value. */
  36. /* Contributed by Nick Higham for use with ZLACON. */
  37. /* Arguments */
  38. /* ========= */
  39. /* N (input) INTEGER */
  40. /* The number of elements in the vector CX. */
  41. /* CX (input) COMPLEX*16 array, dimension (N) */
  42. /* The vector whose elements will be summed. */
  43. /* INCX (input) INTEGER */
  44. /* The spacing between successive values of CX. INCX > 0. */
  45. /* ===================================================================== */
  46. /* .. Local Scalars .. */
  47. /* .. */
  48. /* .. Intrinsic Functions .. */
  49. /* .. */
  50. /* .. Executable Statements .. */
  51. /* Parameter adjustments */
  52. --cx;
  53. /* Function Body */
  54. ret_val = 0.;
  55. stemp = 0.;
  56. if (*n <= 0) {
  57. return ret_val;
  58. }
  59. if (*incx == 1) {
  60. goto L20;
  61. }
  62. /* CODE FOR INCREMENT NOT EQUAL TO 1 */
  63. nincx = *n * *incx;
  64. i__1 = nincx;
  65. i__2 = *incx;
  66. for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
  67. /* NEXT LINE MODIFIED. */
  68. stemp += z_abs(&cx[i__]);
  69. /* L10: */
  70. }
  71. ret_val = stemp;
  72. return ret_val;
  73. /* CODE FOR INCREMENT EQUAL TO 1 */
  74. L20:
  75. i__2 = *n;
  76. for (i__ = 1; i__ <= i__2; ++i__) {
  77. /* NEXT LINE MODIFIED. */
  78. stemp += z_abs(&cx[i__]);
  79. /* L30: */
  80. }
  81. ret_val = stemp;
  82. return ret_val;
  83. /* End of DZSUM1 */
  84. } /* _starpu_dzsum1_ */