1 /* ./src_f77/dlasdt.f -- translated by f2c (version 20030320).
2 You must link the resulting object file with the libraries:
3 -lf2c -lm (in that order)
4 */
5
6 #include <punc/vf2c.h>
7
dlasdt_(integer * n,integer * lvl,integer * nd,integer * inode,integer * ndiml,integer * ndimr,integer * msub)8 /* Subroutine */ int dlasdt_(integer *n, integer *lvl, integer *nd, integer *
9 inode, integer *ndiml, integer *ndimr, integer *msub)
10 {
11 /* System generated locals */
12 integer i__1, i__2;
13
14 /* Builtin functions */
15 double log(doublereal);
16
17 /* Local variables */
18 static integer i__, il, ir, maxn;
19 static doublereal temp;
20 static integer nlvl, llst, ncrnt;
21
22
23 /* -- LAPACK auxiliary routine (version 3.0) -- */
24 /* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., */
25 /* Courant Institute, Argonne National Lab, and Rice University */
26 /* June 30, 1999 */
27
28 /* .. Scalar Arguments .. */
29 /* .. */
30 /* .. Array Arguments .. */
31 /* .. */
32
33 /* Purpose */
34 /* ======= */
35
36 /* DLASDT creates a tree of subproblems for bidiagonal divide and */
37 /* conquer. */
38
39 /* Arguments */
40 /* ========= */
41
42 /* N (input) INTEGER */
43 /* On entry, the number of diagonal elements of the */
44 /* bidiagonal matrix. */
45
46 /* LVL (output) INTEGER */
47 /* On exit, the number of levels on the computation tree. */
48
49 /* ND (output) INTEGER */
50 /* On exit, the number of nodes on the tree. */
51
52 /* INODE (output) INTEGER array, dimension ( N ) */
53 /* On exit, centers of subproblems. */
54
55 /* NDIML (output) INTEGER array, dimension ( N ) */
56 /* On exit, row dimensions of left children. */
57
58 /* NDIMR (output) INTEGER array, dimension ( N ) */
59 /* On exit, row dimensions of right children. */
60
61 /* MSUB (input) INTEGER. */
62 /* On entry, the maximum row dimension each subproblem at the */
63 /* bottom of the tree can be of. */
64
65 /* Further Details */
66 /* =============== */
67
68 /* Based on contributions by */
69 /* Ming Gu and Huan Ren, Computer Science Division, University of */
70 /* California at Berkeley, USA */
71
72 /* ===================================================================== */
73
74 /* .. Parameters .. */
75 /* .. */
76 /* .. Local Scalars .. */
77 /* .. */
78 /* .. Intrinsic Functions .. */
79 /* .. */
80 /* .. Executable Statements .. */
81
82 /* Find the number of levels on the tree. */
83
84 /* Parameter adjustments */
85 --ndimr;
86 --ndiml;
87 --inode;
88
89 /* Function Body */
90 maxn = max(1,*n);
91 temp = log((doublereal) maxn / (doublereal) (*msub + 1)) / log(2.);
92 *lvl = (integer) temp + 1;
93
94 i__ = *n / 2;
95 inode[1] = i__ + 1;
96 ndiml[1] = i__;
97 ndimr[1] = *n - i__ - 1;
98 il = 0;
99 ir = 1;
100 llst = 1;
101 i__1 = *lvl - 1;
102 for (nlvl = 1; nlvl <= i__1; ++nlvl) {
103
104 /* Constructing the tree at (NLVL+1)-st level. The number of */
105 /* nodes created on this level is LLST * 2. */
106
107 i__2 = llst - 1;
108 for (i__ = 0; i__ <= i__2; ++i__) {
109 il += 2;
110 ir += 2;
111 ncrnt = llst + i__;
112 ndiml[il] = ndiml[ncrnt] / 2;
113 ndimr[il] = ndiml[ncrnt] - ndiml[il] - 1;
114 inode[il] = inode[ncrnt] - ndimr[il] - 1;
115 ndiml[ir] = ndimr[ncrnt] / 2;
116 ndimr[ir] = ndimr[ncrnt] - ndiml[ir] - 1;
117 inode[ir] = inode[ncrnt] + ndiml[ir] + 1;
118 /* L10: */
119 }
120 llst <<= 1;
121 /* L20: */
122 }
123 *nd = (llst << 1) - 1;
124
125 return 0;
126
127 /* End of DLASDT */
128
129 } /* dlasdt_ */
130
131