LuzieH/pytpt

Reduce number of n loops for the finite time methods

Closed this issue · 3 comments

After adding backward_transitions(), forward_committor() and backward_committor() methods, the methods in pytpt/finite.py which have a loop through the time n are the following (UPDATE):

  • density()
  • backward_transitions()
  • forward_committor()
  • backward_committor()
  • committors()
  • reac_density()
  • reac_current()
  • current_density()

We would however keep using the method 'committors' to compute in one loop over n

  • the density,
  • the backward transition matrix and
  • the committors

and we could add a method called 'reac_density_and_current' to compute in one loop over n

  • the reactive density, the normalization factor and the normalized reactive density
  • the reactive current and the currentcurrent_density.

Altogether we would just need 2 loops to compute all the statistics needed.

@eborrell I think depending on how much the speed up of using committors compared to backward_transitions/backward_committor and forward_committor is, I would just delete committors (because the other methods are clearer and nicer to use).
Do you know how the computation time compares?

Depends on the size of N and the size of S. I adapt the test so we can compare now.

  • For example, if S is small (case of the small network), there is not that much difference even for n >> 1.
    $ pytest tests/test_finite.py::TestFinite::test_separate_committors --small-network -N 10000
    $ pytest tests/test_finite.py::TestFinite::test_together_committors --small-network -N 10000

  • For bigger S, the methods separated are slower
    $ pytest tests/test_finite.py::TestFinite::test_separate_committors -S 1000 -N 1000
    $ pytest tests/test_finite.py::TestFinite::test_together_committors -S 1000 -N 1000

I would keep both.

update: committors() method removed.