mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 05:14:36 +03:00
log(1 + ...) -> log1p(...)
This commit is contained in:
parent
2682cc0f9b
commit
0698da8b0f
@ -502,13 +502,11 @@ inline std::string GetFirstString(const std::string& str, int& first_pos, const
|
||||
template<class T>
|
||||
T log_sum (T log_a, T log_b)
|
||||
{
|
||||
T v;
|
||||
if (log_a < log_b) {
|
||||
v = log_b+log ( 1 + exp ( log_a-log_b ));
|
||||
return log_b + log1p(exp(log_a - log_b));
|
||||
} else {
|
||||
v = log_a+log ( 1 + exp ( log_b-log_a ));
|
||||
return log_a + log1p(exp(log_b - log_a));
|
||||
}
|
||||
return ( v );
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user