| 
    SNAP Library 2.0, Developer Reference
    2013-05-13 16:33:57
    
   SNAP, a general purpose, high performance system for analysis and manipulation of large networks 
   | 
  
  
  
 
#include <mag.h>

Public Member Functions | |
| TMAGNodeBern () | |
| TMAGNodeBern (const int &_Dim, const double &_Mu=0.5) | |
| TMAGNodeBern (const TFltV &_MuV) | |
| TMAGNodeBern (const TMAGNodeBern &Dist) | |
| TMAGNodeBern & | operator= (const TMAGNodeBern &Dist) | 
| void | SetMuV (const TFltV &_MuV) | 
| const TFltV & | GetMuV () const | 
| void | SetMu (const int &Attr, const double &Prob) | 
| double | GetMu (const int &Attr) const | 
| void | LoadTxt (const TStr &InFNm) | 
| void | SaveTxt (TStrV &OutStrV) const | 
| void | AttrGen (TIntVV &AttrVV, const int &NNodes) | 
Static Public Attributes | |
| static TRnd | Rnd = TRnd(0) | 
Private Attributes | |
| TFltV | MuV | 
| TInt | Dim | 
| TMAGNodeBern::TMAGNodeBern | ( | ) |  [inline] | 
        
| TMAGNodeBern::TMAGNodeBern | ( | const int & | _Dim, | 
| const double & | _Mu = 0.5  | 
        ||
| ) |  [inline] | 
        
| TMAGNodeBern::TMAGNodeBern | ( | const TFltV & | _MuV | ) |  [inline] | 
        
| TMAGNodeBern::TMAGNodeBern | ( | const TMAGNodeBern & | Dist | ) |  [inline] | 
        
| void TMAGNodeBern::AttrGen | ( | TIntVV & | AttrVV, | 
| const int & | NNodes | ||
| ) | 
Definition at line 250 of file mag.cpp.
References TVVec< TVal >::At(), Dim, TVVec< TVal >::Gen(), IAssert, MuV, and TVVec< TVal >::PutAll().
                                                            {
        IAssert(Dim > 0);
        AttrVV.Gen(NNodes, Dim);
        AttrVV.PutAll(0);
        
        for(int i = 0; i < NNodes; i++) {
                for(int l = 0; l < Dim; l++) {
                        if((TMAGNodeBern::Rnd).GetUniDev() > MuV[l]) {
                                AttrVV.At(i, l) = 1;
                        }
                }
        }
}

| double TMAGNodeBern::GetMu | ( | const int & | Attr | ) |  const [inline] | 
        
Definition at line 105 of file mag.h.
References MuV.
Referenced by TMAGFitBern::UpdateApxPhiMI(), TMAGFitBern::UpdateMu(), TMAGFitBern::UpdatePhi(), and TMAGFitBern::UpdatePhiMI().
{  return MuV[Attr];  }

| const TFltV& TMAGNodeBern::GetMuV | ( | ) |  const [inline] | 
        
Definition at line 103 of file mag.h.
References MuV.
Referenced by TMAGFitBern::ComputeApxAdjLL(), TMAGFitBern::ComputeApxLL(), TMAGFitBern::ComputeJointAdjLL(), TMAGFitBern::ComputeJointOneLL(), TMAGFitBern::DoEMAlg(), TMAGFitBern::GetMuV(), and TMAGFitBern::UpdateAffMtxV().
{  return MuV;  }

| void TMAGNodeBern::LoadTxt | ( | const TStr & | InFNm | ) | 
Definition at line 264 of file mag.cpp.
References TVec< TVal, TSizeTy >::Add(), TStr::CStr(), Dim, TVec< TVal, TSizeTy >::Gen(), TStr::GetFlt(), IAssertR, TVec< TVal, TSizeTy >::Len(), and MuV.
                                            {
        FILE *fp = fopen(InFNm.CStr(), "r");
        IAssertR(fp != NULL, "File does not exist: " + InFNm);
        Dim = 0;
        MuV.Gen(10, 0);
        char buf[128];
        char *token;
        TStr TokenStr;
        TFlt Val;
        while(fgets(buf, sizeof(buf), fp) != NULL) {
                token = strtok(buf, "&");
                token = strtok(token, " \t");
                TokenStr = TStr(token);
                MuV.Add(TokenStr.GetFlt(Val));
        }
        Dim = MuV.Len();
        fclose(fp);
}

| TMAGNodeBern & TMAGNodeBern::operator= | ( | const TMAGNodeBern & | Dist | ) | 
| void TMAGNodeBern::SaveTxt | ( | TStrV & | OutStrV | ) | const | 
Definition at line 287 of file mag.cpp.
References TVec< TVal, TSizeTy >::Add(), Dim, TStr::Fmt(), TVec< TVal, TSizeTy >::Gen(), and MuV.
                                               {
        OutStrV.Gen(Dim, 0);
        for(int i = 0; i < Dim; i++) {
                OutStrV.Add(TStr::Fmt("%f", double(MuV[i])));
        }
}

| void TMAGNodeBern::SetMu | ( | const int & | Attr, | 
| const double & | Prob | ||
| ) |  [inline] | 
        
| void TMAGNodeBern::SetMuV | ( | const TFltV & | _MuV | ) |  [inline] | 
        
Definition at line 102 of file mag.h.
References MuV.
Referenced by TMAGFitBern::SetMuV().
{  MuV = _MuV;  }

TInt TMAGNodeBern::Dim [private] | 
        
TFltV TMAGNodeBern::MuV [private] | 
        
TRnd TMAGNodeBern::Rnd = TRnd(0) [static] |