epinowcast
|
Go to the source code of this file.
Functions | |
real | log_dot_product (vector x, vector y) |
real log_dot_product | ( | vector | x, |
vector | y | ||
) |
Compute dot product on the log scale
Calculates the dot product of two vectors on the log scale efficiently. This function is designed to handle operations where the vectors are represented in log space, avoiding potential underflow issues that can arise with standard dot product calculations on the natural scale, especially with small values.
x | First vector in log space. |
y | Second vector in log space. |
x
and y
(since they are in log space).log_sum_exp
to the result, which efficiently calculates the logarithm of the sum of exponentials, corresponding to the log of the dot product.This approach is particularly useful in statistical contexts where log-space operations are common, such as in the computation of log-likelihoods.
Definition at line 26 of file utils.stan.