예제 #1
0
    // Generate the matrix H contain matrix elements of kinetic
    // and potential energy combined
    public matrix generateH(List <matrix> testFunctions)
    {
        int    size = testFunctions.Count;
        matrix H    = new matrix(size, size);

        for (int i = 0; i < size; i++)
        {
            for (int j = 0; j < i; j++)
            {
                // H should be symmetric
                double element = mef.matrixElement(testFunctions[i], testFunctions[j]);
                H[i, j] = element;
                H[j, i] = element;
            }
            H[i, i] = mef.matrixElement(testFunctions[i], testFunctions[i]);
        }
        return(H);
    }