forte2.helpers.davidsonliu ========================== .. py:module:: forte2.helpers.davidsonliu Module Contents --------------- .. py:class:: DavidsonLiuSolver Davidson-Liu solver for iterative diagonalization of Hermitian matrices. :Parameters: **size** : int Dimension of the matrix / number of basis vectors. **nroot** : int Number of roots to find. **davidson_liu_params** : DavidsonLiuParams, optional Parameters for the Davidson-Liu solver. **energy_shift** : float, optional Target eigenvalue shift for sorting eigenpairs. If None, no shift is applied. **log_level** : int, optional, default=logger.get_verbosity_level() Logging level for output messages. **dtype** : type, optional, default=np.float64 Data type of the matrix to diagonalize. Must be float or complex. :Attributes: **iter** : int Current iteration number. **converged** : bool Whether the solver has converged. .. !! processed by numpydoc !! .. py:attribute:: size :type: int .. py:attribute:: nroot :type: int .. py:attribute:: davidson_liu_params :type: forte2.base_classes.params.DavidsonLiuParams .. py:attribute:: energy_shift :type: float :value: None .. py:attribute:: log_level :type: int .. py:attribute:: dtype :type: type .. py:method:: add_sigma_builder(sigma_builder) Add the function that builds the matrix-vector product. :Parameters: **sigma_builder** : callable This function should have signature ``sigma_builder(basis_block, sigma_block) -> None``, where ``basis_block.shape == (size, m)`` and ``sigma_block.shape == (size, m)``. and it modifies ``sigma_block`` in place, performing the operation ``sigma_block = matrix @ basis_block``. .. !! processed by numpydoc !! .. py:method:: add_h_diag(h_diag) .. py:method:: add_guesses(guesses) Add initial guesses for the eigenvectors. :Parameters: **guesses: NDArray** ``guesses.shape == (size, n_guess)``, with n_guess between 1 and subspace_size. .. !! processed by numpydoc !! .. py:method:: add_project_out(project_out) Add vectors to project out during the solve. :Parameters: **project_out: list of arrays** Each array should have the same dtype and shape, but can have lengths less than or equal to `size`. The vectors will be orthogonalized and stored as rows for projection during the solve. If the lengths are less than `size`, they will be considered to be zero-padded to `size` during projection. .. !! processed by numpydoc !! .. py:method:: do_project_out(A) .. py:method:: solve() .. py:method:: add_rows_and_orthonormalize(A_existing: numpy.ndarray, B_candidates: numpy.ndarray, A_slots: numpy.ndarray) -> int Add candidate column vectors from B_candidates into A_slots, using iterative orthogonalization per vector. Returns the number of columns added. .. !! processed by numpydoc !! .. py:method:: orthonormality_check(b: numpy.ndarray, msg: str = 'Orthonormality check failed.') Check if the columns of b are orthonormal. .. !! processed by numpydoc !!