dlasdt.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /* dlasdt.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_dlasdt_(integer *n, integer *lvl, integer *nd, integer *
  14. inode, integer *ndiml, integer *ndimr, integer *msub)
  15. {
  16. /* System generated locals */
  17. integer i__1, i__2;
  18. /* Builtin functions */
  19. double log(doublereal);
  20. /* Local variables */
  21. integer i__, il, ir, maxn;
  22. doublereal temp;
  23. integer nlvl, llst, ncrnt;
  24. /* -- LAPACK auxiliary routine (version 3.2) -- */
  25. /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
  26. /* November 2006 */
  27. /* .. Scalar Arguments .. */
  28. /* .. */
  29. /* .. Array Arguments .. */
  30. /* .. */
  31. /* Purpose */
  32. /* ======= */
  33. /* DLASDT creates a tree of subproblems for bidiagonal divide and */
  34. /* conquer. */
  35. /* Arguments */
  36. /* ========= */
  37. /* N (input) INTEGER */
  38. /* On entry, the number of diagonal elements of the */
  39. /* bidiagonal matrix. */
  40. /* LVL (output) INTEGER */
  41. /* On exit, the number of levels on the computation tree. */
  42. /* ND (output) INTEGER */
  43. /* On exit, the number of nodes on the tree. */
  44. /* INODE (output) INTEGER array, dimension ( N ) */
  45. /* On exit, centers of subproblems. */
  46. /* NDIML (output) INTEGER array, dimension ( N ) */
  47. /* On exit, row dimensions of left children. */
  48. /* NDIMR (output) INTEGER array, dimension ( N ) */
  49. /* On exit, row dimensions of right children. */
  50. /* MSUB (input) INTEGER. */
  51. /* On entry, the maximum row dimension each subproblem at the */
  52. /* bottom of the tree can be of. */
  53. /* Further Details */
  54. /* =============== */
  55. /* Based on contributions by */
  56. /* Ming Gu and Huan Ren, Computer Science Division, University of */
  57. /* California at Berkeley, USA */
  58. /* ===================================================================== */
  59. /* .. Parameters .. */
  60. /* .. */
  61. /* .. Local Scalars .. */
  62. /* .. */
  63. /* .. Intrinsic Functions .. */
  64. /* .. */
  65. /* .. Executable Statements .. */
  66. /* Find the number of levels on the tree. */
  67. /* Parameter adjustments */
  68. --ndimr;
  69. --ndiml;
  70. --inode;
  71. /* Function Body */
  72. maxn = max(1,*n);
  73. temp = log((doublereal) maxn / (doublereal) (*msub + 1)) / log(2.);
  74. *lvl = (integer) temp + 1;
  75. i__ = *n / 2;
  76. inode[1] = i__ + 1;
  77. ndiml[1] = i__;
  78. ndimr[1] = *n - i__ - 1;
  79. il = 0;
  80. ir = 1;
  81. llst = 1;
  82. i__1 = *lvl - 1;
  83. for (nlvl = 1; nlvl <= i__1; ++nlvl) {
  84. /* Constructing the tree at (NLVL+1)-st level. The number of */
  85. /* nodes created on this level is LLST * 2. */
  86. i__2 = llst - 1;
  87. for (i__ = 0; i__ <= i__2; ++i__) {
  88. il += 2;
  89. ir += 2;
  90. ncrnt = llst + i__;
  91. ndiml[il] = ndiml[ncrnt] / 2;
  92. ndimr[il] = ndiml[ncrnt] - ndiml[il] - 1;
  93. inode[il] = inode[ncrnt] - ndimr[il] - 1;
  94. ndiml[ir] = ndimr[ncrnt] / 2;
  95. ndimr[ir] = ndimr[ncrnt] - ndiml[ir] - 1;
  96. inode[ir] = inode[ncrnt] + ndiml[ir] + 1;
  97. /* L10: */
  98. }
  99. llst <<= 1;
  100. /* L20: */
  101. }
  102. *nd = (llst << 1) - 1;
  103. return 0;
  104. /* End of DLASDT */
  105. } /* _starpu_dlasdt_ */