quimb.tensor.belief_propagation.diis ==================================== .. py:module:: quimb.tensor.belief_propagation.diis Classes ------- .. autoapisummary:: quimb.tensor.belief_propagation.diis.ArrayInfo quimb.tensor.belief_propagation.diis.Vectorizer quimb.tensor.belief_propagation.diis.DIIS quimb.tensor.belief_propagation.diis.DIISPyscf Module Contents --------------- .. py:class:: ArrayInfo(shape, size) .. py:attribute:: __slots__ :value: ('shape', 'size') .. py:attribute:: shape .. py:attribute:: size .. py:method:: __repr__() .. py:class:: Vectorizer(tree=None, backend=None) Object for mapping back and forth between any nested pytree of arrays or Tensors and a single flat vector. :param tree: Any nested container of arrays, which will be flattened and packed into a single vector. :type tree: pytree of array, optional .. py:attribute:: infos :value: None .. py:attribute:: d :value: None .. py:attribute:: ref_tree :value: None .. py:attribute:: backend :value: None .. py:attribute:: _concatenate :value: None .. py:attribute:: _reshape :value: None .. py:method:: setup(tree) .. py:method:: pack(tree) Take ``arrays`` and pack their values into attribute `.{name}`, by default `.vector`. .. py:method:: unpack(vector) Turn the single, flat ``vector`` into a sequence of arrays. .. py:method:: __repr__() .. py:class:: DIIS(max_history=6, beta=1.0, rcond=1e-14) Direct Inversion in the Iterative Subspace (DIIS) method (AKA Pulay mixing) [1] for converging fixed-point iterations. [1] P. Pulay, Convergence acceleration of iterative sequences. The case of SCF iteration, 1980, Elsevier, https://doi.org/10.1016/0009-2614(80)80396-4. :param max_history: Maximum number of previous guesses to use in extrapolation. :type max_history: int :param beta: Mixing parameter, 0.0 means only use input guesses, 1.0 means only use extrapolated guesses (original Pulay mixing). Default is 1.0. :type beta: float :param rcond: Cutoff for small singular values in the pseudo-inverse of the B matrix. Default is 1e-14. :type rcond: float .. py:attribute:: max_history :value: 6 .. py:attribute:: beta :value: 1.0 .. py:attribute:: rcond :value: 1e-14 .. py:attribute:: vectorizer .. py:attribute:: guesses :value: [None, None, None, None, None, None] .. py:attribute:: errors :value: [None, None, None, None, None, None] .. py:attribute:: lambdas :value: [] .. py:attribute:: head :value: 5 .. py:attribute:: backend :value: None .. py:attribute:: B :value: None .. py:attribute:: y :value: None .. py:attribute:: scalar :value: None .. py:method:: _extrapolate() .. py:method:: update(y) Given new output `y[i]` (the result of `f(x[i])`), update the internal state and return the extrapolated next guess `x[i+1]`. :param y: The output of the function `f(x)`. Can be any arbitrary nested tree structure with arrays treated at leaves. :type y: pytree of array :returns: **xnext** -- The next guess `x[i+1]` to pass to the function `f(x)`, with the same tree structure as `y`. :rtype: pytree of array .. py:class:: DIISPyscf(max_history=6) Thin wrapper around the PySCF DIIS implementation to handle arbitrary pytrees of arrays, for testing purposes. .. py:attribute:: pdiis .. py:attribute:: vectorizer .. py:method:: update(y)