Esempio n. 1
0
    internal virtual int cnvex_(int n, double[] a, bool[] h)
    {
        int i__1, i__2, i__3;
        int i, j, k, m, jc, nj;

        i__1 = n;
        for (i = 1; i <= i__1; ++i)
        {
            h[i - 1] = true;
        }
        k    = (int)(Math.log(n - 2.0) / Math.log(2.0));
        i__1 = k + 1;
        if (pow_ii(c__2, i__1) <= n - 2)
        {
            ++k;
        }
        m    = 1;
        i__1 = k;
        for (i = 0; i <= i__1; ++i)
        {
            i__2 = 0;
            i__3 = (n - 2 - m) / (m + m);
            nj   = Math.max(i__2, i__3);
            i__2 = nj;
            for (j = 0; j <= i__2; ++j)
            {
                jc = (j + j + 1) * m + 1;
                cmerge_(n, a, jc, m, h);
            }
            m += m;
        }
        return(0);
    }
Esempio n. 2
0
    internal virtual int start_(int n, double[] a, doublecomplex[] y, double[] radius, int[] nz, double theSmall, double big, bool[] h)
    {
        int           i__1, i__2, i__3;
        double        d__1, d__2;
        doublecomplex z__1 = dc(), z__2 = dc(), z__3 = dc();
        int           iold;
        double        xbig, temp;
        int           i, j;
        double        r = 0.0;
        int           jj;
        double        th, xsmall;
        int           nzeros;
        double        ang;

        xsmall = Math.log(theSmall);
        xbig   = Math.log(big);
        nz[0]  = 0;
        i__1   = n + 1;
        for (i = 1; i <= i__1; ++i)
        {
            if (a[i - 1] != 0.0)
            {
                a[i - 1] = Math.log(a[i - 1]);
            }
            else
            {
                a[i - 1] = -1e30;
            }
        }
        i__1 = n + 1;
        cnvex_(i__1, a, h);
        iold = 1;
        th   = 6.2831853071796 / n;
        i__1 = n + 1;
        for (i = 2; i <= i__1; ++i)
        {
            if (h[i - 1])
            {
                nzeros = i - iold;
                temp   = (a[iold - 1] - a[i - 1]) / nzeros;
                if (temp < -xbig && temp >= xsmall)
                {
                    nz[0] += nzeros;
                    r      = 1.0 / big;
                }
                if (temp < xsmall)
                {
                    nz[0] += nzeros;
                }
                if (temp > xbig)
                {
                    r      = big;
                    nz[0] += nzeros;
                }
                d__1 = -xbig;
                if (temp <= xbig && temp > Math.max(d__1, xsmall))
                {
                    r = Math.exp(temp);
                }
                ang  = 6.2831853071796 / nzeros;
                i__2 = i - 1;
                for (j = iold; j <= i__2; ++j)
                {
                    jj = j - iold + 1;
                    if (r <= 1.0 / big || r == big)
                    {
                        radius[j - 1] = -1.0;
                    }
                    i__3          = j;
                    d__1          = Math.cos(ang * jj + th * i + .7);
                    d__2          = Math.sin(ang * jj + th * i + .7);
                    z__3.r        = d__2 * (float)0.0;
                    z__3.i        = d__2 * (float)1.0;
                    z__2.r        = d__1 + z__3.r;
                    z__2.i        = z__3.i;
                    z__1.r        = r * z__2.r;
                    z__1.i        = r * z__2.i;
                    y[i__3 - 1].r = z__1.r;
                    y[i__3 - 1].i = z__1.i;
                }
                iold = i;
            }
        }
        return(0);
    }