From fc8e6351fd62d71278bf1e8a543e54b525516e7a Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia-Ripoll Date: Fri, 28 Jun 2024 16:44:30 +0200 Subject: [PATCH] Replaced np.Inf with np.inf --- src/seemps/analysis/evolution.py | 6 +++--- src/seemps/optimization/descent.py | 4 ++-- src/seemps/optimization/dmrg.py | 2 +- src/seemps/optimization/power.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/seemps/analysis/evolution.py b/src/seemps/analysis/evolution.py index 4d777c5c..9bfb3499 100644 --- a/src/seemps/analysis/evolution.py +++ b/src/seemps/analysis/evolution.py @@ -67,7 +67,7 @@ def euler( """ normalization_strategy = strategy.replace(normalize=True) state = CanonicalMPS(state, normalize=True) - results = EvolutionResults(state=state, energy=np.Inf, trajectory=[], Δβ=Δβ, β=[0]) + results = EvolutionResults(state=state, energy=np.inf, trajectory=[], Δβ=Δβ, β=[0]) for i in range(maxiter + 1): if i > 0: H_state = H.apply(state) @@ -95,7 +95,7 @@ def improved_euler( """ normalization_strategy = strategy.replace(normalize=True) state = CanonicalMPS(state, normalize=True) - results = EvolutionResults(state=state, energy=np.Inf, trajectory=[], Δβ=Δβ, β=[0]) + results = EvolutionResults(state=state, energy=np.inf, trajectory=[], Δβ=Δβ, β=[0]) for i in range(maxiter): if i > 0: H_state = H.apply(state) @@ -125,7 +125,7 @@ def runge_kutta( """ normalization_strategy = strategy.replace(normalize=True) state = CanonicalMPS(state, normalize=True) - results = EvolutionResults(state=state, energy=np.Inf, trajectory=[], Δβ=Δβ, β=[0]) + results = EvolutionResults(state=state, energy=np.inf, trajectory=[], Δβ=Δβ, β=[0]) for i in range(maxiter): if i > 0: H_state = H.apply(state) diff --git a/src/seemps/optimization/descent.py b/src/seemps/optimization/descent.py index cf0a8bcf..1f77d9d0 100644 --- a/src/seemps/optimization/descent.py +++ b/src/seemps/optimization/descent.py @@ -85,11 +85,11 @@ def gradient_descent( state = simplify(guess, strategy=strategy) results = OptimizeResults( state=state, - energy=np.Inf, + energy=np.inf, converged=False, message=f"Exceeded maximum number of steps {maxiter}", ) - E = last_E = variance = avg_H2 = np.Inf + E = last_E = variance = avg_H2 = np.inf H_state: MPS with make_logger() as logger: logger(f"gradient_descent() invoked with {maxiter} iterations") diff --git a/src/seemps/optimization/dmrg.py b/src/seemps/optimization/dmrg.py index 7bc966df..37898f26 100644 --- a/src/seemps/optimization/dmrg.py +++ b/src/seemps/optimization/dmrg.py @@ -180,7 +180,7 @@ def dmrg( logger(f"start, energy={energy}, variance={variance}") if callback is not None: callback(QF.state, results) - E: float = np.Inf + E: float = np.inf last_E: float = E strategy = strategy.replace(normalize=True) for step in range(maxiter): diff --git a/src/seemps/optimization/power.py b/src/seemps/optimization/power.py index 9c4aa55e..dacfe4e9 100644 --- a/src/seemps/optimization/power.py +++ b/src/seemps/optimization/power.py @@ -73,7 +73,7 @@ def power_method( ) results = PowerMethodOptimizeResults( state=state, - energy=np.Inf, + energy=np.inf, converged=False, trajectory=[], variances=[], @@ -82,7 +82,7 @@ def power_method( # This extra field is needed because CGS consumes iterations # in itself. results.steps = [] - last_energy = np.Inf + last_energy = np.inf logger = make_logger() logger(f"power_method() invoked with {maxiter} iterations") total_steps = 0