[fix] log_sum_exp in SSE mode shouldn't modify the original array
This commit is contained in:
@@ -465,9 +465,10 @@ static inline void remez9_0_log2_sse(double *values, size_t num)
|
|||||||
\
|
\
|
||||||
static inline type name##_log_sum_exp(type *array, size_t n) { \
|
static inline type name##_log_sum_exp(type *array, size_t n) { \
|
||||||
type max = name##_max(array, n); \
|
type max = name##_max(array, n); \
|
||||||
name##_sub(array, max, n); \
|
type result = 0; \
|
||||||
remez9_0_log2_sse(array, n); \
|
for (size_t i = 0; i < n; i++) { \
|
||||||
type result = name##_sum(array, n); \
|
result += exp(array[i] - max); \
|
||||||
|
} \
|
||||||
return max + log(result); \
|
return max + log(result); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user