alternative to log?

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

the cyclist
the cyclist 2011년 9월 2일
Maybe you could post some code, to get some hints? If taking the log of many numbers is your bottleneck, there is probably something that can be done to speed it up, but it is impossible to help without seeing code.
bym
bym 2011년 9월 2일
can I ask why you are multiplying a lot of small probabilities? perhaps there is another way to formulate your problem
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일

0 개 추천

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일

0 개 추천

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.

카테고리

도움말 센터File Exchange에서 Exponents and Logarithms에 대해 자세히 알아보기

태그

질문:

2011년 9월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by