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
TMAGNodeSimple Class Reference

#include <mag.h>

Collaboration diagram for TMAGNodeSimple:

List of all members.

Public Member Functions

 TMAGNodeSimple ()
 TMAGNodeSimple (const int &_Dim, const double &_Mu=0.5)
 TMAGNodeSimple (const TMAGNodeSimple &Simple)
TMAGNodeSimpleoperator= (const TMAGNodeSimple &Simple)
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

TFlt Mu
TInt Dim

Detailed Description

Definition at line 67 of file mag.h.


Constructor & Destructor Documentation

Definition at line 74 of file mag.h.

: Mu(0.5), Dim(-1) {}
TMAGNodeSimple::TMAGNodeSimple ( const int &  _Dim,
const double &  _Mu = 0.5 
) [inline]

Definition at line 75 of file mag.h.

References IAssert, and Mu.

: Dim(_Dim) {  IAssert(_Mu >= 0.0 && _Mu <= 1.0);  Mu = _Mu;  }
TMAGNodeSimple::TMAGNodeSimple ( const TMAGNodeSimple Simple) [inline]

Definition at line 76 of file mag.h.

: Mu(Simple.Mu), Dim(Simple.Dim) {}

Member Function Documentation

void TMAGNodeSimple::AttrGen ( TIntVV AttrVV,
const int &  NNodes 
)

Definition at line 201 of file mag.cpp.

References TVVec< TVal >::At(), Dim, TVVec< TVal >::Gen(), IAssert, Mu, 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((TMAGNodeSimple::Rnd).GetUniDev() > Mu) {
                                AttrVV.At(i, l) = 1;
                        }
                }
        }
}

Here is the call graph for this function:

void TMAGNodeSimple::LoadTxt ( const TStr InFNm)

Definition at line 215 of file mag.cpp.

References TStr::CStr(), TStr::GetFlt(), IAssertR, and Mu.

                                              {
        FILE *fp = fopen(InFNm.CStr(), "r");
        IAssertR(fp != NULL, "File does not exist: " + InFNm);

        char buf[128];
        char *token;
        TStr TokenStr;
        TFlt Val;

        token = strtok(buf, "&");
        token = strtok(token, " \t");
        TokenStr = TStr(token);
        Mu = TokenStr.GetFlt(Val);

        fclose(fp);
}

Here is the call graph for this function:

TMAGNodeSimple& TMAGNodeSimple::operator= ( const TMAGNodeSimple Simple) [inline]

Definition at line 78 of file mag.h.

References Dim, and Mu.

{  Mu = Simple.Mu;  Dim = Simple.Dim;  return (*this);  }
void TMAGNodeSimple::SaveTxt ( TStrV OutStrV) const

Definition at line 232 of file mag.cpp.

References TVec< TVal, TSizeTy >::Add(), Dim, TStr::Fmt(), TVec< TVal, TSizeTy >::Gen(), and Mu.

                                                 {
        OutStrV.Gen(Dim, 0);

        for(int i = 0; i < Dim; i++) {
                OutStrV.Add(TStr::Fmt("%f", double(Mu)));
        }
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 72 of file mag.h.

Referenced by AttrGen(), operator=(), and SaveTxt().

Definition at line 71 of file mag.h.

Referenced by AttrGen(), LoadTxt(), operator=(), SaveTxt(), and TMAGNodeSimple().

TRnd TMAGNodeSimple::Rnd = TRnd(0) [static]

Definition at line 69 of file mag.h.


The documentation for this class was generated from the following files: