Пример #1
0
    public void runSymHelium()
    {
        double             E0    = double.PositiveInfinity;
        int                size  = 30;
        List <matrix>      basis = generateTestFunctions(size);
        List <Permutation> p     = new List <Permutation>();
        List <int>         l1    = new List <int>(); l1.Add(0); l1.Add(1); l1.Add(2);
        List <int>         l2    = new List <int>(); l2.Add(1); l2.Add(0); l2.Add(2);

        p.Add(new Permutation(l1, 1, 1));
        p.Add(new Permutation(l2, -1, 1));
        perms = p;

        for (int k = 0; k < 1000; k++)
        {
            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < 100; j++)
                {
                    List <matrix> tmpbasis = new List <matrix>(basis);
                    tmpbasis[i] = generateA();
                    if (validateB(generateB2(tmpbasis)))
                    {
                        vector v     = new vector(tmpbasis.Count);
                        matrix L     = new CholeskyDecomposition(generateB2(tmpbasis)).L;
                        matrix inv   = new QRdecomposition(L).inverse();
                        matrix inv_T = new QRdecomposition(L.transpose()).inverse();
                        matrix h     = generateH2(tmpbasis);
                        matrix m     = inv * h * inv_T;
                        jacobi.eigen(m, v);
                        double low = v[0];
                        if (low < E0)
                        {
                            E0    = low;
                            basis = tmpbasis;
                            Console.WriteLine(E0);
                            if (E0 < -2.2)
                            {
                                h.print();
                            }
                        }
                    }
                }
            }
        }
    }
Пример #2
0
    // Calculate eigen values of system as specified in problem
    public vector eigenValues(List <matrix> testFunctions)
    {
        vector v = new vector(testFunctions.Count);
        /* try { */
        matrix H     = generateH(testFunctions);
        matrix B     = generateB(testFunctions);
        matrix L     = new CholeskyDecomposition(B).L;
        matrix inv   = new QRdecomposition(L).inverse();
        matrix inv_T = new QRdecomposition(L.transpose()).inverse();
        matrix p     = inv * H * inv_T;

        jacobi.eigen(p, v);
        /* } catch (CholeskyException ce) { */
        /*   Console.WriteLine(ce); */
        /* } */
        return(v);
    }