#include "Snap.h"
#include "kronecker.h"
Go to the source code of this file.
Typedef Documentation
Definition at line 62 of file mag.h.
Function Documentation
const double LogSumExp |
( |
const double |
LogVal1, |
|
|
const double |
LogVal2 |
|
) |
| |
Definition at line 675 of file mag.cpp.
{
double MaxExp = (LogVal1 > LogVal2) ? LogVal1 : LogVal2;
double Sum = exp(LogVal1 - MaxExp) + exp(LogVal2 - MaxExp);
return (log(Sum) + MaxExp);
}
Definition at line 681 of file mag.cpp.
{
const int Len = LogValV.Len();
double MaxExp = -DBL_MAX;
for(int i = 0; i < Len; i++) {
if(MaxExp < LogValV[i]) { MaxExp = LogValV[i]; }
}
double Sum = 0.0;
for(int i = 0; i < Len; i++) {
Sum += exp(LogValV[i] - MaxExp);
}
return (log(Sum) + MaxExp);
}
const double LogSumExp |
( |
const double * |
LogValArray, |
|
|
const int |
Len |
|
) |
| |
Definition at line 697 of file mag.cpp.
{
TFltV TmpV(Len);
for(int i = 0; i < Len; i++) { TmpV[i] = LogValArray[i]; }
return LogSumExp(TmpV);
}