Generate a random number ∼ U (0, 1); end Although the cost of the exploration policy can be greatly reduced by limiting the search space in S 2 to the top m external determinants, the RLCI algorithm may still require multiple matrix diagonalizations. However, the brunt of this cost can be greatly reduced by utilizing an iterative subspace diagonalizer, such as Davidson's algorithm, which reduces the cost to O(k 2 ), where k is the subspace dimension. The cost is reduced further still by solving for the lowest eigenpair once at the beginning of each episode, then caching the resulting eigenvector for re-use as an initial guess in subsequent search iterations. Since each action involves the replacement of a single pair of determinants, the wave function overlap between successive actions is very high, and Davidson's algorithm will converge in a few number of iterations. As each new eigenproblem is solved, the guess vector may be overwritten and re-used for the next matrix diagonalization, ensuring that the guess for the current Davidson diagonalization differs from the previous one by no more than one row.