Пример #1
0
        public static void sorthog(double *vec,       /* vector to be orthogonalized */
                                   int n,             /* length of the columns of orth */
                                   orthlink **solist, /* set of vecs to orth. against */
                                   int ngood          /* number of vecs in solist */
                                   )
        {
            double  alpha;
            double *dir;
            int     i;

            for (i = 1; i <= ngood; i++)
            {
                dir   = (solist[i])->vec;
                alpha = -dot(vec, 1, n, dir) / dot(dir, 1, n, dir);
                scadd(vec, 1, n, alpha, dir);
            }
        }
Пример #2
0
        /* Print out the orthogonalization set, double version */
        public static void solistout(orthlink **solist, /* vector of pntrs to orthlnks */
                                     int ngood,         /* number of good vecs on list */
                                     int j              /* current number of Lanczos steps */
                                     )
        {
            int i; /* index */

            for (i = 1; i <= ngood; i++)
            {
                if ((solist[i])->index <= (j / 2))
                {
                    Trace.Write(".");
                }
                else
                {
                    Trace.Write("+");
                }

                /* Really detailed output: printf("\n"); printf("depth
                 * %d\n",(solist[i])->depth); printf("index %d\n",(solist[i])->index);
                 * printf("ritzval %g\n",(solist[i])->ritzval); printf("betaji
                 * %g\n",(solist[i])->betaji); printf("tau %g\n",(solist[i])->tau);
                 * printf("prevtau %g\n",(solist[i])->prevtau);
                 * vecout((solist[i])->vec,1,n,"vec", null); */
            }

            Trace.WriteLine($"{ngood:d}");

            if (DEBUG_EVECS > 2)
            {
                Trace.Write("  actual indices: ");
                for (i = 1; i <= ngood; i++)
                {
                    Trace.Write($" {solist[i]->index:d}");
                }

                Trace.WriteLine("");
            }
        }