log-sum-exp trick why not recursive

前端 未结 3 1356
盖世英雄少女心
盖世英雄少女心 2021-01-04 21:46

I have been researching the log-sum-exp problem. I have a list of numbers stored as logarithms which I would like to sum and store in a logarithm.

the naive algorith

3条回答
  •  无人及你
    2021-01-04 22:47

    As you have defined it, your recursive function will never terminate. That's because ((x-maxlog) for x in listOfLogs) still has the same number of elements as listOfLogs.

    I don't think that this is easily fixable either, without significantly impacting either the performance or the precision (compared to the non-recursive version).

提交回复
热议问题