Speed up lea.max_of and lea.min_of functions

Issue #46 resolved
Pierre Denis
repo owner created an issue

The current implementation of lea.max_of and lea.min_of could be slightly optimized, without using fast=True (hence without loosing referential consistency).

Currently in lea 3.0.1, the call


builds something similar to


To calculate the resulting probability distribution, this has to call max(va,vb,vc) for each combination of values (va,vb,vc).

Now, if we build instead


then the calculation could be faster because max(va,vb) shall be calculated only once for each (va,vb) pair. Note that Flea2 has the same semantic as Flea, i.e. functional random variable, but is optimized for functions having two arguments.

Of course, the same optimization could be done also on lea.min_of.

Comments (6)

  1. Log in to comment