SNAP Library , Developer Reference  2013-01-07 14:03:36
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
TFlt Class Reference

#include <dt.h>

Inheritance diagram for TFlt:
Collaboration diagram for TFlt:

List of all members.

Public Member Functions

 TFlt ()
 TFlt (const double &_Val)
 operator double () const
 TFlt (TSIn &SIn)
void Save (TSOut &SOut) const
 TFlt (TSIn &SIn, const bool &IsTxt)
void Load (TSIn &SIn)
void Save (TSOut &SOut, const bool &IsTxt) const
void LoadXml (const PXmlTok &XmlTok, const TStr &Nm)
void SaveXml (TSOut &SOut, const TStr &Nm) const
TFltoperator= (const TFlt &Flt)
TFltoperator= (const double &Flt)
bool operator== (const TFlt &Flt) const _CMPWARN
bool operator== (const double &Flt) const _CMPWARN
bool operator!= (const double &Flt) const _CMPWARN
double operator() () const
TFltoperator+= (const double &Flt)
TFltoperator-= (const double &Flt)
TFltoperator*= (const double &Flt)
TFltoperator/= (const double &Flt)
TFlt operator++ (int)
TFlt operator-- (int)
int GetMemUsed () const
int GetPrimHashCd () const
int GetSecHashCd () const
TStr GetStr () const

Static Public Member Functions

static double Abs (const double &Flt)
static int Sign (const double &Flt)
static int Round (const double &Flt)
static double GetRnd ()
static bool Eq6 (const double &LFlt, const double &RFlt)
static double GetMn (const double &Flt1, const double &Flt2)
static double GetMn (const double &Flt1, const double &Flt2, const double &Flt3)
static double GetMn (const double &Flt1, const double &Flt2, const double &Flt3, const double &Flt4)
static double GetMx (const double &Flt1, const double &Flt2)
static double GetMx (const double &Flt1, const double &Flt2, const double Flt3)
static double GetMx (const double &Flt1, const double &Flt2, const double Flt3, const double &Flt4)
static double GetInRng (const double &Val, const double &Mn, const double &Mx)
static double IsNum (const double &Val)
static TStr GetStr (const double &Val, const int &Width=-1, const int &Prec=-1)
static TStr GetStr (const TFlt &Flt, const int &Width=-1, const int &Prec=-1)
static TStr GetStr (const double &Val, const char *FmtStr)
static TStr GetStr (const double &Val, const TStr &FmtStr)
static TStr GetPrcStr (const double &RelVal, const double &FullVal)
static TStr GetKiloStr (const double &Val)
static TStr GetMegaStr (const double &Val)
static TStr GetGigaStr (const double &Val)

Public Attributes

double Val

Static Public Attributes

static const double Mn = -DBL_MAX
static const double Mx = +DBL_MAX
static const double NInf = -DBL_MAX
static const double PInf = +DBL_MAX
static const double Eps = 1e-16
static const double EpsHalf = 1e-7
static TRnd Rnd

Detailed Description

Definition at line 1272 of file dt.h.


Constructor & Destructor Documentation

TFlt::TFlt ( ) [inline]

Definition at line 1284 of file dt.h.

Referenced by GetMemUsed().

: Val(0){}

Here is the caller graph for this function:

TFlt::TFlt ( const double &  _Val) [inline]

Definition at line 1285 of file dt.h.

: Val(_Val){}
TFlt::TFlt ( TSIn SIn) [inline, explicit]

Definition at line 1287 of file dt.h.

References TSIn::Load(), and Val.

{SIn.Load(Val);}

Here is the call graph for this function:

TFlt::TFlt ( TSIn SIn,
const bool &  IsTxt 
) [inline, explicit]

Definition at line 1289 of file dt.h.

References TStr::GetFlt(), TSIn::Load(), and Val.

                                             {
    if (IsTxt){TStr Str(SIn, true); Val=Str.GetFlt(0);} else {SIn.Load(Val);}}

Here is the call graph for this function:


Member Function Documentation

static double TFlt::Abs ( const double &  Flt) [inline, static]
static bool TFlt::Eq6 ( const double &  LFlt,
const double &  RFlt 
) [inline, static]

