choderalab / chiron

Differentiable Markov Chain Monte Carlo
https://github.com/choderalab/chiron/wiki
MIT License
14 stars 1 forks source link

Swichting from OO to functional paradigma #23

Closed wiederm closed 5 months ago

wiederm commented 6 months ago

Currently, we are changing objects in place. This might become an issue for clarity and jax just-in-time compilation. Should we switch to a functional paradigm throughout the package and avoid in-place object modification?

chrisiacovella commented 6 months ago

I think if we write a lot of our internal functions of classes to follow the functional paradigm we will set ourselves up better for using JIT. This has mostly been my approach thus far. E.g., the NeighborList serves as a container that can be modified in place, but the underlying functions are all functional in nature with clear inputs and outputs. This has definitely made it a lot easier to Jax-ify/jit/vmap the various functions