quantum-visualizations / qmsolve

⚛️ A module for solving and visualizing the Schrödinger equation.
BSD 3-Clause "New" or "Revised" License
889 stars 116 forks source link

Request: Add Eigsh-Cupy Mode #22

Open cgbsu opened 1 year ago

cgbsu commented 1 year ago

CuPy also has eigsh and it makes computation much faster, the code should be almost identical to what is alraedy there


        if method == 'eigsh':
            from scipy.sparse.linalg import eigsh

            # Note: uses shift-invert trick for stability finding low-lying states
            # Ref: https://docs.scipy.org/doc/scipy/reference/tutorial/arpack.html#shift-invert-mode

            eigenvalues, eigenvectors = eigsh(H, k=max_states, which='LM', sigma=min(0, self.E_min))

Simply change the import (and condition) and it should work.

astralm0nke commented 5 months ago

Added this and pushed in a new PR.