Definition at line 1320 of file dt.h.

                                                         {
    return fabs(LFlt-RFlt)<0.000001;}
static TStr TFlt::GetGigaStr ( const double &  Val) [inline, static]

Definition at line 1360 of file dt.h.

References TStr::Fmt(), and GetMegaStr().

                                           {
    if (fabs(Val)>100*1000000000.0){return TStr::Fmt("%.0fG", Val/1000000000.0);}
    else if (fabs(Val)>1000000000.0){return TStr::Fmt("%.1fG", Val/1000000000.0);}
    else {return GetMegaStr(Val);}}

Here is the call graph for this function:

static double TFlt::GetInRng ( const double &  Val,
const double &  Mn,
const double &  Mx 
) [inline, static]

Definition at line 1337 of file dt.h.

References IAssert, and Val.

                                                                               {
    IAssert(Mn<=Mx); return Val<Mn?Mn:(Val>Mx?Mx:Val);}
static TStr TFlt::GetKiloStr ( const double &  Val) [inline, static]

Definition at line 1352 of file dt.h.

References TStr::Fmt().

Referenced by GetMegaStr().

                                           {
    if (fabs(Val)>100*1000){return TStr::Fmt("%.0fK", Val/1000);}
    else if (fabs(Val)>1000){return TStr::Fmt("%.1fK", Val/1000);}
    else {return TStr::Fmt("%.0f", Val);}}

Here is the call graph for this function:

Here is the caller graph for this function:

static TStr TFlt::GetMegaStr ( const double &  Val) [inline, static]

Definition at line 1356 of file dt.h.

References TStr::Fmt(), and GetKiloStr().

Referenced by GetGigaStr().

                                           {
    if (fabs(Val)>100*1000000){return TStr::Fmt("%.0fM", Val/1000000);}
    else if (fabs(Val)>1000000){return TStr::Fmt("%.1fM", Val/1000000);}
    else {return GetKiloStr(Val);}}

Here is the call graph for this function:

Here is the caller graph for this function:

int TFlt::GetMemUsed ( ) const [inline]

Definition at line 1309 of file dt.h.

References TFlt().

{return sizeof(TFlt);}

Here is the call graph for this function:

static double TFlt::GetMn ( const double &  Flt1,
const double &  Flt2 
) [inline, static]

Definition at line 1323 of file dt.h.

Referenced by TNIBs::ComputePerformanceNId(), TNIBs::GenCascade(), GetMn(), and TFltRect::Intersection().

                                                             {
    return Flt1<Flt2?Flt1:Flt2;}

Here is the caller graph for this function:

static double TFlt::GetMn ( const double &  Flt1,
const double &  Flt2,
const double &  Flt3 
) [inline, static]

Definition at line 1325 of file dt.h.

References GetMn().

                                                                                 {
    return GetMn(GetMn(Flt1, Flt2), Flt3); }

Here is the call graph for this function:

static double TFlt::GetMn ( const double &  Flt1,
const double &  Flt2,
const double &  Flt3,
const double &  Flt4 
) [inline, static]

Definition at line 1327 of file dt.h.

References GetMn().

                                                                                                     {
    return GetMn(GetMn(Flt1, Flt2), GetMn(Flt3, Flt4)); }

Here is the call graph for this function:

static double TFlt::GetMx ( const double &  Flt1,
const double &  Flt2 
) [inline, static]

Definition at line 1330 of file dt.h.

Referenced by TNetInfBs::GenCascade(), GetMx(), TFltRect::Intersection(), TSparseSVD::Lanczos(), TSparseSVD::Lanczos2(), and TLinAlg::NormLinf().

                                                             {
    return Flt1>Flt2?Flt1:Flt2;}

Here is the caller graph for this function:

static double TFlt::GetMx ( const double &  Flt1,
const double &  Flt2,
const double  Flt3 
) [inline, static]

Definition at line 1332 of file dt.h.

References GetMx().

                                                                                {
    return GetMx(GetMx(Flt1, Flt2), Flt3); }

Here is the call graph for this function:

