예제 #1
0
    def kernel(self):
        matvecs = lambda xs: [self.matvec(x) for x in xs]
        precond = self.get_precond()
        guesses = list(self.get_guesses())
        pick = self.get_picker(guesses=guesses)

        conv, e, v = self.davidson(
            matvecs,
            guesses,
            precond,
            tol=self.conv_tol,
            max_cycle=self.max_cycle,
            max_space=self.max_space,
            lindep=self.lindep_tol,
            max_memory=1e9,
            nroots=self.nroots,
            pick=pick,
            verbose=0,
        )

        mask = np.argsort(e)
        conv = [conv[x] for x in mask]
        e = e[mask]
        v = np.array([v[x] for x in mask]).T

        for i in range(self.nroots):
            conv_str = "(*)" if not conv[i] else ""
            self.log.info(" %s: %s %s", i, util.format_value(e[i]), conv_str)
        if not all(conv):
            self.log.info(" (*) = not converged!")

        return e, v, conv
예제 #2
0
    def kernel(self):
        e, v = self.eig(self.matrix)

        self.log.info("eigenvalues:")
        for i in range(min(5, len(e))):
            self.log.info(" %s: %s", i, util.format_value(e[i]))
        self.log.info(" ...")

        return e, v
예제 #3
0
    def kernel(self):
        α, β = self.get_blocks()
        orth = self.mat_sqrt(self.moments[0])
        h_tri = self.build_block_tridiagonal(α, β)

        e, u = np.linalg.eigh(h_tri)
        u = np.dot(orth, u[:self.norb])

        for i in range(min(5, len(e))):
            self.log.info(" %s: %s", i, util.format_value(e[i]))
        self.log.info(" ...")

        return e, u
예제 #4
0
    def kernel(self):
        α, β, γ = self.get_blocks()
        orth = self.mat_sqrt(self.moments[0])
        h_tri = self.build_block_tridiagonal(α, β, γ)

        e, u = np.linalg.eig(h_tri)
        ul = np.dot(orth, u[:self.norb])
        ur = np.dot(np.linalg.inv(u)[:, :self.norb], orth).T.conj()

        for i in range(min(5, len(e))):
            self.log.info(" %s: %s", i, util.format_value(e[i]))
        self.log.info(" ...")

        return e, ul, ur
예제 #5
0
    def kernel(self):
        e, u = self.get_auxiliaries()
        h_aux = np.block([
            [self.h_phys, u],
            [u.T.conj(),  np.diag(e)],
        ])

        e, v = np.linalg.eigh(h_aux)
        v = v[:self.norb]

        for i in range(min(5, len(e))):
            self.log.info(" %s: %s", i, util.format_value(e[i]))
        self.log.info(" ...")

        return e, v