alternative to log?

2 次查看(过去 30 天)
Frank
Frank 2011-9-2
I am multiplying a lot of small numbers (probabilities). in order to avoid underflow, i use the log transformation. this is rather time consuming, so i was wondering whether there is a faster alternative
  4 个评论
Daniel Shub
Daniel Shub 2011-9-2
Have you profiled your code to know this is the bottleneck? Is it possible to distrbute the log and multiplication to across a cluster?
Grzegorz Knor
Grzegorz Knor 2011-9-3
Maybe you could use complementary events?

请先登录,再进行评论。

回答(2 个)

Walter Roberson
Walter Roberson 2011-9-3
There is a possibility that the fixed-point toolbox might be faster (you would define a fixed point format with a large enough exponent field to take care of your final value), but I suspect that the cost of converting the values into fixed point and doing the software multiplications would be higher than the cost of taking the log.
The symbolic toolbox can handle very small numbers, but again there is the cost of the conversion and software multiplication (but the software multiplication library would at be a fairly well-tuned and robust one in this case.)

Derek O'Connor
Derek O'Connor 2011-9-4
No matter what transformation you use, the result, prod(pi, i=1:n) --> 0, so eventually you will get underflow in fixed precision or run out of memory in variable precision or rational arithmetic.
You need to give us more information.

类别

Help CenterFile Exchange 中查找有关 Exponents and Logarithms 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by