static double TFlt::GetMx ( const double &  Flt1,
const double &  Flt2,
const double  Flt3,
const double &  Flt4 
) [inline, static]

Definition at line 1334 of file dt.h.

References GetMx().

                                                                                                    {
    return GetMx(GetMx(Flt1, Flt2), GetMx(Flt3, Flt4)); }

Here is the call graph for this function:

static TStr TFlt::GetPrcStr ( const double &  RelVal,
const double &  FullVal 
) [inline, static]

Definition at line 1349 of file dt.h.

References GetStr().

                                                                    {
    return GetStr(100*RelVal/FullVal, "%3.0f%%");}

Here is the call graph for this function:

int TFlt::GetPrimHashCd ( ) const [inline]

Definition at line 1311 of file dt.h.

References TInt::Mx, and Val.

                            {
    int Expn; return int((frexp(Val, &Expn)-0.5)*double(TInt::Mx));}
static double TFlt::GetRnd ( ) [inline, static]

Definition at line 1319 of file dt.h.

References TRnd::GetUniDev(), and Rnd.

{return Rnd.GetUniDev();}

Here is the call graph for this function:

int TFlt::GetSecHashCd ( ) const [inline]

Definition at line 1313 of file dt.h.

References Val.

                           {
    int Expn; frexp(Val, &Expn); return Expn;}
TStr TFlt::GetStr ( const double &  Val,
const int &  Width = -1,
const int &  Prec = -1 
) [static]

Definition at line 2189 of file dt.cpp.

                                                                     {
  char Bf[255];
  if ((Width==-1)&&(Prec==-1)){sprintf(Bf, "%g", Val);}
  else {sprintf(Bf, "%*.*f", Width, Prec, Val);}
  return TStr(Bf);
}
static TStr TFlt::GetStr ( const TFlt Flt,
const int &  Width = -1,
const int &  Prec = -1 
) [inline, static]

Definition at line 1344 of file dt.h.

References GetStr(), and Val.

                                                                              {
    return GetStr(Flt.Val, Width, Prec);}

Here is the call graph for this function:

TStr TFlt::GetStr ( const double &  Val,
const char *  FmtStr 
) [static]

Definition at line 2196 of file dt.cpp.

References GetStr().

                                                      {
  if (FmtStr==NULL){
    return GetStr(Val);
  } else {
    char Bf[255];
    sprintf(Bf, FmtStr, Val);
    return TStr(Bf);
  }
}

Here is the call graph for this function:

static TStr TFlt::GetStr ( const double &  Val,
const TStr FmtStr 
) [inline, static]

Definition at line 1347 of file dt.h.

References TStr::CStr(), and GetStr().

                                                           {
    return GetStr(Val, FmtStr.CStr());}

Here is the call graph for this function:

static double TFlt::IsNum ( const double &  Val) [inline, static]

Definition at line 1339 of file dt.h.

References Mn, and Mx.

                                        {
    return (Mn<=Val)&&(Val<=Mx);}
void TFlt::Load ( TSIn SIn) [inline]

Definition at line 1291 of file dt.h.

References TSIn::Load(), and Val.

Referenced by TSigmoid::Load(), and TSigmoid::TSigmoid().

{SIn.Load(Val);}

Here is the call graph for this function:

Here is the caller graph for this function:

void TFlt::LoadXml ( const PXmlTok XmlTok,
const TStr Nm 
)

Definition at line 2180 of file dt.cpp.

References TXmlObjSer::GetFltArg(), Val, and XLoadHd.

                                                       {
  XLoadHd(Nm);
  Val=TXmlObjSer::GetFltArg(XmlTok, "Val");
}

Here is the call graph for this function:

TFlt::operator double ( ) const [inline]

Definition at line 1286 of file dt.h.

References Val.

{return Val;}
bool TFlt::operator!= ( const double &  Flt) const [inline]

Definition at line 1301 of file dt.h.

References Val.

{return Val!=Flt;}
double TFlt::operator() ( ) const [inline]

Definition at line 1302 of file dt.h.

References Val.

{return Val;}
TFlt& TFlt::operator*= ( const double &  Flt) [inline]

