dlargv.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /* dlargv.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. /* Subroutine */ int _starpu_dlargv_(integer *n, doublereal *x, integer *incx,
  14. doublereal *y, integer *incy, doublereal *c__, integer *incc)
  15. {
  16. /* System generated locals */
  17. integer i__1;
  18. /* Builtin functions */
  19. double sqrt(doublereal);
  20. /* Local variables */
  21. doublereal f, g;
  22. integer i__;
  23. doublereal t;
  24. integer ic, ix, iy;
  25. doublereal tt;
  26. /* -- LAPACK auxiliary routine (version 3.2) -- */
  27. /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
  28. /* November 2006 */
  29. /* .. Scalar Arguments .. */
  30. /* .. */
  31. /* .. Array Arguments .. */
  32. /* .. */
  33. /* Purpose */
  34. /* ======= */
  35. /* DLARGV generates a vector of real plane rotations, determined by */
  36. /* elements of the real vectors x and y. For i = 1,2,...,n */
  37. /* ( c(i) s(i) ) ( x(i) ) = ( a(i) ) */
  38. /* ( -s(i) c(i) ) ( y(i) ) = ( 0 ) */
  39. /* Arguments */
  40. /* ========= */
  41. /* N (input) INTEGER */
  42. /* The number of plane rotations to be generated. */
  43. /* X (input/output) DOUBLE PRECISION array, */
  44. /* dimension (1+(N-1)*INCX) */
  45. /* On entry, the vector x. */
  46. /* On exit, x(i) is overwritten by a(i), for i = 1,...,n. */
  47. /* INCX (input) INTEGER */
  48. /* The increment between elements of X. INCX > 0. */
  49. /* Y (input/output) DOUBLE PRECISION array, */
  50. /* dimension (1+(N-1)*INCY) */
  51. /* On entry, the vector y. */
  52. /* On exit, the sines of the plane rotations. */
  53. /* INCY (input) INTEGER */
  54. /* The increment between elements of Y. INCY > 0. */
  55. /* C (output) DOUBLE PRECISION array, dimension (1+(N-1)*INCC) */
  56. /* The cosines of the plane rotations. */
  57. /* INCC (input) INTEGER */
  58. /* The increment between elements of C. INCC > 0. */
  59. /* ===================================================================== */
  60. /* .. Parameters .. */
  61. /* .. */
  62. /* .. Local Scalars .. */
  63. /* .. */
  64. /* .. Intrinsic Functions .. */
  65. /* .. */
  66. /* .. Executable Statements .. */
  67. /* Parameter adjustments */
  68. --c__;
  69. --y;
  70. --x;
  71. /* Function Body */
  72. ix = 1;
  73. iy = 1;
  74. ic = 1;
  75. i__1 = *n;
  76. for (i__ = 1; i__ <= i__1; ++i__) {
  77. f = x[ix];
  78. g = y[iy];
  79. if (g == 0.) {
  80. c__[ic] = 1.;
  81. } else if (f == 0.) {
  82. c__[ic] = 0.;
  83. y[iy] = 1.;
  84. x[ix] = g;
  85. } else if (abs(f) > abs(g)) {
  86. t = g / f;
  87. tt = sqrt(t * t + 1.);
  88. c__[ic] = 1. / tt;
  89. y[iy] = t * c__[ic];
  90. x[ix] = f * tt;
  91. } else {
  92. t = f / g;
  93. tt = sqrt(t * t + 1.);
  94. y[iy] = 1. / tt;
  95. c__[ic] = t * y[iy];
  96. x[ix] = g * tt;
  97. }
  98. ic += *incc;
  99. iy += *incy;
  100. ix += *incx;
  101. /* L10: */
  102. }
  103. return 0;
  104. /* End of DLARGV */
  105. } /* _starpu_dlargv_ */