dzasum.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* dzasum.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 dzasum_(integer *n, doublecomplex *zx, integer *incx)
  14. {
  15. /* System generated locals */
  16. integer i__1;
  17. doublereal ret_val;
  18. /* Local variables */
  19. integer i__, ix;
  20. doublereal stemp;
  21. extern doublereal dcabs1_(doublecomplex *);
  22. /* .. Scalar Arguments .. */
  23. /* .. */
  24. /* .. Array Arguments .. */
  25. /* .. */
  26. /* Purpose */
  27. /* ======= */
  28. /* takes the sum of the absolute values. */
  29. /* jack dongarra, 3/11/78. */
  30. /* modified 3/93 to return if incx .le. 0. */
  31. /* modified 12/3/93, array(1) declarations changed to array(*) */
  32. /* .. Local Scalars .. */
  33. /* .. */
  34. /* .. External Functions .. */
  35. /* .. */
  36. /* Parameter adjustments */
  37. --zx;
  38. /* Function Body */
  39. ret_val = 0.;
  40. stemp = 0.;
  41. if (*n <= 0 || *incx <= 0) {
  42. return ret_val;
  43. }
  44. if (*incx == 1) {
  45. goto L20;
  46. }
  47. /* code for increment not equal to 1 */
  48. ix = 1;
  49. i__1 = *n;
  50. for (i__ = 1; i__ <= i__1; ++i__) {
  51. stemp += dcabs1_(&zx[ix]);
  52. ix += *incx;
  53. /* L10: */
  54. }
  55. ret_val = stemp;
  56. return ret_val;
  57. /* code for increment equal to 1 */
  58. L20:
  59. i__1 = *n;
  60. for (i__ = 1; i__ <= i__1; ++i__) {
  61. stemp += dcabs1_(&zx[i__]);
  62. /* L30: */
  63. }
  64. ret_val = stemp;
  65. return ret_val;
  66. } /* dzasum_ */