Definition at line 1305 of file dt.h.

References Val.

{Val*=Flt; return *this;}
TFlt TFlt::operator++ ( int  ) [inline]

Definition at line 1307 of file dt.h.

References Val.

{Val++; return *this;}
TFlt& TFlt::operator+= ( const double &  Flt) [inline]

Definition at line 1303 of file dt.h.

References Val.

{Val+=Flt; return *this;}
TFlt TFlt::operator-- ( int  ) [inline]

Definition at line 1308 of file dt.h.

References Val.

{Val--; return *this;}
TFlt& TFlt::operator-= ( const double &  Flt) [inline]

Definition at line 1304 of file dt.h.

References Val.

{Val-=Flt; return *this;}
TFlt& TFlt::operator/= ( const double &  Flt) [inline]

Definition at line 1306 of file dt.h.

References Val.

{Val/=Flt; return *this;}
TFlt& TFlt::operator= ( const TFlt Flt) [inline]

Definition at line 1297 of file dt.h.

References Val.

{Val=Flt.Val; return *this;}
TFlt& TFlt::operator= ( const double &  Flt) [inline]

Definition at line 1298 of file dt.h.

References Val.

{Val=Flt; return *this;}
bool TFlt::operator== ( const TFlt Flt) const [inline]

Definition at line 1299 of file dt.h.

References Val.

{return Val==Flt.Val;}
bool TFlt::operator== ( const double &  Flt) const [inline]

Definition at line 1300 of file dt.h.

References Val.

{return Val==Flt;}
static int TFlt::Round ( const double &  Flt) [inline, static]

Definition at line 1318 of file dt.h.

Referenced by TTmStopWatch::GetMSecInt(), TExeTm::GetSecInt(), and TTmStopWatch::GetSecInt().

{return int(floor(Flt+0.5));}

Here is the caller graph for this function:

void TFlt::Save ( TSOut SOut) const [inline]

Reimplemented in TAscFlt.

Definition at line 1288 of file dt.h.

References TSOut::Save(), and Val.

Referenced by TCascade::Save(), TPpVal::Save(), THitInfo::Save(), TLocClustStat::Save(), TSigmoid::Save(), and TFltRect::Save().

{SOut.Save(Val);}

Here is the call graph for this function:

Here is the caller graph for this function:

void TFlt::Save ( TSOut SOut,
const bool &  IsTxt 
) const [inline]

Definition at line 1292 of file dt.h.

References GetStr(), TSOut::Save(), TStr::Save(), and Val.

                                                  {
    if (IsTxt){GetStr(Val).Save(SOut, true);} else {SOut.Save(Val);}}

Here is the call graph for this function:

void TFlt::SaveXml ( TSOut SOut,
const TStr Nm 
) const

Definition at line 2185 of file dt.cpp.

References GetStr(), Val, and XSaveBETagArg.

                                                    {
  XSaveBETagArg(Nm, "Val", TFlt::GetStr(Val));
}

Here is the call graph for this function:

static int TFlt::Sign ( const double &  Flt) [inline, static]

Definition at line 1317 of file dt.h.

{return Flt<0?-1:(Flt>0?1:0);}

Member Data Documentation

const double TFlt::Eps = 1e-16 [static]

Definition at line 1280 of file dt.h.

const double TFlt::EpsHalf = 1e-7 [static]

Definition at line 1281 of file dt.h.

const double TFlt::Mn = -DBL_MAX [static]

Definition at line 1276 of file dt.h.

Referenced by TMom::Def(), TNetInfBs::GetBestEdge(), GetMinMax(), TSnap::GetSngVec(), and IsNum().

const double TFlt::NInf = -DBL_MAX [static]

Definition at line 1278 of file dt.h.

const double TFlt::PInf = +DBL_MAX [static]

Definition at line 1279 of file dt.h.

TRnd TFlt::Rnd [static]

Definition at line 1282 of file dt.h.

Referenced by TNIBs::BSG(), TNetInfBs::GenCascade(), TNIBs::GenCascade(), GetRnd(), and TNIBs::SG().


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