#include "Snap.h"
#include "kronecker.h"
Go to the source code of this file.
|
const double | LogSumExp (const double LogVal1, const double LogVal2) |
|
const double | LogSumExp (const TFltV &LogValV) |
|
const double | LogSumExp (const double *LogValArray, const int Len) |
|
Definition at line 62 of file mag.h.
const double LogSumExp |
( |
const double |
LogVal1, |
|
|
const double |
LogVal2 |
|
) |
| |
Definition at line 675 of file mag.cpp.
676 double MaxExp = (LogVal1 > LogVal2) ? LogVal1 : LogVal2;
677 double Sum = exp(LogVal1 - MaxExp) + exp(LogVal2 - MaxExp);
678 return (log(Sum) + MaxExp);
const double LogSumExp |
( |
const TFltV & |
LogValV | ) |
|
Definition at line 681 of file mag.cpp.
682 const int Len = LogValV.
Len();
683 double MaxExp = -DBL_MAX;
685 for(
int i = 0; i < Len; i++) {
686 if(MaxExp < LogValV[i]) { MaxExp = LogValV[i]; }
690 for(
int i = 0; i < Len; i++) {
691 Sum += exp(LogValV[i] - MaxExp);
694 return (log(Sum) + MaxExp);
TSizeTy Len() const
Returns the number of elements in the vector.
const double LogSumExp |
( |
const double * |
LogValArray, |
|
|
const int |
Len |
|
) |
| |
Definition at line 697 of file mag.cpp.
699 for(
int i = 0; i < Len; i++) { TmpV[i] = LogValArray[i]; }
const double LogSumExp(const double LogVal1, const double LogVal2)