SNAP Library 2.3, Developer Reference  2014-06-16 11:58:46
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TFlt Class Reference

#include <dt.h>

Inheritance diagram for TFlt:
Collaboration diagram for TFlt:

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
 
bool IsNum () const
 
bool IsNan () 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 bool IsNum (const double &Val)
 
static bool IsNan (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 1289 of file dt.h.

Constructor & Destructor Documentation

TFlt::TFlt ( )
inline

Definition at line 1301 of file dt.h.

Referenced by GetMemUsed().

1301 : Val(0){}
double Val
Definition: dt.h:1291

Here is the caller graph for this function:

TFlt::TFlt ( const double &  _Val)
inline

Definition at line 1302 of file dt.h.

1302 : Val(_Val){}
double Val
Definition: dt.h:1291
TFlt::TFlt ( TSIn SIn)
inlineexplicit

Definition at line 1304 of file dt.h.

References TSIn::Load(), and Val.

1304 {SIn.Load(Val);}
double Val
Definition: dt.h:1291
void Load(bool &Bool)
Definition: fl.h:84

Here is the call graph for this function:

TFlt::TFlt ( TSIn SIn,
const bool &  IsTxt 
)
inlineexplicit

Definition at line 1306 of file dt.h.

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

1306  {
1307  if (IsTxt){TStr Str(SIn, true); Val=Str.GetFlt(0);} else {SIn.Load(Val);}}
double Val
Definition: dt.h:1291
void Load(bool &Bool)
Definition: fl.h:84
Definition: dt.h:412

Here is the call graph for this function:

Member Function Documentation

static double TFlt::Abs ( const double &  Flt)
inlinestatic
static bool TFlt::Eq6 ( const double &  LFlt,
const double &  RFlt 
)
inlinestatic

Definition at line 1337 of file dt.h.

1337  {
1338  return fabs(LFlt-RFlt)<0.000001;}
static TStr TFlt::GetGigaStr ( const double &  Val)
inlinestatic

Definition at line 1383 of file dt.h.

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

1383  {
1384  if (fabs(Val)>100*1000000000.0){return TStr::Fmt("%.0fG", Val/1000000000.0);}
1385  else if (fabs(Val)>1000000000.0){return TStr::Fmt("%.1fG", Val/1000000000.0);}
1386  else {return GetMegaStr(Val);}}
double Val
Definition: dt.h:1291
static TStr GetMegaStr(const double &Val)
Definition: dt.h:1379
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599

Here is the call graph for this function:

static double TFlt::GetInRng ( const double &  Val,
const double &  Mn,
const double &  Mx 
)
inlinestatic

Definition at line 1354 of file dt.h.

References IAssert, and Val.

1354  {
1355  IAssert(Mn<=Mx); return Val<Mn?Mn:(Val>Mx?Mx:Val);}
#define IAssert(Cond)
Definition: bd.h:262
double Val
Definition: dt.h:1291
static const double Mx
Definition: dt.h:1294
static const double Mn
Definition: dt.h:1293
static TStr TFlt::GetKiloStr ( const double &  Val)
inlinestatic

Definition at line 1375 of file dt.h.

References TStr::Fmt().

Referenced by GetMegaStr().

1375  {
1376  if (fabs(Val)>100*1000){return TStr::Fmt("%.0fK", Val/1000);}
1377  else if (fabs(Val)>1000){return TStr::Fmt("%.1fK", Val/1000);}
1378  else {return TStr::Fmt("%.0f", Val);}}
double Val
Definition: dt.h:1291
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599

Here is the call graph for this function:

Here is the caller graph for this function:

static TStr TFlt::GetMegaStr ( const double &  Val)
inlinestatic

Definition at line 1379 of file dt.h.

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

Referenced by GetGigaStr().

1379  {
1380  if (fabs(Val)>100*1000000){return TStr::Fmt("%.0fM", Val/1000000);}
1381  else if (fabs(Val)>1000000){return TStr::Fmt("%.1fM", Val/1000000);}
1382  else {return GetKiloStr(Val);}}
double Val
Definition: dt.h:1291
static TStr GetKiloStr(const double &Val)
Definition: dt.h:1375
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599

Here is the call graph for this function:

Here is the caller graph for this function:

int TFlt::GetMemUsed ( ) const
inline

Definition at line 1326 of file dt.h.

References TFlt().

1326 {return sizeof(TFlt);}
TFlt()
Definition: dt.h:1301

Here is the call graph for this function:

static double TFlt::GetMn ( const double &  Flt1,
const double &  Flt2 
)
inlinestatic

Definition at line 1340 of file dt.h.

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

1340  {
1341  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 
)
inlinestatic

Definition at line 1342 of file dt.h.

References GetMn().

1342  {
1343  return GetMn(GetMn(Flt1, Flt2), Flt3); }
static double GetMn(const double &Flt1, const double &Flt2)
Definition: dt.h:1340

Here is the call graph for this function:

static double TFlt::GetMn ( const double &  Flt1,
const double &  Flt2,
const double &  Flt3,
const double &  Flt4 
)
inlinestatic

Definition at line 1344 of file dt.h.

References GetMn().

1344  {
1345  return GetMn(GetMn(Flt1, Flt2), GetMn(Flt3, Flt4)); }
static double GetMn(const double &Flt1, const double &Flt2)
Definition: dt.h:1340

Here is the call graph for this function:

static double TFlt::GetMx ( const double &  Flt1,
const double &  Flt2 
)
inlinestatic

Definition at line 1347 of file dt.h.

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

1347  {
1348  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 
)
inlinestatic

Definition at line 1349 of file dt.h.

References GetMx().

1349  {
1350  return GetMx(GetMx(Flt1, Flt2), Flt3); }
static double GetMx(const double &Flt1, const double &Flt2)
Definition: dt.h:1347

Here is the call graph for this function:

static double TFlt::GetMx ( const double &  Flt1,
const double &  Flt2,
const double  Flt3,
const double &  Flt4 
)
inlinestatic

Definition at line 1351 of file dt.h.

References GetMx().

1351  {
1352  return GetMx(GetMx(Flt1, Flt2), GetMx(Flt3, Flt4)); }
static double GetMx(const double &Flt1, const double &Flt2)
Definition: dt.h:1347

Here is the call graph for this function:

static TStr TFlt::GetPrcStr ( const double &  RelVal,
const double &  FullVal 
)
inlinestatic

Definition at line 1372 of file dt.h.

References GetStr().

1372  {
1373  return GetStr(100*RelVal/FullVal, "%3.0f%%");}
TStr GetStr() const
Definition: dt.h:1365

Here is the call graph for this function:

int TFlt::GetPrimHashCd ( ) const
inline

Definition at line 1328 of file dt.h.

References TInt::Mx, and Val.

1328  {
1329  int Expn; return int((frexp(Val, &Expn)-0.5)*double(TInt::Mx));}
static const int Mx
Definition: dt.h:1046
double Val
Definition: dt.h:1291
static double TFlt::GetRnd ( )
inlinestatic

Definition at line 1336 of file dt.h.

References TRnd::GetUniDev(), and Rnd.

1336 {return Rnd.GetUniDev();}
double GetUniDev()
Definition: dt.h:30
static TRnd Rnd
Definition: dt.h:1299

Here is the call graph for this function:

int TFlt::GetSecHashCd ( ) const
inline

Definition at line 1330 of file dt.h.

References Val.

1330  {
1331  int Expn; frexp(Val, &Expn); return Expn;}
double Val
Definition: dt.h:1291
TStr TFlt::GetStr ( const double &  Val,
const int &  Width = -1,
const int &  Prec = -1 
)
static

Definition at line 2236 of file dt.cpp.

2236  {
2237  char Bf[255];
2238  if ((Width==-1)&&(Prec==-1)){sprintf(Bf, "%g", Val);}
2239  else {sprintf(Bf, "%*.*f", Width, Prec, Val);}
2240  return TStr(Bf);
2241 }
double Val
Definition: dt.h:1291
Definition: dt.h:412
static TStr TFlt::GetStr ( const TFlt Flt,
const int &  Width = -1,
const int &  Prec = -1 
)
inlinestatic

Definition at line 1367 of file dt.h.

References GetStr(), and Val.

1367  {
1368  return GetStr(Flt.Val, Width, Prec);}
double Val
Definition: dt.h:1291
TStr GetStr() const
Definition: dt.h:1365

Here is the call graph for this function:

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

Definition at line 2243 of file dt.cpp.

References GetStr().

2243  {
2244  if (FmtStr==NULL){
2245  return GetStr(Val);
2246  } else {
2247  char Bf[255];
2248  sprintf(Bf, FmtStr, Val);
2249  return TStr(Bf);
2250  }
2251 }
double Val
Definition: dt.h:1291
Definition: dt.h:412
TStr GetStr() const
Definition: dt.h:1365

Here is the call graph for this function:

static TStr TFlt::GetStr ( const double &  Val,
const TStr FmtStr 
)
inlinestatic

Definition at line 1370 of file dt.h.

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

1370  {
1371  return GetStr(Val, FmtStr.CStr());}
double Val
Definition: dt.h:1291
TStr GetStr() const
Definition: dt.h:1365
char * CStr()
Definition: dt.h:476

Here is the call graph for this function:

static bool TFlt::IsNan ( const double &  Val)
inlinestatic

Definition at line 1359 of file dt.h.

1359  {
1360  return (Val!=Val);}
double Val
Definition: dt.h:1291
bool TFlt::IsNan ( ) const
inline

Definition at line 1363 of file dt.h.

References IsNan(), and Val.

Referenced by IsNan().

1363 { return IsNan(Val); }
double Val
Definition: dt.h:1291
bool IsNan() const
Definition: dt.h:1363

Here is the call graph for this function:

Here is the caller graph for this function:

static bool TFlt::IsNum ( const double &  Val)
inlinestatic

Definition at line 1357 of file dt.h.

References Mn, and Mx.

1357  {
1358  return (Mn<=Val)&&(Val<=Mx);}
double Val
Definition: dt.h:1291
static const double Mx
Definition: dt.h:1294
static const double Mn
Definition: dt.h:1293
bool TFlt::IsNum ( ) const
inline

Definition at line 1362 of file dt.h.

References IsNum(), and Val.

Referenced by IsNum().

1362 { return IsNum(Val); }
double Val
Definition: dt.h:1291
bool IsNum() const
Definition: dt.h:1362

Here is the call graph for this function:

Here is the caller graph for this function:

void TFlt::Load ( TSIn SIn)
inline

Definition at line 1308 of file dt.h.

References TSIn::Load(), and Val.

Referenced by TAGMFit::Load(), TAGMFast::Load(), TCoda::Load(), TCesna::Load(), TSigmoid::Load(), and TSigmoid::TSigmoid().

1308 {SIn.Load(Val);}
double Val
Definition: dt.h:1291
void Load(bool &Bool)
Definition: fl.h:84

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 2227 of file dt.cpp.

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

2227  {
2228  XLoadHd(Nm);
2229  Val=TXmlObjSer::GetFltArg(XmlTok, "Val");
2230 }
#define XLoadHd(Nm)
Definition: bd.h:312
double Val
Definition: dt.h:1291
static double GetFltArg(const PXmlTok &XmlTok, const TStr &Nm)
Definition: xml.cpp:104

Here is the call graph for this function:

TFlt::operator double ( ) const
inline

Definition at line 1303 of file dt.h.

References Val.

1303 {return Val;}
double Val
Definition: dt.h:1291
bool TFlt::operator!= ( const double &  Flt) const
inline

Definition at line 1318 of file dt.h.

References Val.

1318 {return Val!=Flt;}
double Val
Definition: dt.h:1291
double TFlt::operator() ( ) const
inline

Definition at line 1319 of file dt.h.

References Val.

1319 {return Val;}
double Val
Definition: dt.h:1291
TFlt& TFlt::operator*= ( const double &  Flt)
inline

Definition at line 1322 of file dt.h.

References Val.

1322 {Val*=Flt; return *this;}
double Val
Definition: dt.h:1291
TFlt TFlt::operator++ ( int  )
inline

Definition at line 1324 of file dt.h.

References Val.

1324 {Val++; return *this;}
double Val
Definition: dt.h:1291
TFlt& TFlt::operator+= ( const double &  Flt)
inline

Definition at line 1320 of file dt.h.

References Val.

1320 {Val+=Flt; return *this;}
double Val
Definition: dt.h:1291
TFlt TFlt::operator-- ( int  )
inline

Definition at line 1325 of file dt.h.

References Val.

1325 {Val--; return *this;}
double Val
Definition: dt.h:1291
TFlt& TFlt::operator-= ( const double &  Flt)
inline

Definition at line 1321 of file dt.h.

References Val.

1321 {Val-=Flt; return *this;}
double Val
Definition: dt.h:1291
TFlt& TFlt::operator/= ( const double &  Flt)
inline

Definition at line 1323 of file dt.h.

References Val.

1323 {Val/=Flt; return *this;}
double Val
Definition: dt.h:1291
TFlt& TFlt::operator= ( const TFlt Flt)
inline

Definition at line 1314 of file dt.h.

References Val.

1314 {Val=Flt.Val; return *this;}
double Val
Definition: dt.h:1291
TFlt& TFlt::operator= ( const double &  Flt)
inline

Definition at line 1315 of file dt.h.

References Val.

1315 {Val=Flt; return *this;}
double Val
Definition: dt.h:1291
bool TFlt::operator== ( const TFlt Flt) const
inline

Definition at line 1316 of file dt.h.

References Val.

1316 {return Val==Flt.Val;}
double Val
Definition: dt.h:1291
bool TFlt::operator== ( const double &  Flt) const
inline

Definition at line 1317 of file dt.h.

References Val.

1317 {return Val==Flt;}
double Val
Definition: dt.h:1291
static int TFlt::Round ( const double &  Flt)
inlinestatic

Definition at line 1335 of file dt.h.

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

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

Here is the caller graph for this function:

void TFlt::Save ( TSOut SOut) const
inline

Definition at line 1305 of file dt.h.

References TSOut::Save(), and Val.

Referenced by TJsonVal::Save(), TCascade::Save(), TAGMFit::Save(), TPpVal::Save(), TAGMFast::Save(), THitInfo::Save(), TCoda::Save(), TLocClustStat::Save(), TCesna::Save(), TSigmoid::Save(), TAscFlt::Save(), and TFltRect::Save().

1305 {SOut.Save(Val);}
double Val
Definition: dt.h:1291
void Save(const bool &Bool)
Definition: fl.h:173

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 1309 of file dt.h.

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

1309  {
1310  if (IsTxt){GetStr(Val).Save(SOut, true);} else {SOut.Save(Val);}}
double Val
Definition: dt.h:1291
void Save(TSOut &SOut, const bool &IsSmall=false) const
Definition: dt.h:440
void Save(const bool &Bool)
Definition: fl.h:173
TStr GetStr() const
Definition: dt.h:1365

Here is the call graph for this function:

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

Definition at line 2232 of file dt.cpp.

References GetStr(), Val, and XSaveBETagArg.

2232  {
2233  XSaveBETagArg(Nm, "Val", TFlt::GetStr(Val));
2234 }
#define XSaveBETagArg(Nm, ArgNm, ArgVal)
Definition: bd.h:327
double Val
Definition: dt.h:1291
TStr GetStr() const
Definition: dt.h:1365

Here is the call graph for this function:

static int TFlt::Sign ( const double &  Flt)
inlinestatic

Definition at line 1334 of file dt.h.

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

Member Data Documentation

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

Definition at line 1297 of file dt.h.

Referenced by FltIsZero().

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

Definition at line 1298 of file dt.h.

const double TFlt::NInf =-DBL_MAX
static

Definition at line 1295 of file dt.h.

const double TFlt::PInf =+DBL_MAX
static

Definition at line 1296 of file dt.h.

TRnd TFlt::Rnd
static

Definition at line 1299 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: