3 /* Subroutine */ int slasdt_(integer *n, integer *lvl, integer *nd, integer *
4 inode, integer *ndiml, integer *ndimr, integer *msub)
6 /* System generated locals */
9 /* Builtin functions */
10 double log(doublereal);
13 integer i__, il, ir, maxn;
15 integer nlvl, llst, ncrnt;
18 /* -- LAPACK auxiliary routine (version 3.1) -- */
19 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
22 /* .. Scalar Arguments .. */
24 /* .. Array Arguments .. */
30 /* SLASDT creates a tree of subproblems for bidiagonal divide and */
36 /* N (input) INTEGER */
37 /* On entry, the number of diagonal elements of the */
38 /* bidiagonal matrix. */
40 /* LVL (output) INTEGER */
41 /* On exit, the number of levels on the computation tree. */
43 /* ND (output) INTEGER */
44 /* On exit, the number of nodes on the tree. */
46 /* INODE (output) INTEGER array, dimension ( N ) */
47 /* On exit, centers of subproblems. */
49 /* NDIML (output) INTEGER array, dimension ( N ) */
50 /* On exit, row dimensions of left children. */
52 /* NDIMR (output) INTEGER array, dimension ( N ) */
53 /* On exit, row dimensions of right children. */
55 /* MSUB (input) INTEGER. */
56 /* On entry, the maximum row dimension each subproblem at the */
57 /* bottom of the tree can be of. */
62 /* Based on contributions by */
63 /* Ming Gu and Huan Ren, Computer Science Division, University of */
64 /* California at Berkeley, USA */
66 /* ===================================================================== */
68 /* .. Parameters .. */
70 /* .. Local Scalars .. */
72 /* .. Intrinsic Functions .. */
74 /* .. Executable Statements .. */
76 /* Find the number of levels on the tree. */
78 /* Parameter adjustments */
85 temp = log((real) maxn / (real) (*msub + 1)) / log(2.f);
86 *lvl = (integer) temp + 1;
91 ndimr[1] = *n - i__ - 1;
96 for (nlvl = 1; nlvl <= i__1; ++nlvl) {
98 /* Constructing the tree at (NLVL+1)-st level. The number of */
99 /* nodes created on this level is LLST * 2. */
102 for (i__ = 0; i__ <= i__2; ++i__) {
106 ndiml[il] = ndiml[ncrnt] / 2;
107 ndimr[il] = ndiml[ncrnt] - ndiml[il] - 1;
108 inode[il] = inode[ncrnt] - ndimr[il] - 1;
109 ndiml[ir] = ndimr[ncrnt] / 2;
110 ndimr[ir] = ndimr[ncrnt] - ndiml[ir] - 1;
111 inode[ir] = inode[ncrnt] + ndiml[ir] + 1;
117 *nd = (llst << 1) - 1;