Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVD Call Fail / Initial State Checks #118

Open
piperfw opened this issue Feb 10, 2024 · 0 comments
Open

SVD Call Fail / Initial State Checks #118

piperfw opened this issue Feb 10, 2024 · 0 comments
Labels
bug Something isn't working testing Test cases are needed

Comments

@piperfw
Copy link
Collaborator

piperfw commented Feb 10, 2024

If you pass an initial state of all zeros to Tempo.compute the code fails with an IndexError in node_array.py in an SVD call, presumably because the matrix is rank 0.

I think we should raise an exception early and loudly to the user if initial state is zero rather than letting it propagate and returning a long stack-trace.

The main questions would be where to implement a check and how often e.g. in node_array.py every timestep or closer to the user interface for the initial state only.

I also noticed you can pass an ndarray of boolean values for the state. I suppose this is intentional?

MWE attached.

import numpy as np
import oqupy
# Raises IndexError
initial_state = np.zeros((2,2))
# Fine (but non-physical)
#initial_state = np.array([[0.1,0],[0,0]])
# Fine?
#initial_state = np.array([[True,False],[False,True]])

system = oqupy.System(np.eye(2))
correlations = oqupy.PowerLawSD(alpha=1, zeta=1, cutoff=1)
bath = oqupy.Bath(np.eye(2), correlations)
tempo_params = oqupy.TempoParameters(dt=0.1, epsrel=10**(-7))

tempo_sys = oqupy.Tempo(system,
                        bath,
                        tempo_params,
                        initial_state,
                        start_time=0.0)
tempo_sys.compute(end_time=1.0)
@piperfw piperfw added bug Something isn't working testing Test cases are needed labels Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working testing Test cases are needed
Projects
None yet
Development

No branches or pull requests

1 participant