diff --git a/src/seemps/hamiltonians.py b/src/seemps/hamiltonians.py index 0b31638..dab4d6c 100644 --- a/src/seemps/hamiltonians.py +++ b/src/seemps/hamiltonians.py @@ -6,7 +6,7 @@ import scipy.sparse as sp # type: ignore from abc import abstractmethod from .mpo import MPO -from .state import schmidt, DEFAULT_STRATEGY, Strategy +from .state import DEFAULT_STRATEGY, Strategy from .state.core import _destructive_svd, destructively_truncate_vector from .typing import Operator, Vector from .tools import σx, σy, σz diff --git a/src/seemps/state/canonical_mps.py b/src/seemps/state/canonical_mps.py index 02f290e..8c75744 100644 --- a/src/seemps/state/canonical_mps.py +++ b/src/seemps/state/canonical_mps.py @@ -4,7 +4,6 @@ from typing import Optional, Sequence, Iterable from ..typing import Vector, Tensor3, Tensor4, VectorLike, Environment from . import environments, schmidt -from ._contractions import _contract_last_and_first from seemps.state.core import ( DEFAULT_STRATEGY, Strategy, diff --git a/src/seemps/state/core.pyi b/src/seemps/state/core.pyi index 82219a6..22a5f5d 100644 --- a/src/seemps/state/core.pyi +++ b/src/seemps/state/core.pyi @@ -68,5 +68,21 @@ def update_left_environment( def end_environment(rho: Environment) -> Weight: ... def join_environments(rhoL: Environment, rhoR: Environment) -> Weight: ... def scprod(bra: MPS, ket: MPS) -> Weight: ... +def _svd(A: np.ndarray) -> tuple[np.ndarray, np.ndarray, np.ndarray]: ... +def left_orth_2site( + AA: Tensor4, strategy: Strategy +) -> tuple[Tensor3, Tensor3, float]: ... +def right_orth_2site( + AA: Tensor4, strategy: Strategy +) -> tuple[Tensor3, Tensor3, float]: ... +def _destructive_svd(A: np.ndarray) -> tuple[np.ndarray, np.ndarray, np.ndarray]: ... +def schmidt_weights(A: np.ndarray) -> np.ndarray: ... +def _update_in_canonical_form_left( + state: list[Tensor3], A: Tensor3, site: int, truncation: Strategy +) -> tuple[int, float]: ... +def _update_in_canonical_form_right( + state: list[Tensor3], A: Tensor3, site: int, truncation: Strategy +) -> tuple[int, float]: ... +def _canonicalize(state: list[Tensor3], center: int, truncation: Strategy) -> float: ... from .mps import MPS # noqa: E402 diff --git a/src/seemps/state/schmidt.py b/src/seemps/state/schmidt.py index 360a1f5..f64630d 100644 --- a/src/seemps/state/schmidt.py +++ b/src/seemps/state/schmidt.py @@ -2,20 +2,18 @@ import numpy as np import math from math import sqrt -from typing import Sequence, Any, Callable +from typing import Sequence from numpy.typing import NDArray -from ..typing import VectorLike, Tensor3, Vector +from ..typing import VectorLike, Tensor3 from .core import ( Strategy, - destructively_truncate_vector, DEFAULT_STRATEGY, - _destructive_svd, schmidt_weights, left_orth_2site, right_orth_2site, ) -from scipy.linalg import svd, LinAlgError # type: ignore -from scipy.linalg.lapack import get_lapack_funcs # type: ignore + +__all__ = ["schmidt_weights", "left_orth_2site", "right_orth_2site", "vector2mps"] def vector2mps(