FeynCalc / feyncalc

Mathematica package for algebraic calculations in elementary particle physics.
https://feyncalc.github.io
GNU General Public License v3.0
310 stars 87 forks source link

FCMapWithProgressBar #56

Open vsht opened 4 years ago

vsht commented 4 years ago

The idea is to have a useful visualization of calculations that go like

res = Map[evalFun[#]&, aLotOfAmps]

Currently there is no nice way to see

Remaining tasks

vsht commented 4 years ago

This solution https://mathematica.stackexchange.com/questions/213537/how-to-create-a-progress-bar-using-wolframscript should be sufficient to make the progress bar work in terminal.

HBelusca commented 3 years ago

Would be nice to allow for a parallel version of this (useful when aLotOfAmps is a huge list, and evalFun takes time). To give you an idea, I often use this sort of construct:

(** Suppose there exists a user-defined $ParallelizeOptions variable that
 ** holds a list of options to control the behaviour of ParallelMap[],
 ** and that parallelization can be controlled with a $Parallelize boolean. **)

len=Length@aLotOfAmps;
Module[{counter}, SetSharedVariable[counter];counter=0;

  Print(*Temporary*)["Element: ", Dynamic[counter], "/", len];

  res = If[$Parallelize, ParallelMap[##, Sequence@@$ParallelizeOptions]&, Map][
          (
            counter++;
            ClearSystemCache[]; (* To clean up as much memory as possible in the parallel kernel *)
            evalFun[#]
          )&
          , #]& @ aLotOfAmps;
];