Skip to content

Commit

Permalink
Fixed type declations and unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
juanjosegarciaripoll committed Apr 12, 2024
1 parent 0d74cb2 commit 0ab4cfc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/seemps/hamiltonians.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/seemps/state/canonical_mps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 16 additions & 0 deletions src/seemps/state/core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 4 additions & 6 deletions src/seemps/state/schmidt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 0ab4cfc

Please sign in to comment.