SNAP Library 2.2, Developer Reference  2014-03-11 19:15:55
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
mag.h File Reference
#include "Snap.h"
#include "kronecker.h"
Include dependency graph for mag.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  TMAGAffMtx
class  TMAGNodeSimple
class  TMAGNodeBern
class  TMAGNodeBeta
class  TMAGParam< TNodeAttr >
class  TMAGFitBern

Typedefs

typedef TVec< TMAGAffMtxTMAGAffMtxV

Functions

const double LogSumExp (const double LogVal1, const double LogVal2)
const double LogSumExp (const TFltV &LogValV)
const double LogSumExp (const double *LogValArray, const int Len)

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.

Referenced by TMAGFitBern::GradApxAffMtx(), LogSumExp(), TMAGFitBern::UpdateApxPhiMI(), TMAGFitBern::UpdatePhi(), and TMAGFitBern::UpdatePhiMI().

                                                                   {
        double MaxExp = (LogVal1 > LogVal2) ? LogVal1 : LogVal2;
        double Sum = exp(LogVal1 - MaxExp) + exp(LogVal2 - MaxExp);
        return (log(Sum) + MaxExp);
}

Here is the caller graph for this function:

const double LogSumExp ( const TFltV LogValV)

Definition at line 681 of file mag.cpp.

References TVec< TVal, TSizeTy >::Len().

                                             {
        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);
}

Here is the call graph for this function:

const double LogSumExp ( const double *  LogValArray,
const int  Len 
)

Definition at line 697 of file mag.cpp.

References LogSumExp().

                                                                 {
        TFltV TmpV(Len);
        for(int i = 0; i < Len; i++) {  TmpV[i] = LogValArray[i];  }
        return LogSumExp(TmpV);
}

Here is the call graph for this function: