epinowcast

Go to the source code of this file.
Functions  
real  log_dot_product (vector x, vector y) 
int  num_nonzero (matrix x) 
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 logspace operations are common, such as in the computation of loglikelihoods.
Definition at line 26 of file utils.stan.
int num_nonzero  (  matrix  x  ) 
Count the number of nonzero elements in a matrix
This function iterates through all elements of a given matrix and counts the number of elements that are not equal to zero.
x  The input matrix to be analyzed. 
Definition at line 44 of file utils.stan.