slasdt.c
Go to the documentation of this file.
00001 /* slasdt.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 /* Subroutine */ int slasdt_(integer *n, integer *lvl, integer *nd, integer *
00017         inode, integer *ndiml, integer *ndimr, integer *msub)
00018 {
00019     /* System generated locals */
00020     integer i__1, i__2;
00021 
00022     /* Builtin functions */
00023     double log(doublereal);
00024 
00025     /* Local variables */
00026     integer i__, il, ir, maxn;
00027     real temp;
00028     integer nlvl, llst, ncrnt;
00029 
00030 
00031 /*  -- LAPACK auxiliary routine (version 3.2) -- */
00032 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00033 /*     November 2006 */
00034 
00035 /*     .. Scalar Arguments .. */
00036 /*     .. */
00037 /*     .. Array Arguments .. */
00038 /*     .. */
00039 
00040 /*  Purpose */
00041 /*  ======= */
00042 
00043 /*  SLASDT creates a tree of subproblems for bidiagonal divide and */
00044 /*  conquer. */
00045 
00046 /*  Arguments */
00047 /*  ========= */
00048 
00049 /*   N      (input) INTEGER */
00050 /*          On entry, the number of diagonal elements of the */
00051 /*          bidiagonal matrix. */
00052 
00053 /*   LVL    (output) INTEGER */
00054 /*          On exit, the number of levels on the computation tree. */
00055 
00056 /*   ND     (output) INTEGER */
00057 /*          On exit, the number of nodes on the tree. */
00058 
00059 /*   INODE  (output) INTEGER array, dimension ( N ) */
00060 /*          On exit, centers of subproblems. */
00061 
00062 /*   NDIML  (output) INTEGER array, dimension ( N ) */
00063 /*          On exit, row dimensions of left children. */
00064 
00065 /*   NDIMR  (output) INTEGER array, dimension ( N ) */
00066 /*          On exit, row dimensions of right children. */
00067 
00068 /*   MSUB   (input) INTEGER. */
00069 /*          On entry, the maximum row dimension each subproblem at the */
00070 /*          bottom of the tree can be of. */
00071 
00072 /*  Further Details */
00073 /*  =============== */
00074 
00075 /*  Based on contributions by */
00076 /*     Ming Gu and Huan Ren, Computer Science Division, University of */
00077 /*     California at Berkeley, USA */
00078 
00079 /*  ===================================================================== */
00080 
00081 /*     .. Parameters .. */
00082 /*     .. */
00083 /*     .. Local Scalars .. */
00084 /*     .. */
00085 /*     .. Intrinsic Functions .. */
00086 /*     .. */
00087 /*     .. Executable Statements .. */
00088 
00089 /*     Find the number of levels on the tree. */
00090 
00091     /* Parameter adjustments */
00092     --ndimr;
00093     --ndiml;
00094     --inode;
00095 
00096     /* Function Body */
00097     maxn = max(1,*n);
00098     temp = log((real) maxn / (real) (*msub + 1)) / log(2.f);
00099     *lvl = (integer) temp + 1;
00100 
00101     i__ = *n / 2;
00102     inode[1] = i__ + 1;
00103     ndiml[1] = i__;
00104     ndimr[1] = *n - i__ - 1;
00105     il = 0;
00106     ir = 1;
00107     llst = 1;
00108     i__1 = *lvl - 1;
00109     for (nlvl = 1; nlvl <= i__1; ++nlvl) {
00110 
00111 /*        Constructing the tree at (NLVL+1)-st level. The number of */
00112 /*        nodes created on this level is LLST * 2. */
00113 
00114         i__2 = llst - 1;
00115         for (i__ = 0; i__ <= i__2; ++i__) {
00116             il += 2;
00117             ir += 2;
00118             ncrnt = llst + i__;
00119             ndiml[il] = ndiml[ncrnt] / 2;
00120             ndimr[il] = ndiml[ncrnt] - ndiml[il] - 1;
00121             inode[il] = inode[ncrnt] - ndimr[il] - 1;
00122             ndiml[ir] = ndimr[ncrnt] / 2;
00123             ndimr[ir] = ndimr[ncrnt] - ndiml[ir] - 1;
00124             inode[ir] = inode[ncrnt] + ndiml[ir] + 1;
00125 /* L10: */
00126         }
00127         llst <<= 1;
00128 /* L20: */
00129     }
00130     *nd = (llst << 1) - 1;
00131 
00132     return 0;
00133 
00134 /*     End of SLASDT */
00135 
00136 } /* slasdt_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:11